mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
new multi version export check
This commit is contained in:
parent
4e05e78846
commit
273e0a3900
2
.gitignore
vendored
2
.gitignore
vendored
@ -23,3 +23,5 @@ package-lock.*
|
||||
/demo-shell/dist-dev-temp/
|
||||
/lib/export-new.json
|
||||
/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 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 {
|
||||
position?: {
|
||||
line: number,
|
||||
@ -78,27 +88,27 @@ let currentErrorPostion = function (exportEntry) {
|
||||
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) => {
|
||||
return currentExport_new.name === currentExport_old.name;
|
||||
let currentexportNew = exportNew.filter((currentexportNew) => {
|
||||
return currentexportNew.name === currentexportLastMajor.name;
|
||||
});
|
||||
|
||||
if (currentExport_new.length > 1) {
|
||||
if (currentexportNew.length > 1) {
|
||||
|
||||
let arrayCall = [];
|
||||
|
||||
currentExport_new.forEach((error) => {
|
||||
currentexportNew.forEach((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) {
|
||||
if (!currentExport_old.skipError) {
|
||||
add_error(`Not find export ${currentExport_old.name} , old path: [${currentErrorPostion(currentExport_old)}]`, currentExport_old.name);
|
||||
} else if (currentexportNew.length === 0) {
|
||||
if (!currentexportLastMajor.skipError) {
|
||||
add_error(`Not find export ${currentexportLastMajor.name} , old path: [${currentErrorPostion(currentexportLastMajor)}]`, currentexportLastMajor.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -151,31 +161,40 @@ function generatExportList(fileNames: string[], options: ts.CompilerOptions): vo
|
||||
|
||||
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));
|
||||
|
||||
try {
|
||||
var export_old = JSON.parse(fs.readFileSync('export-2.0.0.json', 'utf8'));
|
||||
} catch (error) {
|
||||
console.log(chalk.red('export-2.0.0.json not present'));
|
||||
throw new Error('Undetected export comapring file');
|
||||
}
|
||||
var exportNewJSON = JSON.parse(JSON.stringify(exportCurrentVersion));
|
||||
|
||||
var export_new = JSON.parse(JSON.stringify(exportCurrentVersion));
|
||||
exportFilesVersions.forEach((currentExportVersionFile) => {
|
||||
|
||||
console.log(chalk.green('Comparing export-2.0.0.json and export-new.json'));
|
||||
error_array = [];
|
||||
warning_array = [];
|
||||
|
||||
check_export(export_old, export_new);
|
||||
try {
|
||||
var currentExportVersionJSON = JSON.parse(fs.readFileSync(`${currentExportVersionFile}`, 'utf8'));
|
||||
} catch (error) {
|
||||
console.log(chalk.red(`${currentExportVersionFile} json not present`));
|
||||
throw new Error(`Undetected export comapring file ${currentExportVersionFile}`);
|
||||
}
|
||||
|
||||
print_warnings();
|
||||
print_errors();
|
||||
|
||||
if (error_array.length > 0) {
|
||||
throw new Error('Export problems detected');
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
console.log(chalk.green(`Comparing ${newLibExports} and ${currentExportVersionFile}`));
|
||||
|
||||
check_export(currentExportVersionJSON, exportNewJSON);
|
||||
|
||||
print_warnings();
|
||||
print_errors();
|
||||
|
||||
|
||||
if (error_array.length > 0) {
|
||||
throw new Error('Export problems detected');
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
function extractExport(node: ts.Node) {
|
||||
//skip file with export-check: exclude comment
|
@ -80,33 +80,6 @@ export function createTranslateLoader(http: HttpClient, logService: 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() {
|
||||
return [
|
||||
@ -148,7 +121,29 @@ export function providers() {
|
||||
|
||||
@NgModule({
|
||||
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({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
@ -158,7 +153,29 @@ export function providers() {
|
||||
})
|
||||
],
|
||||
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
|
||||
]
|
||||
})
|
||||
@ -167,7 +184,29 @@ export class CoreModuleLazy {
|
||||
|
||||
@NgModule({
|
||||
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({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
@ -177,7 +216,29 @@ export class CoreModuleLazy {
|
||||
})
|
||||
],
|
||||
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
|
||||
],
|
||||
providers: [
|
||||
|
@ -32,8 +32,8 @@
|
||||
"build-content": "ng-packagr -p ./content-services/package.json",
|
||||
"build-process": "ng-packagr -p ./process-services/package.json",
|
||||
"build-insights": "ng-packagr -p ./insights/package.json",
|
||||
"build-export-check": "tsc ./config/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",
|
||||
"build-export-check": "tsc ./config/export-check/exportCheck.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",
|
||||
"webpack": "node node_modules/webpack/bin/webpack.js"
|
||||
},
|
||||
@ -126,6 +126,7 @@
|
||||
"markdown-toc": "1.1.0",
|
||||
"markdownlint-cli": "^0.3.1",
|
||||
"merge-stream": "1.0.1",
|
||||
"nconf": "^0.10.0",
|
||||
"node-sass": "4.5.3",
|
||||
"null-loader": "0.1.1",
|
||||
"raw-loader": "0.5.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user