mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
new multi version export check
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -23,3 +23,5 @@ package-lock.*
|
|||||||
/demo-shell/dist-dev-temp/
|
/demo-shell/dist-dev-temp/
|
||||||
/lib/export-new.json
|
/lib/export-new.json
|
||||||
/lib/config/exportCheck.js
|
/lib/config/exportCheck.js
|
||||||
|
/lib/config/export-check/export-new.json
|
||||||
|
/lib/config/export-check/exportCheck.js
|
||||||
|
5591
lib/config/export-check/export-2.1.0.json
Normal file
5591
lib/config/export-check/export-2.1.0.json
Normal file
File diff suppressed because it is too large
Load Diff
7
lib/config/export-check/export-check-config.json
Normal file
7
lib/config/export-check/export-check-config.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"export-last-version": "export-new.json",
|
||||||
|
"export-versions": [
|
||||||
|
"export-2.0.0.json",
|
||||||
|
"export-2.1.0.json"
|
||||||
|
]
|
||||||
|
}
|
@@ -2,6 +2,16 @@ import * as ts from "typescript";
|
|||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
|
|
||||||
|
var nconf = require('nconf');
|
||||||
|
var baseParh = "./config/export-check/";
|
||||||
|
|
||||||
|
nconf.add('config', { type: 'file', file: `${baseParh}export-check-config.json` });
|
||||||
|
|
||||||
|
var newLibExports = baseParh + nconf.get('export-last-version');
|
||||||
|
var exportFilesVersions = nconf.get('export-versions').map((currentFile) => {
|
||||||
|
return baseParh + currentFile;
|
||||||
|
});
|
||||||
|
|
||||||
interface DocEntry {
|
interface DocEntry {
|
||||||
position?: {
|
position?: {
|
||||||
line: number,
|
line: number,
|
||||||
@@ -78,27 +88,27 @@ let currentErrorPostion = function (exportEntry) {
|
|||||||
return ` ${exportEntry.position.fileName} (${exportEntry.position.line},${exportEntry.position.character})`
|
return ` ${exportEntry.position.fileName} (${exportEntry.position.line},${exportEntry.position.character})`
|
||||||
}
|
}
|
||||||
|
|
||||||
let check_export = function (export_old: any, export_new: any) {
|
let check_export = function (exportLastMajor: any, exportNew: any) {
|
||||||
|
|
||||||
export_old.forEach((currentExport_old) => {
|
exportLastMajor.forEach((currentexportLastMajor) => {
|
||||||
|
|
||||||
let currentExport_new = export_new.filter((currentExport_new) => {
|
let currentexportNew = exportNew.filter((currentexportNew) => {
|
||||||
return currentExport_new.name === currentExport_old.name;
|
return currentexportNew.name === currentexportLastMajor.name;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (currentExport_new.length > 1) {
|
if (currentexportNew.length > 1) {
|
||||||
|
|
||||||
let arrayCall = [];
|
let arrayCall = [];
|
||||||
|
|
||||||
currentExport_new.forEach((error) => {
|
currentexportNew.forEach((error) => {
|
||||||
arrayCall.push(`${currentErrorPostion(error)}`);
|
arrayCall.push(`${currentErrorPostion(error)}`);
|
||||||
})
|
})
|
||||||
|
|
||||||
add_warning(`Multiple export ${currentExport_new[0].name} times ${currentExport_new.length}`, currentExport_new[0].name, arrayCall);
|
add_warning(`Multiple export ${currentexportNew[0].name} times ${currentexportNew.length}`, currentexportNew[0].name, arrayCall);
|
||||||
|
|
||||||
} else if (currentExport_new.length === 0) {
|
} else if (currentexportNew.length === 0) {
|
||||||
if (!currentExport_old.skipError) {
|
if (!currentexportLastMajor.skipError) {
|
||||||
add_error(`Not find export ${currentExport_old.name} , old path: [${currentErrorPostion(currentExport_old)}]`, currentExport_old.name);
|
add_error(`Not find export ${currentexportLastMajor.name} , old path: [${currentErrorPostion(currentexportLastMajor)}]`, currentexportLastMajor.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -151,32 +161,41 @@ function generatExportList(fileNames: string[], options: ts.CompilerOptions): vo
|
|||||||
|
|
||||||
exportCurrentVersion.sort((nameA, nameB) => nameA.name.localeCompare(nameB.name));
|
exportCurrentVersion.sort((nameA, nameB) => nameA.name.localeCompare(nameB.name));
|
||||||
|
|
||||||
console.log(chalk.green('Saving new export in export-new.json'));
|
console.log(chalk.green(`Saving new export in ${newLibExports}`));
|
||||||
|
|
||||||
fs.writeFileSync('export-new.json', JSON.stringify(exportCurrentVersion, undefined, 4));
|
fs.writeFileSync(newLibExports, JSON.stringify(exportCurrentVersion, undefined, 4));
|
||||||
|
|
||||||
|
var exportNewJSON = JSON.parse(JSON.stringify(exportCurrentVersion));
|
||||||
|
|
||||||
|
exportFilesVersions.forEach((currentExportVersionFile) => {
|
||||||
|
|
||||||
|
error_array = [];
|
||||||
|
warning_array = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var export_old = JSON.parse(fs.readFileSync('export-2.0.0.json', 'utf8'));
|
var currentExportVersionJSON = JSON.parse(fs.readFileSync(`${currentExportVersionFile}`, 'utf8'));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(chalk.red('export-2.0.0.json not present'));
|
console.log(chalk.red(`${currentExportVersionFile} json not present`));
|
||||||
throw new Error('Undetected export comapring file');
|
throw new Error(`Undetected export comapring file ${currentExportVersionFile}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
var export_new = JSON.parse(JSON.stringify(exportCurrentVersion));
|
|
||||||
|
|
||||||
console.log(chalk.green('Comparing export-2.0.0.json and export-new.json'));
|
console.log(chalk.green(`Comparing ${newLibExports} and ${currentExportVersionFile}`));
|
||||||
|
|
||||||
check_export(export_old, export_new);
|
check_export(currentExportVersionJSON, exportNewJSON);
|
||||||
|
|
||||||
print_warnings();
|
print_warnings();
|
||||||
print_errors();
|
print_errors();
|
||||||
|
|
||||||
|
|
||||||
if (error_array.length > 0) {
|
if (error_array.length > 0) {
|
||||||
throw new Error('Export problems detected');
|
throw new Error('Export problems detected');
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
function extractExport(node: ts.Node) {
|
function extractExport(node: ts.Node) {
|
||||||
//skip file with export-check: exclude comment
|
//skip file with export-check: exclude comment
|
||||||
if (node.getFullText(node.getSourceFile()).indexOf('export-check: exclude') > 0) {
|
if (node.getFullText(node.getSourceFile()).indexOf('export-check: exclude') > 0) {
|
@@ -80,33 +80,6 @@ export function createTranslateLoader(http: HttpClient, logService: LogService)
|
|||||||
return new TranslateLoaderService(http, logService);
|
return new TranslateLoaderService(http, logService);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function modules() {
|
|
||||||
return [
|
|
||||||
ViewerModule,
|
|
||||||
SideBarActionModule,
|
|
||||||
PipeModule,
|
|
||||||
CommonModule,
|
|
||||||
DirectiveModule,
|
|
||||||
FormsModule,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
HttpClientModule,
|
|
||||||
HostSettingsModule,
|
|
||||||
UserInfoModule,
|
|
||||||
MaterialModule,
|
|
||||||
AppConfigModule,
|
|
||||||
PaginationModule,
|
|
||||||
ToolbarModule,
|
|
||||||
ContextMenuModule,
|
|
||||||
CardViewModule,
|
|
||||||
CollapsableModule,
|
|
||||||
FormModule,
|
|
||||||
LoginModule,
|
|
||||||
LanguageMenuModule,
|
|
||||||
InfoDrawerModule,
|
|
||||||
DataColumnModule,
|
|
||||||
DataTableModule
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function providers() {
|
export function providers() {
|
||||||
return [
|
return [
|
||||||
@@ -148,7 +121,29 @@ export function providers() {
|
|||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
...modules(),
|
ViewerModule,
|
||||||
|
SideBarActionModule,
|
||||||
|
PipeModule,
|
||||||
|
CommonModule,
|
||||||
|
DirectiveModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
HttpClientModule,
|
||||||
|
HostSettingsModule,
|
||||||
|
UserInfoModule,
|
||||||
|
MaterialModule,
|
||||||
|
AppConfigModule,
|
||||||
|
PaginationModule,
|
||||||
|
ToolbarModule,
|
||||||
|
ContextMenuModule,
|
||||||
|
CardViewModule,
|
||||||
|
CollapsableModule,
|
||||||
|
FormModule,
|
||||||
|
LoginModule,
|
||||||
|
LanguageMenuModule,
|
||||||
|
InfoDrawerModule,
|
||||||
|
DataColumnModule,
|
||||||
|
DataTableModule,
|
||||||
TranslateModule.forChild({
|
TranslateModule.forChild({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
@@ -158,7 +153,29 @@ export function providers() {
|
|||||||
})
|
})
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
...modules(),
|
ViewerModule,
|
||||||
|
SideBarActionModule,
|
||||||
|
PipeModule,
|
||||||
|
CommonModule,
|
||||||
|
DirectiveModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
HttpClientModule,
|
||||||
|
HostSettingsModule,
|
||||||
|
UserInfoModule,
|
||||||
|
MaterialModule,
|
||||||
|
AppConfigModule,
|
||||||
|
PaginationModule,
|
||||||
|
ToolbarModule,
|
||||||
|
ContextMenuModule,
|
||||||
|
CardViewModule,
|
||||||
|
CollapsableModule,
|
||||||
|
FormModule,
|
||||||
|
LoginModule,
|
||||||
|
LanguageMenuModule,
|
||||||
|
InfoDrawerModule,
|
||||||
|
DataColumnModule,
|
||||||
|
DataTableModule,
|
||||||
TranslateModule
|
TranslateModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -167,7 +184,29 @@ export class CoreModuleLazy {
|
|||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
...modules(),
|
ViewerModule,
|
||||||
|
SideBarActionModule,
|
||||||
|
PipeModule,
|
||||||
|
CommonModule,
|
||||||
|
DirectiveModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
HttpClientModule,
|
||||||
|
HostSettingsModule,
|
||||||
|
UserInfoModule,
|
||||||
|
MaterialModule,
|
||||||
|
AppConfigModule,
|
||||||
|
PaginationModule,
|
||||||
|
ToolbarModule,
|
||||||
|
ContextMenuModule,
|
||||||
|
CardViewModule,
|
||||||
|
CollapsableModule,
|
||||||
|
FormModule,
|
||||||
|
LoginModule,
|
||||||
|
LanguageMenuModule,
|
||||||
|
InfoDrawerModule,
|
||||||
|
DataColumnModule,
|
||||||
|
DataTableModule,
|
||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
@@ -177,7 +216,29 @@ export class CoreModuleLazy {
|
|||||||
})
|
})
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
...modules(),
|
ViewerModule,
|
||||||
|
SideBarActionModule,
|
||||||
|
PipeModule,
|
||||||
|
CommonModule,
|
||||||
|
DirectiveModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
HttpClientModule,
|
||||||
|
HostSettingsModule,
|
||||||
|
UserInfoModule,
|
||||||
|
MaterialModule,
|
||||||
|
AppConfigModule,
|
||||||
|
PaginationModule,
|
||||||
|
ToolbarModule,
|
||||||
|
ContextMenuModule,
|
||||||
|
CardViewModule,
|
||||||
|
CollapsableModule,
|
||||||
|
FormModule,
|
||||||
|
LoginModule,
|
||||||
|
LanguageMenuModule,
|
||||||
|
InfoDrawerModule,
|
||||||
|
DataColumnModule,
|
||||||
|
DataTableModule,
|
||||||
TranslateModule
|
TranslateModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
|
@@ -32,8 +32,8 @@
|
|||||||
"build-content": "ng-packagr -p ./content-services/package.json",
|
"build-content": "ng-packagr -p ./content-services/package.json",
|
||||||
"build-process": "ng-packagr -p ./process-services/package.json",
|
"build-process": "ng-packagr -p ./process-services/package.json",
|
||||||
"build-insights": "ng-packagr -p ./insights/package.json",
|
"build-insights": "ng-packagr -p ./insights/package.json",
|
||||||
"build-export-check": "tsc ./config/exportCheck.ts",
|
"build-export-check": "tsc ./config/export-check/exportCheck.ts",
|
||||||
"export-check": "node ./config/exportCheck.js ./core/public-api.ts ./process-services/public-api.ts ./content-services/public-api.ts ./insights/public-api.ts",
|
"export-check": "node ./config/export-check/exportCheck.js ./core/public-api.ts ./process-services/public-api.ts ./content-services/public-api.ts ./insights/public-api.ts",
|
||||||
"test-export": "npm run build-export-check && npm run export-check",
|
"test-export": "npm run build-export-check && npm run export-check",
|
||||||
"webpack": "node node_modules/webpack/bin/webpack.js"
|
"webpack": "node node_modules/webpack/bin/webpack.js"
|
||||||
},
|
},
|
||||||
@@ -126,6 +126,7 @@
|
|||||||
"markdown-toc": "1.1.0",
|
"markdown-toc": "1.1.0",
|
||||||
"markdownlint-cli": "^0.3.1",
|
"markdownlint-cli": "^0.3.1",
|
||||||
"merge-stream": "1.0.1",
|
"merge-stream": "1.0.1",
|
||||||
|
"nconf": "^0.10.0",
|
||||||
"node-sass": "4.5.3",
|
"node-sass": "4.5.3",
|
||||||
"null-loader": "0.1.1",
|
"null-loader": "0.1.1",
|
||||||
"raw-loader": "0.5.1",
|
"raw-loader": "0.5.1",
|
||||||
|
Reference in New Issue
Block a user