@microsoft/windows-admin-center-sdk 4.123.0 → 4.167.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/angular/assets/strings/cs-CZ/strings.json +1 -1
- package/angular/assets/strings/de-DE/strings.json +1 -1
- package/angular/assets/strings/es-ES/strings.json +1 -1
- package/angular/assets/strings/fr-FR/strings.json +1 -1
- package/angular/assets/strings/hu-HU/strings.json +1 -1
- package/angular/assets/strings/id-ID/strings.json +1 -1
- package/angular/assets/strings/it-IT/strings.json +1 -1
- package/angular/assets/strings/ja-JP/strings.json +1 -1
- package/angular/assets/strings/ko-KR/strings.json +1 -1
- package/angular/assets/strings/nl-NL/strings.json +1 -1
- package/angular/assets/strings/pl-PL/strings.json +1 -1
- package/angular/assets/strings/pt-BR/strings.json +1 -1
- package/angular/assets/strings/pt-PT/strings.json +1 -1
- package/angular/assets/strings/ru-RU/strings.json +1 -1
- package/angular/assets/strings/strings.json +1 -1
- package/angular/assets/strings/sv-SE/strings.json +1 -1
- package/angular/assets/strings/tr-TR/strings.json +1 -1
- package/angular/assets/strings/zh-CN/strings.json +1 -1
- package/angular/assets/strings/zh-TW/strings.json +1 -1
- package/angular/esm2020/src/controls/actions/containers/action-container.component.mjs +2 -3
- package/angular/esm2020/src/controls/alert-bar/alert-bar.component.mjs +2 -2
- package/angular/esm2020/src/controls/breadcrumb-header/breadcrumb-header.component.mjs +1 -1
- package/angular/esm2020/src/controls/common/base.component.mjs +1 -1
- package/angular/esm2020/src/controls/common/spacer-base.component.mjs +25 -1
- package/angular/esm2020/src/controls/context-menu/context-menu.component.mjs +2 -3
- package/angular/esm2020/src/controls/data-table/data-table.component.mjs +7 -7
- package/angular/esm2020/src/controls/dialog/base-dialog.component.mjs +2 -4
- package/angular/esm2020/src/controls/dialog/confirmation-list-dialog/confirmation-list-dialog.component.mjs +2 -2
- package/angular/esm2020/src/controls/dropdown/dropdown.component.mjs +1 -4
- package/angular/esm2020/src/controls/form/form-field/clock/clock-form-field.component.mjs +10 -7
- package/angular/esm2020/src/controls/form/form-field/form-field.component.mjs +1 -1
- package/angular/esm2020/src/controls/form/form-field/number/number-form-field.component.mjs +22 -4
- package/angular/esm2020/src/controls/form/form-field/radio-group/classic/radio-group-form-field.component.mjs +5 -5
- package/angular/esm2020/src/controls/icon/icon-text/icon-text.component.mjs +6 -6
- package/angular/esm2020/src/controls/icon/layered-icon/status/status-icon.component.mjs +1 -1
- package/angular/esm2020/src/controls/layout/editable-layout.component.mjs +2 -3
- package/angular/esm2020/src/controls/node-credentials-form/node-credentials-form.component.mjs +2 -2
- package/angular/esm2020/src/controls/property-grid/property-grid.component.mjs +33 -13
- package/angular/esm2020/src/controls/schema/tabbed-form-loader.component.mjs +2 -2
- package/angular/esm2020/src/controls/settings/common-settings/common-settings.component.mjs +5 -5
- package/angular/esm2020/src/controls/settings/settings-form.directive.mjs +3 -7
- package/angular/esm2020/src/controls/settings/settings-form.service.mjs +2 -4
- package/angular/esm2020/src/controls/snap-in-extension/snap-in-extension.component.mjs +1 -1
- package/angular/esm2020/src/controls/split-view/split-view.component.mjs +2 -2
- package/angular/esm2020/src/directives/router/router-link.directive.mjs +2 -2
- package/angular/esm2020/src/directives/svg/svg.directive.mjs +2 -3
- package/angular/esm2020/src/generated/strings.mjs +1 -1
- package/angular/esm2020/src/service/navigation.service.mjs +3 -8
- package/angular/esm2020/src/service/user-alive.service.mjs +2 -4
- package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.mjs +126 -72
- package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.mjs.map +1 -1
- package/angular/fesm2020/microsoft-windows-admin-center-sdk-angular.mjs +115 -70
- package/angular/fesm2020/microsoft-windows-admin-center-sdk-angular.mjs.map +1 -1
- package/angular/package.json +1 -1
- package/angular/src/controls/common/spacer-base.component.d.ts +11 -2
- package/angular/src/controls/form/form-field/number/number-form-field.component.d.ts +8 -0
- package/angular/src/controls/icon/icon-text/icon-text.component.d.ts +1 -1
- package/angular/src/controls/property-grid/property-grid.component.d.ts +2 -0
- package/angular/src/directives/svg/svg.directive.d.ts +1 -2
- package/angular/src/generated/strings.d.ts +12 -0
- package/core/azure/azure-constants.d.ts +2 -2
- package/core/azure/azure-constants.d.ts.map +1 -1
- package/core/azure/azure-constants.js +10 -3
- package/core/azure/azure-constants.js.map +1 -1
- package/core/data/gateway-url-translator.d.ts +1 -0
- package/core/data/gateway-url-translator.d.ts.map +1 -1
- package/core/data/gateway-url-translator.js +21 -6
- package/core/data/gateway-url-translator.js.map +1 -1
- package/core/data/node-connection.d.ts.map +1 -1
- package/core/data/node-connection.js +0 -2
- package/core/data/node-connection.js.map +1 -1
- package/core/generated/powershell-scripts.d.ts.map +1 -1
- package/core/generated/powershell-scripts.js +1 -1
- package/core/generated/powershell-scripts.js.map +1 -1
- package/core/resources/scripts/public/inventory/Get-ServerInventory.ps1 +30 -8
- package/{microsoft-windows-admin-center-sdk-4.123.0.tgz → microsoft-windows-admin-center-sdk-4.167.0.tgz} +0 -0
- package/package.json +9 -7
- package/styles/css/main-v2.css +1 -1
- package/tools/code-formatter/.eslintrc.base.json +1 -0
- package/tools/code-formatter/lint.d.ts.map +1 -1
- package/tools/code-formatter/lint.js +7 -1
- package/tools/code-formatter/lint.js.map +1 -1
- package/tools/code-formatter/utilities.d.ts +7 -0
- package/tools/code-formatter/utilities.d.ts.map +1 -0
- package/tools/code-formatter/utilities.js +79 -0
- package/tools/code-formatter/utilities.js.map +1 -0
- package/tools/gulp-update-notes-resource/index.d.ts.map +1 -1
- package/tools/gulp-update-notes-resource/index.js +4 -4
- package/tools/gulp-update-notes-resource/index.js.map +1 -1
- package/tools/module-template/.eslintrc.json +3 -0
- package/tools/module-template/gulpfile.ts/common/utilities.ts +1 -0
- package/tools/wac-cli/src/angular15/configs/eslint-auto-fix-config.d.ts +9 -0
- package/tools/wac-cli/src/angular15/configs/eslint-auto-fix-config.d.ts.map +1 -0
- package/tools/wac-cli/src/angular15/configs/eslint-auto-fix-config.js +16 -0
- package/tools/wac-cli/src/angular15/configs/eslint-auto-fix-config.js.map +1 -0
- package/tools/wac-cli/src/angular15/main.d.ts +19 -3
- package/tools/wac-cli/src/angular15/main.d.ts.map +1 -1
- package/tools/wac-cli/src/angular15/main.js +41 -7
- package/tools/wac-cli/src/angular15/main.js.map +1 -1
- package/tools/wac-cli/src/angular15/upgrader/eslint-auto-fix-upgrader.d.ts +18 -0
- package/tools/wac-cli/src/angular15/upgrader/eslint-auto-fix-upgrader.d.ts.map +1 -0
- package/tools/wac-cli/src/angular15/upgrader/eslint-auto-fix-upgrader.js +49 -0
- package/tools/wac-cli/src/angular15/upgrader/eslint-auto-fix-upgrader.js.map +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/tools/code-formatter/lint.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"sources":["../../../packages/tools/code-formatter/lint.ts"],"names":[],"mappings":";;AAKA,sBAAc,UAAU,CAAC;IACrB,SAAgB,OAAO,2BAUtB;IAED,SAAgB,oBAAoB,2BAOnC;IAED,SAAgB,2BAA2B,2BAK1C;IAGM,MAAM,IAAI,mCAA+C,CAAC;CACpE","file":"lint.d.ts","sourcesContent":["import { dest, series, src } from 'gulp';\r\nimport eslint from 'gulp-eslint-new';\r\nimport ts from 'gulp-typescript';\r\nimport { Utilities } from './utilities';\r\n\r\nexport module LintModule {\r\n export function lintApp() {\r\n const argv = Utilities.gulpArgv();\r\n return src(['src/**/*.ts', '!src/generated/**/*.*'])\r\n .pipe(eslint({\r\n overrideConfigFile: `./.eslintrc.json`,\r\n fix: argv['fix'] as boolean\r\n }))\r\n .pipe(eslint.format())\r\n .pipe(dest('src'))\r\n .pipe(eslint.failAfterError());\r\n }\r\n\r\n export function lintUiTestAutomation() {\r\n const tsProject = ts.createProject('uta/tsconfig.json');\r\n\r\n return tsProject.src()\r\n .pipe(eslint())\r\n .pipe(eslint.format())\r\n .pipe(eslint.failAfterError());\r\n }\r\n\r\n export function lintUiTestAutomation_legacy() {\r\n return src(['ui-test-automation/**/*.ts', '!ui-test-automation/node_modules/**/*.*'])\r\n .pipe(eslint())\r\n .pipe(eslint.format())\r\n .pipe(eslint.failAfterError());\r\n }\r\n\r\n // for the backward compatibility with repositories that have not been onboarded to the latest ui automation framework.\r\n export const lint = series(lintApp, lintUiTestAutomation_legacy);\r\n}\r\n"]}
|
|
@@ -5,12 +5,18 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const gulp_1 = require("gulp");
|
|
6
6
|
const gulp_eslint_new_1 = tslib_1.__importDefault(require("gulp-eslint-new"));
|
|
7
7
|
const gulp_typescript_1 = tslib_1.__importDefault(require("gulp-typescript"));
|
|
8
|
+
const utilities_1 = require("./utilities");
|
|
8
9
|
var LintModule;
|
|
9
10
|
(function (LintModule) {
|
|
10
11
|
function lintApp() {
|
|
12
|
+
const argv = utilities_1.Utilities.gulpArgv();
|
|
11
13
|
return (0, gulp_1.src)(['src/**/*.ts', '!src/generated/**/*.*'])
|
|
12
|
-
.pipe((0, gulp_eslint_new_1.default)(
|
|
14
|
+
.pipe((0, gulp_eslint_new_1.default)({
|
|
15
|
+
overrideConfigFile: `./.eslintrc.json`,
|
|
16
|
+
fix: argv['fix']
|
|
17
|
+
}))
|
|
13
18
|
.pipe(gulp_eslint_new_1.default.format())
|
|
19
|
+
.pipe((0, gulp_1.dest)('src'))
|
|
14
20
|
.pipe(gulp_eslint_new_1.default.failAfterError());
|
|
15
21
|
}
|
|
16
22
|
LintModule.lintApp = lintApp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/tools/code-formatter/lint.ts"],"names":[],"mappings":";;;;AAAA,+
|
|
1
|
+
{"version":3,"sources":["../../../packages/tools/code-formatter/lint.ts"],"names":[],"mappings":";;;;AAAA,+BAAyC;AACzC,8EAAqC;AACrC,8EAAiC;AACjC,2CAAwC;AAExC,IAAc,UAAU,CA+BvB;AA/BD,WAAc,UAAU;IACpB,S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ulp';\r\nimport eslint from 'gulp-eslint-new';\r\nimport ts from 'gulp-typescript';\r\nimport { Utilities } from './utilities';\r\n\r\nexport module LintModule {\r\n export function lintApp() {\r\n const argv = Utilities.gulpArgv();\r\n return src(['src/**/*.ts', '!src/generated/**/*.*'])\r\n .pipe(eslint({\r\n overrideConfigFile: `./.eslintrc.json`,\r\n fix: argv['fix'] as boolean\r\n }))\r\n .pipe(eslint.format())\r\n .pipe(dest('src'))\r\n .pipe(eslint.failAfterError());\r\n }\r\n\r\n export function lintUiTestAutomation() {\r\n const tsProject = ts.createProject('uta/tsconfig.json');\r\n\r\n return tsProject.src()\r\n .pipe(eslint())\r\n .pipe(eslint.format())\r\n .pipe(eslint.failAfterError());\r\n }\r\n\r\n export function lintUiTestAutomation_legacy() {\r\n return src(['ui-test-automation/**/*.ts', '!ui-test-automation/node_modules/**/*.*'])\r\n .pipe(eslint())\r\n .pipe(eslint.format())\r\n .pipe(eslint.failAfterError());\r\n }\r\n\r\n // for the backward compatibility with repositories that have not been onboarded to the latest ui automation framework.\r\n export const lint = series(lintApp, lintUiTestAutomation_legacy);\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../packages/tools/code-formatter/utilities.ts"],"names":[],"mappings":"AAIA,sBAAc,SAAS,CAAC;IAMpB,SAAgB,QAAQ,IAAI;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;KAAE,CAuBhE;IAED,SAAgB,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,GAAG,IAAI,CAMnE;IAED,SAAgB,EAAE,CAAC,EAAE,KAAA,EAAE,IAAI,KAAA,EAAE,OAAO,KAAK,EAAE,WAAW,MAAO,QA0B5D;CACJ","file":"utilities.d.ts","sourcesContent":["import childProcess from 'child_process';\r\nimport log from 'fancy-log';\r\nimport { argv as values } from 'yargs';\r\n\r\nexport module Utilities {\r\n\r\n function toBoolean(value: any, defaultValue: boolean = false) {\r\n return defaultValue ? value !== false : !!value;\r\n }\r\n\r\n export function gulpArgv(): { [index: string]: boolean | string } {\r\n return {\r\n prod: toBoolean(values['prod']),\r\n verbose: toBoolean(values['verbose']),\r\n junit: toBoolean(values['junit']),\r\n expandCss: toBoolean(values['expandcss']),\r\n target: values['target'] as string,\r\n debug: toBoolean(values['debug']),\r\n styles: toBoolean(values['styles']),\r\n resources: toBoolean(values['resources']),\r\n core: toBoolean(values['core']),\r\n angular: toBoolean(values['angular']),\r\n app: toBoolean(values['app']),\r\n devGuide: toBoolean(values['devguide']),\r\n fix: toBoolean(values['fix']),\r\n version: values['V'] as string,\r\n icon: values['icon'] as string,\r\n license: values['license'] as string,\r\n company: values['company'] as string,\r\n copyright: values['copyright'] as string,\r\n iconUrl: values['iconUrl'] as string,\r\n targetPath: values['targetPath'] as string\r\n };\r\n }\r\n\r\n export function exportFunctions(context: any, gulpModule: any): void {\r\n for (const func in gulpModule) {\r\n if (gulpModule.hasOwnProperty(func)) {\r\n context[func] = gulpModule[func];\r\n }\r\n }\r\n }\r\n\r\n export function ng(cb, args, options = {}, codeHandler = null) {\r\n log('ng', args.join(' '));\r\n const errors = [];\r\n const cmd = childProcess.spawn('ng.cmd', args, options);\r\n cmd.stdout.on('data', (data) => { log(data.toString().trim()); });\r\n cmd.stderr.on('data', (data) => {\r\n const message = data.toString().trim();\r\n if (message.toUpperCase().startsWith('ERROR')) {\r\n log.error(message);\r\n errors.push(message);\r\n } else {\r\n log(message);\r\n }\r\n });\r\n cmd.on('exit', (code) => {\r\n if (codeHandler) {\r\n const codeError = codeHandler(code);\r\n if (codeError) {\r\n errors.push(codeError);\r\n }\r\n }\r\n if (errors.length > 0) {\r\n cb(errors.join('\\n'));\r\n } else { cb(); }\r\n });\r\n\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Utilities = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const child_process_1 = tslib_1.__importDefault(require("child_process"));
|
|
6
|
+
const fancy_log_1 = tslib_1.__importDefault(require("fancy-log"));
|
|
7
|
+
const yargs_1 = require("yargs");
|
|
8
|
+
var Utilities;
|
|
9
|
+
(function (Utilities) {
|
|
10
|
+
function toBoolean(value, defaultValue = false) {
|
|
11
|
+
return defaultValue ? value !== false : !!value;
|
|
12
|
+
}
|
|
13
|
+
function gulpArgv() {
|
|
14
|
+
return {
|
|
15
|
+
prod: toBoolean(yargs_1.argv['prod']),
|
|
16
|
+
verbose: toBoolean(yargs_1.argv['verbose']),
|
|
17
|
+
junit: toBoolean(yargs_1.argv['junit']),
|
|
18
|
+
expandCss: toBoolean(yargs_1.argv['expandcss']),
|
|
19
|
+
target: yargs_1.argv['target'],
|
|
20
|
+
debug: toBoolean(yargs_1.argv['debug']),
|
|
21
|
+
styles: toBoolean(yargs_1.argv['styles']),
|
|
22
|
+
resources: toBoolean(yargs_1.argv['resources']),
|
|
23
|
+
core: toBoolean(yargs_1.argv['core']),
|
|
24
|
+
angular: toBoolean(yargs_1.argv['angular']),
|
|
25
|
+
app: toBoolean(yargs_1.argv['app']),
|
|
26
|
+
devGuide: toBoolean(yargs_1.argv['devguide']),
|
|
27
|
+
fix: toBoolean(yargs_1.argv['fix']),
|
|
28
|
+
version: yargs_1.argv['V'],
|
|
29
|
+
icon: yargs_1.argv['icon'],
|
|
30
|
+
license: yargs_1.argv['license'],
|
|
31
|
+
company: yargs_1.argv['company'],
|
|
32
|
+
copyright: yargs_1.argv['copyright'],
|
|
33
|
+
iconUrl: yargs_1.argv['iconUrl'],
|
|
34
|
+
targetPath: yargs_1.argv['targetPath']
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
Utilities.gulpArgv = gulpArgv;
|
|
38
|
+
function exportFunctions(context, gulpModule) {
|
|
39
|
+
for (const func in gulpModule) {
|
|
40
|
+
if (gulpModule.hasOwnProperty(func)) {
|
|
41
|
+
context[func] = gulpModule[func];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
Utilities.exportFunctions = exportFunctions;
|
|
46
|
+
function ng(cb, args, options = {}, codeHandler = null) {
|
|
47
|
+
(0, fancy_log_1.default)('ng', args.join(' '));
|
|
48
|
+
const errors = [];
|
|
49
|
+
const cmd = child_process_1.default.spawn('ng.cmd', args, options);
|
|
50
|
+
cmd.stdout.on('data', (data) => { (0, fancy_log_1.default)(data.toString().trim()); });
|
|
51
|
+
cmd.stderr.on('data', (data) => {
|
|
52
|
+
const message = data.toString().trim();
|
|
53
|
+
if (message.toUpperCase().startsWith('ERROR')) {
|
|
54
|
+
fancy_log_1.default.error(message);
|
|
55
|
+
errors.push(message);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
(0, fancy_log_1.default)(message);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
cmd.on('exit', (code) => {
|
|
62
|
+
if (codeHandler) {
|
|
63
|
+
const codeError = codeHandler(code);
|
|
64
|
+
if (codeError) {
|
|
65
|
+
errors.push(codeError);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (errors.length > 0) {
|
|
69
|
+
cb(errors.join('\n'));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
cb();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
Utilities.ng = ng;
|
|
77
|
+
})(Utilities = exports.Utilities || (exports.Utilities = {}));
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../packages/tools/code-formatter/utilities.ts"],"names":[],"mappings":";;;;AAAA,0EAAyC;AACzC,kEAA4B;AAC5B,iCAAuC;AAEvC,IAAc,SAAS,CAkEtB;AAlED,WAAc,SAAS;IAEnB,SAAS,SAAS,CAAC,KAAU,EAAE,eAAwB,KAAK;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,IAAI,EAAE,EAAE;YACpB,IAAI,WAAW,EAAE;gBACb,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;gBACpC,IAAI,SAAS,EAAE;oBACX,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBAC1B;aACJ;YACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;gBACnB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;aACzB;iBAAM;gBAAE,EAAE,EAAE,CAAC;aAAE;QACpB,CAAC,CAAC,CAAC;IAEP,CAAC;IA1Be,YAAE,KA0BjB,CAAA;AACL,CAAC,EAlEa,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAkEtB","file":"utilities.js","sourcesContent":["import childProcess from 'child_process';\r\nimport log from 'fancy-log';\r\nimport { argv as values } from 'yargs';\r\n\r\nexport module Utilities {\r\n\r\n function toBoolean(value: any, defaultValue: boolean = false) {\r\n return defaultValue ? value !== false : !!value;\r\n }\r\n\r\n export function gulpArgv(): { [index: string]: boolean | string } {\r\n return {\r\n prod: toBoolean(values['prod']),\r\n verbose: toBoolean(values['verbose']),\r\n junit: toBoolean(values['junit']),\r\n expandCss: toBoolean(values['expandcss']),\r\n target: values['target'] as string,\r\n debug: toBoolean(values['debug']),\r\n styles: toBoolean(values['styles']),\r\n resources: toBoolean(values['resources']),\r\n core: toBoolean(values['core']),\r\n angular: toBoolean(values['angular']),\r\n app: toBoolean(values['app']),\r\n devGuide: toBoolean(values['devguide']),\r\n fix: toBoolean(values['fix']),\r\n version: values['V'] as string,\r\n icon: values['icon'] as string,\r\n license: values['license'] as string,\r\n company: values['company'] as string,\r\n copyright: values['copyright'] as string,\r\n iconUrl: values['iconUrl'] as string,\r\n targetPath: values['targetPath'] as string\r\n };\r\n }\r\n\r\n export function exportFunctions(context: any, gulpModule: any): void {\r\n for (const func in gulpModule) {\r\n if (gulpModule.hasOwnProperty(func)) {\r\n context[func] = gulpModule[func];\r\n }\r\n }\r\n }\r\n\r\n export function ng(cb, args, options = {}, codeHandler = null) {\r\n log('ng', args.join(' '));\r\n const errors = [];\r\n const cmd = childProcess.spawn('ng.cmd', args, options);\r\n cmd.stdout.on('data', (data) => { log(data.toString().trim()); });\r\n cmd.stderr.on('data', (data) => {\r\n const message = data.toString().trim();\r\n if (message.toUpperCase().startsWith('ERROR')) {\r\n log.error(message);\r\n errors.push(message);\r\n } else {\r\n log(message);\r\n }\r\n });\r\n cmd.on('exit', (code) => {\r\n if (codeHandler) {\r\n const codeError = codeHandler(code);\r\n if (codeError) {\r\n errors.push(codeError);\r\n }\r\n }\r\n if (errors.length > 0) {\r\n cb(errors.join('\\n'));\r\n } else { cb(); }\r\n });\r\n\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/tools/gulp-update-notes-resource/index.ts"],"names":[],"mappings":"","file":"index.d.ts","sourcesContent":["'use strict';\r\n\r\nimport { Buffer } from 'buffer';\r\nimport fs from 'fs';\r\nimport log from 'fancy-log';\r\nimport pluginError from 'plugin-error';\r\nimport through2 from 'through2';\r\nimport Vinyl from 'vinyl';\r\nimport * as util from '../utilities';\r\n\r\nconst PLUGIN_NAME = 'gulp-update-notes-resource';\r\n\r\ninterface Options {\r\n /**\r\n * resource name.\r\n */\r\n resourceName: string;\r\n\r\n /**\r\n * path of update notes file.\r\n */\r\n updateNotes: string;\r\n\r\n /**\r\n * depth of folder structure from the locale folder. (default is 1)\r\n */\r\n localeOffset: number;\r\n}\r\n\r\nfunction gulpUpdateNotesResources(options: Options) {\r\n function findResourceKey(node: any, results: string[]): void {\r\n const match = 'resources:strings:';\r\n const keys = Object.keys(node);\r\n if (keys && keys.length > 0) {\r\n keys.forEach(key => {\r\n const target = node[key];\r\n if (target) {\r\n if (typeof target === 'string') {\r\n if (target.indexOf(match) === 0) {\r\n const value = target.substring(match.length);\r\n if (results.indexOf(value) < 0) {\r\n results.push(value);\r\n }\r\n }\r\n } else {\r\n findResourceKey(target, results);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n // override options settings if not specified.\r\n options = <Options>Object.assign(\r\n {\r\n updateNotes: 'packages/shell/src/assets/updates/update-notes.json',\r\n localeOffset: 1\r\n },\r\n options || {});\r\n\r\n const resources: any = {};\r\n const keyToResources: any = {};\r\n\r\n return through2.obj(\r\n /**\r\n * Transform\r\n */\r\n function (file, encoding, callback) {\r\n let locale = 'default';\r\n if (resources.default) {\r\n // if default is set already, find current locale from the file path.\r\n const pathSegments = file.history[0].split('\\\\');\r\n locale = pathSegments[pathSegments.length - (2 + options.localeOffset)];\r\n }\r\n\r\n resources[locale] = {};\r\n if (resources.default) {\r\n // if default is set already, pre-fill all resource items from default.\r\n for (const resourceId in resources.default) {\r\n if (resources.default.hasOwnProperty(resourceId)) {\r\n resources[locale][resourceId] = resources.default[resourceId];\r\n }\r\n }\r\n }\r\n\r\n // remove comments, /* multiline comment */ and // one line comment and \"//\": \"JSON element comment\"\r\n const content = file.contents.toString('utf8')\r\n .replace(/(\\/\\*([^*]|[\\n]|(\\*+([^*/]|[\\n])))*\\*\\/+)|( +\\/\\/.*)|( +\\\"\\/\\/\\\".*)/g, '');\r\n const object = JSON.parse(content);\r\n if (object[options.resourceName] && object[options.resourceName]['App']['UpdateNotes']) {\r\n // supports <ResourceName>.Manifest.<KeyName> format.\r\n const items = object[options.resourceName]['App']['UpdateNotes'];\r\n for (const key in items) {\r\n if (items.hasOwnProperty(key)) {\r\n // Each key will have two children, title and description\r\n // no need to separate in JSON form\r\n resources[locale][key] = items[key];\r\n\r\n // Used to keep an alternate mapping we use later\r\n if (!keyToResources.hasOwnProperty(key)) {\r\n keyToResources[key] = {};\r\n }\r\n\r\n if (keyToResources.hasOwnProperty(key) &&\r\n !keyToResources[key].hasOwnProperty(locale)) {\r\n keyToResources[key][locale] = {};\r\n }\r\n keyToResources[key][locale] = items[key];\r\n }\r\n }\r\n } else {\r\n // supports <ResourceName>_App_UpdateNotes format.\r\n const resourceUpdateNotes = options.resourceName + '_App_UpdateNotes_';\r\n for (const name in object) {\r\n if (object.hasOwnProperty(name)) {\r\n const index = name.indexOf(resourceUpdateNotes);\r\n if (index === 0) {\r\n // Check if this resource has the specific substring or not\r\n const value = object[name];\r\n\r\n // If it contains '_' we split it so we keep only the key\r\n const resourceId2 = name.substring(resourceUpdateNotes.length);\r\n\r\n // Split to separate <KeyValue>_<type>\r\n // Possible types are title or description\r\n const splitText = resourceId2.split('_');\r\n\r\n const key = splitText[0];\r\n const type = splitText[1];\r\n if (!resources[locale].hasOwnProperty(key)) {\r\n resources[locale][key] = {};\r\n }\r\n resources[locale][key][type] = value;\r\n\r\n // Used to keep a mapping of keys to resources for faster\r\n // processing later\r\n if (!keyToResources.hasOwnProperty(key)) {\r\n keyToResources[key] = {};\r\n }\r\n\r\n if (keyToResources.hasOwnProperty(key) &&\r\n !keyToResources[key].hasOwnProperty(locale)) {\r\n keyToResources[key][locale] = {};\r\n }\r\n keyToResources[key][locale][type] = value;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return callback();\r\n },\r\n\r\n /**\r\n * Flush\r\n */\r\n function (callback) {\r\n try {\r\n const updateNotesObject = JSON.parse(fs.readFileSync(options.updateNotes, 'utf8'));\r\n\r\n const keys: string[] = [];\r\n findResourceKey(updateNotesObject, keys);\r\n const missingType: string[] = [];\r\n const missing: string[] = [];\r\n const unused: string[] = Object.keys(resources.default);\r\n\r\n keys.forEach(function (key) {\r\n const index = unused.indexOf(key);\r\n if (index >= 0) {\r\n // If the item exists, remove it from the unused set\r\n unused.splice(index, 1);\r\n\r\n // We have to check each item has a title and description\r\n const typeKeys = Object.keys(keyToResources[key].default);\r\n const requiredTypesSet = new Set();\r\n requiredTypesSet.add('title');\r\n requiredTypesSet.add('description');\r\n typeKeys.forEach(item => {\r\n if (requiredTypesSet.has(item)) {\r\n requiredTypesSet.delete(item);\r\n }\r\n });\r\n\r\n // If it did not have we save it throw error later\r\n if (requiredTypesSet.size > 0) {\r\n missingType.push(key);\r\n }\r\n } else {\r\n missing.push(key);\r\n }\r\n });\r\n\r\n if (missing.length > 0) {\r\n missing.forEach(item => {\r\n log.error('Missing resource: ' + item);\r\n });\r\n throw new Error('Missing resource found in manifest.json!');\r\n }\r\n\r\n if (unused.length > 0) {\r\n unused.forEach(item => {\r\n log.error('Unused resource: ' + item);\r\n });\r\n throw new Error('Unused resource found in strings.resjson!');\r\n }\r\n\r\n if (missingType.length > 0) {\r\n missingType.forEach(item => {\r\n log.error('Missing title or description: ' + item);\r\n });\r\n throw new Error('Key without title or description found in strings.resjson!');\r\n }\r\n\r\n updateNotesObject.map((item, index) => {\r\n if (item.hasOwnProperty('stringJsonKey')) {\r\n const key = item.stringJsonKey.replace('resources:strings:', '');\r\n // Key to resource maps key -> all locales\r\n item.resources = keyToResources[key];\r\n }\r\n updateNotesObject[index] = item;\r\n });\r\n\r\n const updateNotesFile = new Vinyl({\r\n cwd: '.',\r\n base: '.',\r\n path: './update-notes.json',\r\n contents: Buffer.from(JSON.stringify(updateNotesObject, null, 2), 'utf8')\r\n });\r\n\r\n this.push(updateNotesFile);\r\n } catch (e) {\r\n const error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ?\r\n util.extendError(new pluginError({ plugin: PLUGIN_NAME, message: e.message }), e) : e;\r\n log.error(error);\r\n }\r\n\r\n callback();\r\n });\r\n}\r\n\r\nmodule.exports = gulpUpdateNotesResources;\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../packages/tools/gulp-update-notes-resource/index.ts"],"names":[],"mappings":"","file":"index.d.ts","sourcesContent":["'use strict';\r\n\r\nimport { Buffer } from 'buffer';\r\nimport fs from 'fs';\r\nimport log from 'fancy-log';\r\nimport pluginError from 'plugin-error';\r\nimport through2 from 'through2';\r\nimport Vinyl from 'vinyl';\r\nimport * as util from '../utilities';\r\n\r\nconst PLUGIN_NAME = 'gulp-update-notes-resource';\r\n\r\ninterface Options {\r\n /**\r\n * resource name.\r\n */\r\n resourceName: string;\r\n\r\n /**\r\n * path of update notes file.\r\n */\r\n updateNotes: string;\r\n\r\n /**\r\n * depth of folder structure from the locale folder. (default is 1)\r\n */\r\n localeOffset: number;\r\n}\r\n\r\nfunction gulpUpdateNotesResources(options: Options) {\r\n function findResourceKey(node: any, results: string[]): void {\r\n const match = 'resources:strings:';\r\n const keys = Object.keys(node);\r\n if (keys && keys.length > 0) {\r\n keys.forEach(key => {\r\n const target = node[key];\r\n if (target) {\r\n if (typeof target === 'string') {\r\n if (target.indexOf(match) === 0) {\r\n const value = target.substring(match.length);\r\n if (results.indexOf(value) < 0) {\r\n results.push(value);\r\n }\r\n }\r\n } else {\r\n findResourceKey(target, results);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n // override options settings if not specified.\r\n options = <Options>Object.assign(\r\n {\r\n updateNotes: 'packages/shell/src/assets/updates/update-notes.json',\r\n localeOffset: 1\r\n },\r\n options || {});\r\n\r\n const resources: any = {};\r\n const keyToResources: any = {};\r\n\r\n return through2.obj(\r\n /**\r\n * Transform\r\n */\r\n function (file, encoding, callback) {\r\n let locale = 'default';\r\n if (resources.default) {\r\n // if default is set already, find current locale from the file path.\r\n const pathSegments = file.history[0].split('\\\\');\r\n locale = pathSegments[pathSegments.length - (2 + options.localeOffset)];\r\n }\r\n\r\n resources[locale] = {};\r\n if (resources.default) {\r\n // if default is set already, pre-fill all resource items from default.\r\n for (const resourceId in resources.default) {\r\n if (resources.default.hasOwnProperty(resourceId)) {\r\n resources[locale][resourceId] = resources.default[resourceId];\r\n }\r\n }\r\n }\r\n\r\n // remove comments, /* multiline comment */ and // one line comment and \"//\": \"JSON element comment\"\r\n const content = file.contents.toString('utf8')\r\n .replace(/(\\/\\*([^*]|[\\n]|(\\*+([^*/]|[\\n])))*\\*\\/+)|( +\\/\\/.*)|( +\\\"\\/\\/\\\".*)/g, '');\r\n const object = JSON.parse(content);\r\n if (object[options.resourceName] && object[options.resourceName]['App']['UpdateNotes']) {\r\n // supports <ResourceName>.Manifest.<KeyName> format.\r\n const items = object[options.resourceName]['App']['UpdateNotes'];\r\n for (const key in items) {\r\n if (items.hasOwnProperty(key)) {\r\n // Each key will have two children, title and description\r\n // no need to separate in JSON form\r\n resources[locale][key] = items[key];\r\n\r\n // Used to keep an alternate mapping we use later\r\n if (!keyToResources.hasOwnProperty(key)) {\r\n keyToResources[key] = {};\r\n }\r\n\r\n if (keyToResources.hasOwnProperty(key) &&\r\n !keyToResources[key].hasOwnProperty(locale)) {\r\n keyToResources[key][locale] = {};\r\n }\r\n keyToResources[key][locale] = items[key];\r\n }\r\n }\r\n } else {\r\n // supports <ResourceName>_App_UpdateNotes format.\r\n const resourceUpdateNotes = options.resourceName + '_App_UpdateNotes_';\r\n for (const name in object) {\r\n if (object.hasOwnProperty(name)) {\r\n const index = name.indexOf(resourceUpdateNotes);\r\n if (index === 0) {\r\n // Check if this resource has the specific substring or not\r\n const value = object[name];\r\n\r\n // If it contains '_' we split it so we keep only the key\r\n const resourceId2 = name.substring(resourceUpdateNotes.length);\r\n\r\n // Split to separate <KeyValue>_<type>\r\n // Possible types are title or description\r\n const splitText = resourceId2.split('_');\r\n\r\n const key = splitText[0];\r\n const type = splitText[1];\r\n if (!resources[locale].hasOwnProperty(key)) {\r\n resources[locale][key] = {};\r\n }\r\n resources[locale][key][type] = value;\r\n\r\n // Used to keep a mapping of keys to resources for faster\r\n // processing later\r\n if (!keyToResources.hasOwnProperty(key)) {\r\n keyToResources[key] = {};\r\n }\r\n\r\n if (keyToResources.hasOwnProperty(key) &&\r\n !keyToResources[key].hasOwnProperty(locale)) {\r\n keyToResources[key][locale] = {};\r\n }\r\n keyToResources[key][locale][type] = value;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return callback();\r\n },\r\n\r\n /**\r\n * Flush\r\n */\r\n function (callback) {\r\n try {\r\n const updateNotesObject = JSON.parse(fs.readFileSync(options.updateNotes, 'utf8'));\r\n\r\n const keys: string[] = [];\r\n findResourceKey(updateNotesObject, keys);\r\n const missingType: string[] = [];\r\n const missing: string[] = [];\r\n const unused: string[] = Object.keys(resources.default);\r\n\r\n keys.forEach(function (key) {\r\n const index = unused.indexOf(key);\r\n if (index >= 0) {\r\n // If the item exists, remove it from the unused set\r\n unused.splice(index, 1);\r\n\r\n // We have to check each item has a title and description\r\n const typeKeys = Object.keys(keyToResources[key].default);\r\n const requiredTypesSet = new Set();\r\n requiredTypesSet.add('title');\r\n requiredTypesSet.add('description');\r\n typeKeys.forEach(item => {\r\n if (requiredTypesSet.has(item)) {\r\n requiredTypesSet.delete(item);\r\n }\r\n });\r\n\r\n // If it did not have we save it throw error later\r\n if (requiredTypesSet.size > 0) {\r\n missingType.push(key);\r\n }\r\n } else {\r\n missing.push(key);\r\n }\r\n });\r\n\r\n if (missing.length > 0) {\r\n missing.forEach(item => {\r\n log.error('Missing resource (update-notes.json): ' + item);\r\n });\r\n throw new Error('Missing resource found in manifest.json!');\r\n }\r\n\r\n if (unused.length > 0) {\r\n // allow to use unused resources to share the same strings.json between GWv1 and GWv2.\r\n unused.forEach(item => {\r\n log.warn('Unused resource (update-notes.json): ' + item);\r\n });\r\n }\r\n\r\n if (missingType.length > 0) {\r\n missingType.forEach(item => {\r\n log.error('Missing title or description (update-notes.json): ' + item);\r\n });\r\n throw new Error('Key without title or description found in strings.resjson!');\r\n }\r\n\r\n updateNotesObject.map((item, index) => {\r\n if (item.hasOwnProperty('stringJsonKey')) {\r\n const key = item.stringJsonKey.replace('resources:strings:', '');\r\n // Key to resource maps key -> all locales\r\n item.resources = keyToResources[key];\r\n }\r\n updateNotesObject[index] = item;\r\n });\r\n\r\n const updateNotesFile = new Vinyl({\r\n cwd: '.',\r\n base: '.',\r\n path: './update-notes.json',\r\n contents: Buffer.from(JSON.stringify(updateNotesObject, null, 2), 'utf8')\r\n });\r\n\r\n this.push(updateNotesFile);\r\n } catch (e) {\r\n const error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ?\r\n util.extendError(new pluginError({ plugin: PLUGIN_NAME, message: e.message }), e) : e;\r\n log.error(error);\r\n }\r\n\r\n callback();\r\n });\r\n}\r\n\r\nmodule.exports = gulpUpdateNotesResources;\r\n"]}
|
|
@@ -156,19 +156,19 @@ function gulpUpdateNotesResources(options) {
|
|
|
156
156
|
});
|
|
157
157
|
if (missing.length > 0) {
|
|
158
158
|
missing.forEach(item => {
|
|
159
|
-
fancy_log_1.default.error('Missing resource: ' + item);
|
|
159
|
+
fancy_log_1.default.error('Missing resource (update-notes.json): ' + item);
|
|
160
160
|
});
|
|
161
161
|
throw new Error('Missing resource found in manifest.json!');
|
|
162
162
|
}
|
|
163
163
|
if (unused.length > 0) {
|
|
164
|
+
// allow to use unused resources to share the same strings.json between GWv1 and GWv2.
|
|
164
165
|
unused.forEach(item => {
|
|
165
|
-
fancy_log_1.default.
|
|
166
|
+
fancy_log_1.default.warn('Unused resource (update-notes.json): ' + item);
|
|
166
167
|
});
|
|
167
|
-
throw new Error('Unused resource found in strings.resjson!');
|
|
168
168
|
}
|
|
169
169
|
if (missingType.length > 0) {
|
|
170
170
|
missingType.forEach(item => {
|
|
171
|
-
fancy_log_1.default.error('Missing title or description: ' + item);
|
|
171
|
+
fancy_log_1.default.error('Missing title or description (update-notes.json): ' + item);
|
|
172
172
|
});
|
|
173
173
|
throw new Error('Key without title or description found in strings.resjson!');
|
|
174
174
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/tools/gulp-update-notes-resource/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,mCAAgC;AAChC,oDAAoB;AACpB,kEAA4B;AAC5B,wEAAuC;AACvC,gEAAgC;AAChC,0DAA0B;AAC1B,2DAAqC;AAErC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAmBjD,SAAS,wBAAwB,CAAC,OAAgB;IAC9C,SAAS,eAAe,CAAC,IAAS,EAAE,OAAiB;QACjD,MAAM,KAAK,GAAG,oBAAoB,CAAC;QACnC,MAAM,IAAI,GAAG,M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{ Buffer } from 'buffer';\r\nimport fs from 'fs';\r\nimport log from 'fancy-log';\r\nimport pluginError from 'plugin-error';\r\nimport through2 from 'through2';\r\nimport Vinyl from 'vinyl';\r\nimport * as util from '../utilities';\r\n\r\nconst PLUGIN_NAME = 'gulp-update-notes-resource';\r\n\r\ninterface Options {\r\n /**\r\n * resource name.\r\n */\r\n resourceName: string;\r\n\r\n /**\r\n * path of update notes file.\r\n */\r\n updateNotes: string;\r\n\r\n /**\r\n * depth of folder structure from the locale folder. (default is 1)\r\n */\r\n localeOffset: number;\r\n}\r\n\r\nfunction gulpUpdateNotesResources(options: Options) {\r\n function findResourceKey(node: any, results: string[]): void {\r\n const match = 'resources:strings:';\r\n const keys = Object.keys(node);\r\n if (keys && keys.length > 0) {\r\n keys.forEach(key => {\r\n const target = node[key];\r\n if (target) {\r\n if (typeof target === 'string') {\r\n if (target.indexOf(match) === 0) {\r\n const value = target.substring(match.length);\r\n if (results.indexOf(value) < 0) {\r\n results.push(value);\r\n }\r\n }\r\n } else {\r\n findResourceKey(target, results);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n // override options settings if not specified.\r\n options = <Options>Object.assign(\r\n {\r\n updateNotes: 'packages/shell/src/assets/updates/update-notes.json',\r\n localeOffset: 1\r\n },\r\n options || {});\r\n\r\n const resources: any = {};\r\n const keyToResources: any = {};\r\n\r\n return through2.obj(\r\n /**\r\n * Transform\r\n */\r\n function (file, encoding, callback) {\r\n let locale = 'default';\r\n if (resources.default) {\r\n // if default is set already, find current locale from the file path.\r\n const pathSegments = file.history[0].split('\\\\');\r\n locale = pathSegments[pathSegments.length - (2 + options.localeOffset)];\r\n }\r\n\r\n resources[locale] = {};\r\n if (resources.default) {\r\n // if default is set already, pre-fill all resource items from default.\r\n for (const resourceId in resources.default) {\r\n if (resources.default.hasOwnProperty(resourceId)) {\r\n resources[locale][resourceId] = resources.default[resourceId];\r\n }\r\n }\r\n }\r\n\r\n // remove comments, /* multiline comment */ and // one line comment and \"//\": \"JSON element comment\"\r\n const content = file.contents.toString('utf8')\r\n .replace(/(\\/\\*([^*]|[\\n]|(\\*+([^*/]|[\\n])))*\\*\\/+)|( +\\/\\/.*)|( +\\\"\\/\\/\\\".*)/g, '');\r\n const object = JSON.parse(content);\r\n if (object[options.resourceName] && object[options.resourceName]['App']['UpdateNotes']) {\r\n // supports <ResourceName>.Manifest.<KeyName> format.\r\n const items = object[options.resourceName]['App']['UpdateNotes'];\r\n for (const key in items) {\r\n if (items.hasOwnProperty(key)) {\r\n // Each key will have two children, title and description\r\n // no need to separate in JSON form\r\n resources[locale][key] = items[key];\r\n\r\n // Used to keep an alternate mapping we use later\r\n if (!keyToResources.hasOwnProperty(key)) {\r\n keyToResources[key] = {};\r\n }\r\n\r\n if (keyToResources.hasOwnProperty(key) &&\r\n !keyToResources[key].hasOwnProperty(locale)) {\r\n keyToResources[key][locale] = {};\r\n }\r\n keyToResources[key][locale] = items[key];\r\n }\r\n }\r\n } else {\r\n // supports <ResourceName>_App_UpdateNotes format.\r\n const resourceUpdateNotes = options.resourceName + '_App_UpdateNotes_';\r\n for (const name in object) {\r\n if (object.hasOwnProperty(name)) {\r\n const index = name.indexOf(resourceUpdateNotes);\r\n if (index === 0) {\r\n // Check if this resource has the specific substring or not\r\n const value = object[name];\r\n\r\n // If it contains '_' we split it so we keep only the key\r\n const resourceId2 = name.substring(resourceUpdateNotes.length);\r\n\r\n // Split to separate <KeyValue>_<type>\r\n // Possible types are title or description\r\n const splitText = resourceId2.split('_');\r\n\r\n const key = splitText[0];\r\n const type = splitText[1];\r\n if (!resources[locale].hasOwnProperty(key)) {\r\n resources[locale][key] = {};\r\n }\r\n resources[locale][key][type] = value;\r\n\r\n // Used to keep a mapping of keys to resources for faster\r\n // processing later\r\n if (!keyToResources.hasOwnProperty(key)) {\r\n keyToResources[key] = {};\r\n }\r\n\r\n if (keyToResources.hasOwnProperty(key) &&\r\n !keyToResources[key].hasOwnProperty(locale)) {\r\n keyToResources[key][locale] = {};\r\n }\r\n keyToResources[key][locale][type] = value;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return callback();\r\n },\r\n\r\n /**\r\n * Flush\r\n */\r\n function (callback) {\r\n try {\r\n const updateNotesObject = JSON.parse(fs.readFileSync(options.updateNotes, 'utf8'));\r\n\r\n const keys: string[] = [];\r\n findResourceKey(updateNotesObject, keys);\r\n const missingType: string[] = [];\r\n const missing: string[] = [];\r\n const unused: string[] = Object.keys(resources.default);\r\n\r\n keys.forEach(function (key) {\r\n const index = unused.indexOf(key);\r\n if (index >= 0) {\r\n // If the item exists, remove it from the unused set\r\n unused.splice(index, 1);\r\n\r\n // We have to check each item has a title and description\r\n const typeKeys = Object.keys(keyToResources[key].default);\r\n const requiredTypesSet = new Set();\r\n requiredTypesSet.add('title');\r\n requiredTypesSet.add('description');\r\n typeKeys.forEach(item => {\r\n if (requiredTypesSet.has(item)) {\r\n requiredTypesSet.delete(item);\r\n }\r\n });\r\n\r\n // If it did not have we save it throw error later\r\n if (requiredTypesSet.size > 0) {\r\n missingType.push(key);\r\n }\r\n } else {\r\n missing.push(key);\r\n }\r\n });\r\n\r\n if (missing.length > 0) {\r\n missing.forEach(item => {\r\n log.error('Missing resource: ' + item);\r\n });\r\n throw new Error('Missing resource found in manifest.json!');\r\n }\r\n\r\n if (unused.length > 0) {\r\n unused.forEach(item => {\r\n log.error('Unused resource: ' + item);\r\n });\r\n throw new Error('Unused resource found in strings.resjson!');\r\n }\r\n\r\n if (missingType.length > 0) {\r\n missingType.forEach(item => {\r\n log.error('Missing title or description: ' + item);\r\n });\r\n throw new Error('Key without title or description found in strings.resjson!');\r\n }\r\n\r\n updateNotesObject.map((item, index) => {\r\n if (item.hasOwnProperty('stringJsonKey')) {\r\n const key = item.stringJsonKey.replace('resources:strings:', '');\r\n // Key to resource maps key -> all locales\r\n item.resources = keyToResources[key];\r\n }\r\n updateNotesObject[index] = item;\r\n });\r\n\r\n const updateNotesFile = new Vinyl({\r\n cwd: '.',\r\n base: '.',\r\n path: './update-notes.json',\r\n contents: Buffer.from(JSON.stringify(updateNotesObject, null, 2), 'utf8')\r\n });\r\n\r\n this.push(updateNotesFile);\r\n } catch (e) {\r\n const error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ?\r\n util.extendError(new pluginError({ plugin: PLUGIN_NAME, message: e.message }), e) : e;\r\n log.error(error);\r\n }\r\n\r\n callback();\r\n });\r\n}\r\n\r\nmodule.exports = gulpUpdateNotesResources;\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../packages/tools/gulp-update-notes-resource/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,mCAAgC;AAChC,oDAAoB;AACpB,kEAA4B;AAC5B,wEAAuC;AACvC,gEAAgC;AAChC,0DAA0B;AAC1B,2DAAqC;AAErC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAmBjD,SAAS,wBAAwB,CAAC,OAAgB;IAC9C,SAAS,eAAe,CAAC,IAAS,EAAE,OAAiB;QACjD,MAAM,KAAK,GAAG,oBAAoB,CAAC;QACnC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACf,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;gBACzB,IAAI,MAAM,EAAE;oBACR,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;wBAC5B,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;4BAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;4BAC7C,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;gCAC5B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;6BACvB;yBACJ;qBACJ;yBAA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AAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;aAC5E,CAAC,CAAC;YAEH,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC9B;QAAC,OAAO,CAAC,EAAE;YACR,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;gBACrD,IAAI,CAAC,WAAW,CAAC,IAAI,sBAAW,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1F,mBAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACpB;QAED,QAAQ,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,wBAAwB,CAAC","file":"index.js","sourcesContent":["'use strict';\r\n\r\nimport { Buffer } from 'buffer';\r\nimport fs from 'fs';\r\nimport log from 'fancy-log';\r\nimport pluginError from 'plugin-error';\r\nimport through2 from 'through2';\r\nimport Vinyl from 'vinyl';\r\nimport * as util from '../utilities';\r\n\r\nconst PLUGIN_NAME = 'gulp-update-notes-resource';\r\n\r\ninterface Options {\r\n /**\r\n * resource name.\r\n */\r\n resourceName: string;\r\n\r\n /**\r\n * path of update notes file.\r\n */\r\n updateNotes: string;\r\n\r\n /**\r\n * depth of folder structure from the locale folder. (default is 1)\r\n */\r\n localeOffset: number;\r\n}\r\n\r\nfunction gulpUpdateNotesResources(options: Options) {\r\n function findResourceKey(node: any, results: string[]): void {\r\n const match = 'resources:strings:';\r\n const keys = Object.keys(node);\r\n if (keys && keys.length > 0) {\r\n keys.forEach(key => {\r\n const target = node[key];\r\n if (target) {\r\n if (typeof target === 'string') {\r\n if (target.indexOf(match) === 0) {\r\n const value = target.substring(match.length);\r\n if (results.indexOf(value) < 0) {\r\n results.push(value);\r\n }\r\n }\r\n } else {\r\n findResourceKey(target, results);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n // override options settings if not specified.\r\n options = <Options>Object.assign(\r\n {\r\n updateNotes: 'packages/shell/src/assets/updates/update-notes.json',\r\n localeOffset: 1\r\n },\r\n options || {});\r\n\r\n const resources: any = {};\r\n const keyToResources: any = {};\r\n\r\n return through2.obj(\r\n /**\r\n * Transform\r\n */\r\n function (file, encoding, callback) {\r\n let locale = 'default';\r\n if (resources.default) {\r\n // if default is set already, find current locale from the file path.\r\n const pathSegments = file.history[0].split('\\\\');\r\n locale = pathSegments[pathSegments.length - (2 + options.localeOffset)];\r\n }\r\n\r\n resources[locale] = {};\r\n if (resources.default) {\r\n // if default is set already, pre-fill all resource items from default.\r\n for (const resourceId in resources.default) {\r\n if (resources.default.hasOwnProperty(resourceId)) {\r\n resources[locale][resourceId] = resources.default[resourceId];\r\n }\r\n }\r\n }\r\n\r\n // remove comments, /* multiline comment */ and // one line comment and \"//\": \"JSON element comment\"\r\n const content = file.contents.toString('utf8')\r\n .replace(/(\\/\\*([^*]|[\\n]|(\\*+([^*/]|[\\n])))*\\*\\/+)|( +\\/\\/.*)|( +\\\"\\/\\/\\\".*)/g, '');\r\n const object = JSON.parse(content);\r\n if (object[options.resourceName] && object[options.resourceName]['App']['UpdateNotes']) {\r\n // supports <ResourceName>.Manifest.<KeyName> format.\r\n const items = object[options.resourceName]['App']['UpdateNotes'];\r\n for (const key in items) {\r\n if (items.hasOwnProperty(key)) {\r\n // Each key will have two children, title and description\r\n // no need to separate in JSON form\r\n resources[locale][key] = items[key];\r\n\r\n // Used to keep an alternate mapping we use later\r\n if (!keyToResources.hasOwnProperty(key)) {\r\n keyToResources[key] = {};\r\n }\r\n\r\n if (keyToResources.hasOwnProperty(key) &&\r\n !keyToResources[key].hasOwnProperty(locale)) {\r\n keyToResources[key][locale] = {};\r\n }\r\n keyToResources[key][locale] = items[key];\r\n }\r\n }\r\n } else {\r\n // supports <ResourceName>_App_UpdateNotes format.\r\n const resourceUpdateNotes = options.resourceName + '_App_UpdateNotes_';\r\n for (const name in object) {\r\n if (object.hasOwnProperty(name)) {\r\n const index = name.indexOf(resourceUpdateNotes);\r\n if (index === 0) {\r\n // Check if this resource has the specific substring or not\r\n const value = object[name];\r\n\r\n // If it contains '_' we split it so we keep only the key\r\n const resourceId2 = name.substring(resourceUpdateNotes.length);\r\n\r\n // Split to separate <KeyValue>_<type>\r\n // Possible types are title or description\r\n const splitText = resourceId2.split('_');\r\n\r\n const key = splitText[0];\r\n const type = splitText[1];\r\n if (!resources[locale].hasOwnProperty(key)) {\r\n resources[locale][key] = {};\r\n }\r\n resources[locale][key][type] = value;\r\n\r\n // Used to keep a mapping of keys to resources for faster\r\n // processing later\r\n if (!keyToResources.hasOwnProperty(key)) {\r\n keyToResources[key] = {};\r\n }\r\n\r\n if (keyToResources.hasOwnProperty(key) &&\r\n !keyToResources[key].hasOwnProperty(locale)) {\r\n keyToResources[key][locale] = {};\r\n }\r\n keyToResources[key][locale][type] = value;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return callback();\r\n },\r\n\r\n /**\r\n * Flush\r\n */\r\n function (callback) {\r\n try {\r\n const updateNotesObject = JSON.parse(fs.readFileSync(options.updateNotes, 'utf8'));\r\n\r\n const keys: string[] = [];\r\n findResourceKey(updateNotesObject, keys);\r\n const missingType: string[] = [];\r\n const missing: string[] = [];\r\n const unused: string[] = Object.keys(resources.default);\r\n\r\n keys.forEach(function (key) {\r\n const index = unused.indexOf(key);\r\n if (index >= 0) {\r\n // If the item exists, remove it from the unused set\r\n unused.splice(index, 1);\r\n\r\n // We have to check each item has a title and description\r\n const typeKeys = Object.keys(keyToResources[key].default);\r\n const requiredTypesSet = new Set();\r\n requiredTypesSet.add('title');\r\n requiredTypesSet.add('description');\r\n typeKeys.forEach(item => {\r\n if (requiredTypesSet.has(item)) {\r\n requiredTypesSet.delete(item);\r\n }\r\n });\r\n\r\n // If it did not have we save it throw error later\r\n if (requiredTypesSet.size > 0) {\r\n missingType.push(key);\r\n }\r\n } else {\r\n missing.push(key);\r\n }\r\n });\r\n\r\n if (missing.length > 0) {\r\n missing.forEach(item => {\r\n log.error('Missing resource (update-notes.json): ' + item);\r\n });\r\n throw new Error('Missing resource found in manifest.json!');\r\n }\r\n\r\n if (unused.length > 0) {\r\n // allow to use unused resources to share the same strings.json between GWv1 and GWv2.\r\n unused.forEach(item => {\r\n log.warn('Unused resource (update-notes.json): ' + item);\r\n });\r\n }\r\n\r\n if (missingType.length > 0) {\r\n missingType.forEach(item => {\r\n log.error('Missing title or description (update-notes.json): ' + item);\r\n });\r\n throw new Error('Key without title or description found in strings.resjson!');\r\n }\r\n\r\n updateNotesObject.map((item, index) => {\r\n if (item.hasOwnProperty('stringJsonKey')) {\r\n const key = item.stringJsonKey.replace('resources:strings:', '');\r\n // Key to resource maps key -> all locales\r\n item.resources = keyToResources[key];\r\n }\r\n updateNotesObject[index] = item;\r\n });\r\n\r\n const updateNotesFile = new Vinyl({\r\n cwd: '.',\r\n base: '.',\r\n path: './update-notes.json',\r\n contents: Buffer.from(JSON.stringify(updateNotesObject, null, 2), 'utf8')\r\n });\r\n\r\n this.push(updateNotesFile);\r\n } catch (e) {\r\n const error = (!e.plugin || (e.plugin !== PLUGIN_NAME)) ?\r\n util.extendError(new pluginError({ plugin: PLUGIN_NAME, message: e.message }), e) : e;\r\n log.error(error);\r\n }\r\n\r\n callback();\r\n });\r\n}\r\n\r\nmodule.exports = gulpUpdateNotesResources;\r\n"]}
|
|
@@ -22,6 +22,7 @@ export module Utilities {
|
|
|
22
22
|
angular: toBoolean(values['angular']),
|
|
23
23
|
app: toBoolean(values['app']),
|
|
24
24
|
devGuide: toBoolean(values['devguide']),
|
|
25
|
+
fix: toBoolean(values['fix']),
|
|
25
26
|
version: values['V'] as string,
|
|
26
27
|
icon: values['icon'] as string,
|
|
27
28
|
license: values['license'] as string,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../packages/tools/wac-cli/src/angular15/configs/eslint-auto-fix-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;GAOhB,CAAC","file":"eslint-auto-fix-config.d.ts","sourcesContent":["/**\r\n * The configuration file for the eslintrc.json file to support lint --fix command.\r\n */\r\nexport const adds = [\r\n {\r\n toBeAdded: '\"ignorePatterns\": [\"!*.spec.ts\"]',\r\n toBeAddedAfter: '\"extends\": \"./node_modules/@microsoft/windows-admin-center-sdk/tools/code-formatter/.eslintrc.base.json\"',\r\n indent: 2,\r\n keyword: '\"ignorePatterns\": [\"!*.spec.ts\"]'\r\n }\r\n];\r\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.adds = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The configuration file for the eslintrc.json file to support lint --fix command.
|
|
6
|
+
*/
|
|
7
|
+
exports.adds = [
|
|
8
|
+
{
|
|
9
|
+
toBeAdded: '"ignorePatterns": ["!*.spec.ts"]',
|
|
10
|
+
toBeAddedAfter: '"extends": "./node_modules/@microsoft/windows-admin-center-sdk/tools/code-formatter/.eslintrc.base.json"',
|
|
11
|
+
indent: 2,
|
|
12
|
+
keyword: '"ignorePatterns": ["!*.spec.ts"]'
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=eslint-auto-fix-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../packages/tools/wac-cli/src/angular15/configs/eslint-auto-fix-config.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,IAAI,GAAG;IAChB;QACI,SAAS,EAAE,kCAAkC;QAC7C,cAAc,EAAE,gFAAgF;QAChG,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,kCAAkC;KAC9C;CACJ,CAAC","file":"eslint-auto-fix-config.js","sourcesContent":["/**\r\n * The configuration file for the eslintrc.json file to support lint --fix command.\r\n */\r\nexport const adds = [\r\n {\r\n toBeAdded: '\"ignorePatterns\": [\"!*.spec.ts\"]',\r\n toBeAddedAfter: '\"extends\": \"./node_modules/@microsoft/windows-admin-center-sdk/tools/code-formatter/.eslintrc.base.json\"',\r\n indent: 2,\r\n keyword: '\"ignorePatterns\": [\"!*.spec.ts\"]'\r\n }\r\n];\r\n"]}
|
|
@@ -15,8 +15,13 @@ export declare enum Angular15UpgraderMessages {
|
|
|
15
15
|
UpdateBasicPaths = "Updating basic paths for the upgrade...",
|
|
16
16
|
Initialization = "Initializing upgraders...",
|
|
17
17
|
FinalizeInfoLintFix = "There are eslint violations that needs fix... After fixing the violations, please run the following commands:\n\n npx eslint . --fix \n\n gulp lintApp \n\n gulp build \n\n ",
|
|
18
|
-
|
|
19
|
-
Completed = "Upgrade completed!"
|
|
18
|
+
InternalCommandOnly = "This command is only available for internal extension.",
|
|
19
|
+
Completed = "Upgrade completed!",
|
|
20
|
+
StartMessageStage0 = "Starting stage 0: the default Angular 15 upgrade stage",
|
|
21
|
+
StartMessageStage1 = "Starting stage 1: the Angular core stage",
|
|
22
|
+
StartMessageStage2 = "Starting stage 2: the Angular 15 unit test stage",
|
|
23
|
+
StartMessageStage3 = "Starting stage 3: the legacy ui-test-automation stage",
|
|
24
|
+
StartMessageStage4 = "Starting stage 4: the eslint to support gulp lintApp --fix command stage"
|
|
20
25
|
}
|
|
21
26
|
/**
|
|
22
27
|
* This is the main class of the EslintUpgrader tool.
|
|
@@ -68,6 +73,7 @@ export declare class Angular15Upgrader {
|
|
|
68
73
|
private uiTestAutomationLegacyFilePath;
|
|
69
74
|
private uiTestAutomationLegacyFolderPath;
|
|
70
75
|
private logFilePath;
|
|
76
|
+
private eslintrcFilePath;
|
|
71
77
|
/**
|
|
72
78
|
* The upgrader for each configuration file.
|
|
73
79
|
*/
|
|
@@ -87,6 +93,10 @@ export declare class Angular15Upgrader {
|
|
|
87
93
|
private logParser;
|
|
88
94
|
private jasmineTestUpgrader;
|
|
89
95
|
private uITestAutomationLegacyUpgrader;
|
|
96
|
+
/**
|
|
97
|
+
* The eslint fix upgrader to support linter fix command for stage 4.
|
|
98
|
+
*/
|
|
99
|
+
private eslintAutoFixUpgrader;
|
|
90
100
|
/**
|
|
91
101
|
* The file names for each configuration file.
|
|
92
102
|
*/
|
|
@@ -107,6 +117,7 @@ export declare class Angular15Upgrader {
|
|
|
107
117
|
private readonly gulpCompileTsFileName;
|
|
108
118
|
private readonly gulpIndexTsFileName;
|
|
109
119
|
private readonly logFileName;
|
|
120
|
+
private readonly eslintrcFileName;
|
|
110
121
|
constructor();
|
|
111
122
|
/**
|
|
112
123
|
* The upgrader main function.
|
|
@@ -115,13 +126,18 @@ export declare class Angular15Upgrader {
|
|
|
115
126
|
* @param pipeline It determines whether to run this command on the pipeline.
|
|
116
127
|
* @param debug It determines whether to run the debug mode.
|
|
117
128
|
* @param internal It determines whether to run angualr 15 upgrade for the internal extension or external sdk.
|
|
118
|
-
* @param stage '0' - the default Angular 15
|
|
129
|
+
* @param stage '0' - the default Angular 15 upgrade stage,
|
|
130
|
+
* '1' - the Angular core stage,
|
|
131
|
+
* '2' - the Angular 15 unit test stage,
|
|
132
|
+
* '3' - the legacy ui-test-automation stage.
|
|
133
|
+
* '4' - the eslint to support gulp lintApp --fix command.
|
|
119
134
|
*/
|
|
120
135
|
upgrade(pipeline?: boolean, stage?: number, internal?: boolean, debug?: boolean): Promise<void>;
|
|
121
136
|
protected criticalConfigurationFilesUpdates(): Promise<void>;
|
|
122
137
|
protected initialization(): void;
|
|
123
138
|
protected updateBasicPaths(): void;
|
|
124
139
|
protected gulpBuildPostAudit(): Promise<void>;
|
|
140
|
+
protected gulpLintFix(): Promise<void>;
|
|
125
141
|
protected gulpQuick(): Promise<void>;
|
|
126
142
|
protected gulpBuildProd(): Promise<void>;
|
|
127
143
|
protected gulpBuildProdPostAudit(): Promise<void>;
|
|
@@ -1 +1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AAkB,CAAkB;IACrD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAsB;IAC7D,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAA4B;IACvE,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAwB;IAChE,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAgB;IACtD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAc;IAClD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;;IAQzC;;;;;;;;OAQG;IACU,OAAO,CAAC,QAAQ,UAAQ,EAAE,KAAK,SAAI,EAAE,QAAQ,UAAQ,EAAE,KAAK,UAAQ;cA0EjE,iCAAiC,IAAI,OAAO,CAAC,IAAI,CAAC;IA6BlE,SAAS,CAAC,cAAc;IAoBxB,SAAS,CAAC,gBAAgB,IAAI,IAAI;cAoClB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAInD,SAAS,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAQpC,SAAS,CAAC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;cAQxB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;cAIvC,6BAA6B,IAAI,OAAO,CAAC,IAAI,CAAC;cAS9C,8BAA8B,IAAI,OAAO,CAAC,IAAI,CAAC;YAQjD,iBAAiB;YAKjB,sBAAsB;YAOtB,yBAAyB;YAOzB,sBAAsB;YAOtB,eAAe;YAOf,mBAAmB;YAWnB,sCAAsC;YAKtC,eAAe;IAa7B;;;;;OAKG;YACW,4BAA4B;CAK7C","file":"main.d.ts","sourcesContent":["import { Common } from '../common';\r\nimport { PackageJsonUpgrader } from './upgrader/package-json-upgrader';\r\nimport { TSConfigUpgrader } from './upgrader/tsconfig-upgrader';\r\nimport { Logger } from './utils/logger';\r\nimport { GitIgnoreUpgrader } from './upgrader/git-ignore-upgrader';\r\nimport { AngularJsonUpgrader } from './upgrader/angular-json-upgrader';\r\nimport { FileReplacementUpgrader } from './upgrader/file-replacement-upgrader';\r\nimport { CIBuildYmlUpgrader } from './upgrader/ci-build-yml-upgrader';\r\nimport { ReplaceUpgrader } from './upgrader/replace-upgrader';\r\nimport { srcTsConfigLibProdReplaces, srcTsConfigSpecRemoves } from './configs/config';\r\nimport { RemoveUpgrader } from './upgrader/remove-upgrader';\r\nimport { MainDebugger } from './utils/main-debugger';\r\nimport { runCommand } from './utils/command-runner';\r\nimport { LogParser } from './upgrader/audit/log-parser';\r\nimport { VersionJsonUpgrader } from './upgrader/version-json-upgrader';\r\nimport { JasmineTestUpgrader } from './upgrader/jasmine-test-upgrader';\r\nimport { updateShellReferences } from './utils/update-shell-references';\r\nimport { EslintUpgrader } from '../eslint/main';\r\nimport { UITestAutomationLegacyUpgrader } from './upgrader/ui-test-automation-legacy-upgrader';\r\n\r\n/**\r\n * Represents the type of upgrade that needs to be performed.\r\n */\r\nexport enum UpgradeType {\r\n WithBaseConfig = 'WithBaseConfig',\r\n WithoutBaseConfig = 'WithoutBaseConfig',\r\n NoOperation = 'NoOperation'\r\n}\r\n\r\n/**\r\n * Represents the messages that are displayed during the upgrade process.\r\n */\r\nexport enum Angular15UpgraderMessages {\r\n StartingUpgrade = 'Starting Angular 15 upgrade process...',\r\n UpdateBasicPaths = 'Updating basic paths for the upgrade...',\r\n Initialization = 'Initializing upgraders...',\r\n FinalizeInfoLintFix = `There are eslint violations that needs fix... After fixing the violations, please run the following commands:\\n\r\n npx eslint . --fix \\n\r\n gulp lintApp \\n\r\n gulp build \\n\r\n `,\r\n CannotRunStageThreeExternal = 'The ui-test-automation_legacy is for internal extension upgrade only.',\r\n Completed = 'Upgrade completed!'\r\n}\r\n\r\n/**\r\n * This is the main class of the EslintUpgrader tool.\r\n * It is responsible for upgrading the Tslint to Eslint.\r\n */\r\nexport class Angular15Upgrader {\r\n /**\r\n * The debug mode.\r\n */\r\n protected debug = false;\r\n\r\n /**\r\n * It determines whether to run angualr 15 upgrade for the internal extension or external sdk.\r\n */\r\n protected internal = false;\r\n\r\n /**\r\n * If running in the pipeline, the pipeline needs to automatically update for the @msft-sme pacakges instead of WAC CLI.\r\n */\r\n protected pipeline = false;\r\n\r\n /**\r\n * The main debugger.\r\n */\r\n protected mainDebugger: MainDebugger;\r\n\r\n /**\r\n * The main debugger version.\r\n */\r\n private readonly version = '1.0.1';\r\n\r\n /**\r\n * The paths of the configuration files.\r\n */\r\n private tsconfigBaseFilePath: string;\r\n private tsconfigFilePath: string;\r\n private angularJsonFilePath: string;\r\n private gitIgnoreFilePath: string;\r\n private packageJsonFilePath: string;\r\n private versionJsonFilePath: string;\r\n private packageLockJsonFilePath: string;\r\n private nodeModulesFolderPath: string;\r\n private e2eFolderPath: string;\r\n private testTsFilePath: string;\r\n private testTsFileTemplatePath: string;\r\n private cIBuildYmlFilePath: string;\r\n private pullRequestYmlFilePath: string;\r\n private srcTsConfigSpecFilePath: string;\r\n private srcTsConfigLibProdFilePath: string;\r\n private gulpCompileTsFilePath: string;\r\n private gulpCompileTsTemplatePath: string;\r\n private gulpIndexTsFilePath: string;\r\n private gulpIndexTsTemplatePath: string;\r\n private uiTestAutomationLegacyFilePath: string;\r\n private uiTestAutomationLegacyFolderPath: string;\r\n private logFilePath: string;\r\n\r\n /**\r\n * The upgrader for each configuration file.\r\n */\r\n private packageJsonUpgrader: PackageJsonUpgrader;\r\n private versionJsonUpgrader: VersionJsonUpgrader;\r\n private tSConfigUpgrader: TSConfigUpgrader;\r\n private tSConfigBaseUpgrader: TSConfigUpgrader;\r\n private gitIgnoreUpgrader: GitIgnoreUpgrader;\r\n private angularJsonUpgrader: AngularJsonUpgrader;\r\n private testTsUpgrader: FileReplacementUpgrader;\r\n private cIBuildUpgrader: CIBuildYmlUpgrader;\r\n private pullRequestUpgrader: CIBuildYmlUpgrader;\r\n private srcTsConfigLibProdUpgrader: ReplaceUpgrader;\r\n private srcTsConfigSpecUpgrader: RemoveUpgrader;\r\n private gulpCompileTsUpgrader: FileReplacementUpgrader;\r\n private gulpIndexTsUpgrader: FileReplacementUpgrader;\r\n private logParser: LogParser;\r\n private jasmineTestUpgrader: JasmineTestUpgrader;\r\n private uITestAutomationLegacyUpgrader: UITestAutomationLegacyUpgrader;\r\n\r\n /**\r\n * The file names for each configuration file.\r\n */\r\n private readonly tsconfigBaseFileName = 'tsconfig.base.json';\r\n private readonly tsconfigFileName = 'tsconfig.json';\r\n private readonly packageJsonFileName = 'package.json';\r\n private readonly versionJsonFileName = 'version.json';\r\n private readonly packageLockJsonFileName = 'package-lock.json';\r\n private readonly angularFileName = 'angular.json';\r\n private readonly e2eFolderName = 'e2e';\r\n private readonly nodeModulesFolderName = 'node_modules';\r\n private readonly gitIgnoreFileName = '.gitignore';\r\n private readonly testTsFileName = 'test.ts';\r\n private readonly cIBuildYmlFileName = 'ci-build.yml';\r\n private readonly pullRequestYmlFileName = 'pull-request.yml';\r\n private readonly srcTsConfigLibProdFileName = 'tsconfig.lib.prod.json';\r\n private readonly srcTsConfigSpecFileName = 'tsconfig.spec.json';\r\n private readonly gulpCompileTsFileName = 'compile.ts';\r\n private readonly gulpIndexTsFileName = 'index.ts';\r\n private readonly logFileName = 'log.txt';\r\n\r\n constructor() {\r\n Logger.log(Angular15UpgraderMessages.StartingUpgrade);\r\n Common.rootPath = process.cwd();\r\n Logger.log(Common.rootPath);\r\n }\r\n\r\n /**\r\n * The upgrader main function.\r\n * If only runs the unit test\r\n * node ./node_modules/@microsoft/windows-admin-center-sdk/tools/wac-cli/src/index.js angular15Upgrade --pipeline false --stage 2\r\n * @param pipeline It determines whether to run this command on the pipeline.\r\n * @param debug It determines whether to run the debug mode.\r\n * @param internal It determines whether to run angualr 15 upgrade for the internal extension or external sdk.\r\n * @param stage '0' - the default Angular 15 stage, '1' - the Angular core stage, '2' - the Angular 15 unit test stage, '3' - the legacy ui-test-automation stage.\r\n */\r\n public async upgrade(pipeline = false, stage = 0, internal = false, debug = false) {\r\n this.debug = !!debug;\r\n this.pipeline = !!pipeline;\r\n this.internal = !!internal;\r\n Logger.log(this.version);\r\n Logger.log(Angular15UpgraderMessages.StartingUpgrade);\r\n Logger.log('Passed in parameters: ' + this.pipeline + ' ' + stage + ' ' + this.internal + ' ' + this.debug );\r\n\r\n this.mainDebugger = this.debug ? new MainDebugger(): undefined;\r\n\r\n Logger.log(Angular15UpgraderMessages.UpdateBasicPaths);\r\n this.updateBasicPaths();\r\n\r\n Logger.log(Angular15UpgraderMessages.Initialization);\r\n this.initialization();\r\n\r\n switch (stage) {\r\n case 0:\r\n Logger.log('0');\r\n await this.criticalConfigurationFilesUpdates();\r\n await this.installDependenciesPreparation();\r\n await this.installLKGElectronToChromium();\r\n await this.installDependencies();\r\n // Fix any eslint errors that doesn't match the latest eslint rules.\r\n await this.fixEslintErrors(this.pipeline);\r\n await this.gulpQuick();\r\n await this.gulpBuildPostAudit();\r\n // Fix any eslint errors that is triggered by audit.\r\n await this.fixEslintErrors(this.pipeline);\r\n await this.gulpBuildProd();\r\n await this.gulpBuildProdPostAudit();\r\n // Fix any eslint errors clean-ups.\r\n await this.fixEslintErrors(this.pipeline);\r\n await this.jasmineTestUpgrader.run();\r\n break;\r\n case 1:\r\n Logger.log('1');\r\n await this.criticalConfigurationFilesUpdates();\r\n await this.installDependenciesPreparation();\r\n await this.installLKGElectronToChromium();\r\n await this.installDependencies();\r\n // Fix any eslint errors that doesn't match the latest eslint rules.\r\n await this.fixEslintErrors(this.pipeline);\r\n await this.gulpQuick();\r\n await this.gulpBuildPostAudit();\r\n // Fix any eslint errors that is triggered by audit.\r\n await this.fixEslintErrors(this.pipeline);\r\n await this.gulpBuildProd();\r\n await this.gulpBuildProdPostAudit();\r\n // Fix any eslint errors clean-ups.\r\n await this.fixEslintErrors(this.pipeline);\r\n break;\r\n case 2:\r\n Logger.log('2');\r\n await this.gulpIndexTsUpgrader.run();\r\n await this.testTsUpgrader.run();\r\n await this.jasmineTestUpgrader.run();\r\n break;\r\n case 3:\r\n Logger.log('3');\r\n if (!this.internal) {\r\n Logger.log(Angular15UpgraderMessages.CannotRunStageThreeExternal);\r\n } else {\r\n await this.packageJsonUpgrader.run(this.pipeline),\r\n await this.installUTALegacyDevDependency();\r\n await this.uITestAutomationLegacyUpgrader.run();\r\n await this.installDependenciesForUITestAutomation();\r\n }\r\n default:\r\n Logger.log('default');\r\n break;\r\n }\r\n }\r\n\r\n protected async criticalConfigurationFilesUpdates(): Promise<void> {\r\n Promise.all([\r\n this.packageJsonUpgrader.run(this.pipeline),\r\n this.versionJsonUpgrader.run(),\r\n this.tSConfigBaseUpgrader.runBase(),\r\n this.tSConfigUpgrader.run(),\r\n this.gitIgnoreUpgrader.run(),\r\n this.angularJsonUpgrader.run(),\r\n this.testTsUpgrader.run(),\r\n this.cIBuildUpgrader.run(),\r\n this.pullRequestUpgrader.run(),\r\n this.srcTsConfigLibProdUpgrader.run(),\r\n this.srcTsConfigSpecUpgrader.run(),\r\n this.gulpCompileTsUpgrader.run(),\r\n this.gulpIndexTsUpgrader.run()\r\n ]).then((results) => {\r\n console.log('All Promises have completed:', results);\r\n\r\n if (this.debug) {\r\n this.mainDebugger.verifyTestData(this).then(() => {\r\n Logger.log(Angular15UpgraderMessages.Completed);\r\n });\r\n }\r\n })\r\n .catch((error) => {\r\n Logger.error('At least one Promise encountered an error:' + error);\r\n });\r\n }\r\n\r\n protected initialization() {\r\n this.packageJsonUpgrader = new PackageJsonUpgrader(this.packageJsonFilePath);\r\n this.versionJsonUpgrader = new VersionJsonUpgrader(this.versionJsonFilePath);\r\n this.tSConfigBaseUpgrader = new TSConfigUpgrader(this.tsconfigBaseFilePath, this.tsconfigBaseFileName);\r\n this.tSConfigUpgrader = new TSConfigUpgrader(this.tsconfigFilePath, this.tsconfigFileName);\r\n this.gitIgnoreUpgrader = new GitIgnoreUpgrader(this.gitIgnoreFilePath);\r\n this.angularJsonUpgrader = new AngularJsonUpgrader(this.angularJsonFilePath);\r\n this.testTsUpgrader = new FileReplacementUpgrader(this.testTsFileTemplatePath, this.testTsFilePath);\r\n this.cIBuildUpgrader = new CIBuildYmlUpgrader(this.cIBuildYmlFilePath, this.cIBuildYmlFileName);\r\n this.pullRequestUpgrader = new CIBuildYmlUpgrader(this.pullRequestYmlFilePath, this.pullRequestYmlFileName);\r\n this.srcTsConfigLibProdUpgrader = new ReplaceUpgrader(this.srcTsConfigLibProdFilePath, srcTsConfigLibProdReplaces, this.srcTsConfigLibProdFileName);\r\n this.srcTsConfigSpecUpgrader = new RemoveUpgrader(this.srcTsConfigSpecFilePath, srcTsConfigSpecRemoves, this.srcTsConfigSpecFileName);\r\n this.gulpCompileTsUpgrader = new FileReplacementUpgrader(this.gulpCompileTsTemplatePath, this.gulpCompileTsFilePath);\r\n this.gulpIndexTsUpgrader = new FileReplacementUpgrader(this.gulpIndexTsTemplatePath, this.gulpIndexTsFilePath);\r\n this.jasmineTestUpgrader = new JasmineTestUpgrader(this.testTsFilePath, this.debug);\r\n this.uITestAutomationLegacyUpgrader = new UITestAutomationLegacyUpgrader(this.uiTestAutomationLegacyFilePath, this.packageJsonFileName);\r\n\r\n this.logParser = new LogParser(this.logFilePath, this.logFileName);\r\n }\r\n\r\n protected updateBasicPaths(): void {\r\n this.tsconfigBaseFilePath = Common.rootPath + '\\\\' + this.tsconfigBaseFileName;\r\n this.tsconfigFilePath = Common.rootPath + '\\\\' + this.tsconfigFileName;\r\n this.angularJsonFilePath = Common.rootPath + '\\\\' + this.angularFileName;\r\n this.packageJsonFilePath = Common.rootPath + '\\\\' + this.packageJsonFileName;\r\n this.versionJsonFilePath = Common.rootPath + '\\\\' + this.versionJsonFileName;\r\n this.packageLockJsonFilePath = Common.rootPath + '\\\\' + this.packageLockJsonFileName;\r\n this.nodeModulesFolderPath = Common.rootPath + '\\\\' + this.nodeModulesFolderName;\r\n this.e2eFolderPath = Common.rootPath + '\\\\' + this.e2eFolderName;\r\n this.gitIgnoreFilePath = Common.rootPath + '\\\\' + this.gitIgnoreFileName;\r\n\r\n this.srcTsConfigLibProdFilePath = Common.rootPath + '\\\\src\\\\' + this.srcTsConfigLibProdFileName;\r\n this.srcTsConfigSpecFilePath = Common.rootPath + '\\\\src\\\\' + this.srcTsConfigSpecFileName;\r\n\r\n this.cIBuildYmlFilePath = Common.rootPath + '\\\\build\\\\pipelines\\\\' + this.cIBuildYmlFileName;\r\n this.pullRequestYmlFilePath = Common.rootPath + '\\\\build\\\\pipelines\\\\' + this.pullRequestYmlFileName;\r\n\r\n this.testTsFilePath = Common.rootPath + '\\\\src\\\\' + this.testTsFileName;\r\n this.testTsFileTemplatePath = Common.cliRootPath.replace('wac-cli', 'module-template\\\\angular15\\\\test.ts');\r\n\r\n this.gulpCompileTsFilePath = Common.rootPath + '\\\\gulpfile.ts\\\\common\\\\' + this.gulpCompileTsFileName;\r\n this.gulpCompileTsTemplatePath = Common.cliRootPath.replace('wac-cli', 'module-template\\\\angular15\\\\gulpfile.ts\\\\common\\\\compile.ts');\r\n\r\n this.gulpIndexTsFilePath = Common.rootPath + '\\\\gulpfile.ts\\\\' + this.gulpIndexTsFileName;\r\n this.gulpIndexTsTemplatePath = Common.cliRootPath.replace('wac-cli', 'module-template\\\\angular15\\\\gulpfile.ts\\\\index.ts');\r\n\r\n this.uiTestAutomationLegacyFilePath = Common.rootPath + '\\\\ui-test-automation\\\\' + this.packageJsonFileName;\r\n this.uiTestAutomationLegacyFolderPath = Common.rootPath + '\\\\ui-test-automation\\\\';\r\n\r\n this.logFilePath = Common.rootPath + '\\\\' + this.logFileName;\r\n\r\n if (this.debug) {\r\n this.mainDebugger.updateTestData(this);\r\n }\r\n }\r\n\r\n protected async gulpBuildPostAudit(): Promise<void> {\r\n return this.logParser.run();\r\n }\r\n\r\n protected gulpQuick(): Promise<void> {\r\n const gulpQuick = 'gulp quick';\r\n Logger.log(gulpQuick);\r\n return runCommand(gulpQuick, this.debug, true, Angular15UpgraderMessages.Completed, this.logFileName).then((response) => {\r\n console.log(response);\r\n });\r\n }\r\n\r\n protected gulpBuildProd(): Promise<void> {\r\n const gulpBuild = 'gulp build --prod';\r\n Logger.log(gulpBuild);\r\n return runCommand(gulpBuild, this.debug, true, Angular15UpgraderMessages.Completed, this.logFileName).then((response) => {\r\n console.log(response);\r\n });\r\n }\r\n\r\n protected async gulpBuildProdPostAudit(): Promise<void> {\r\n return this.logParser.run();\r\n }\r\n\r\n protected async installUTALegacyDevDependency(): Promise<void> {\r\n const setprefixCmd = 'npm config set save-prefix=';\r\n Logger.log(setprefixCmd);\r\n await runCommand(setprefixCmd, this.debug);\r\n const cmd = 'npm install @msft-sme/ui-test-automation@latest --save-dev --force';\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n protected async installDependenciesPreparation(): Promise<void> {\r\n await this.removeNodeModuleFolder();\r\n await this.removePackageLockJsonFile();\r\n await this.removeE2EFolder();\r\n await this.checkEslintRCFile();\r\n updateShellReferences('', this.internal);\r\n }\r\n\r\n private async checkEslintRCFile(): Promise<void> {\r\n const esLintUpgrader = new EslintUpgrader();\r\n await esLintUpgrader.replaceEslintConfig();\r\n }\r\n\r\n private async installMicrosftSignalR(): Promise<void> {\r\n const cmd = 'npm install @microsoft/signalr@6.0.8 --save';\r\n\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async removePackageLockJsonFile(): Promise<void> {\r\n const cmd = `del ${this.packageLockJsonFilePath}`;\r\n\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async removeNodeModuleFolder(): Promise<void> {\r\n const cmd = `rmdir /s /q ${this.nodeModulesFolderPath}`;\r\n\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async removeE2EFolder(): Promise<void> {\r\n const cmd = `rmdir /s /q ${this.e2eFolderPath}`;\r\n\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async installDependencies(): Promise<void> {\r\n // Needs to be installed on the SDK root dependency.\r\n if (!this.internal) {\r\n await this.installMicrosftSignalR();\r\n }\r\n const cmd = 'npm install --force';\r\n\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async installDependenciesForUITestAutomation(): Promise<void> {\r\n const cmd = 'pushd ' + this.uiTestAutomationLegacyFolderPath + '&& del package-lock.json && npm install && popd';\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async fixEslintErrors(ignore = false): Promise<void> {\r\n if (ignore) {\r\n return;\r\n }\r\n \r\n const rootFileLinterFix = 'npx eslint . --fix';\r\n Logger.log(rootFileLinterFix);\r\n await runCommand(rootFileLinterFix, this.debug, true, Angular15UpgraderMessages.FinalizeInfoLintFix);\r\n const projectLinterFix = 'npx ng lint --fix';\r\n Logger.log(projectLinterFix);\r\n await runCommand(projectLinterFix, this.debug, true, Angular15UpgraderMessages.FinalizeInfoLintFix);\r\n }\r\n\r\n /**\r\n * electron-to-chromium 1.4.533 - 1.4.535 are bad versions that is also the latest, meaning any dependency uses ^1.4.xxx are also blocked,\r\n * below are the dependency list:\r\n * /@angular-devkit/build-angular@15.2.8 -> browserslist@4.21.5 that has dependency on ^1.4.284(which always grab 1.4.535)\r\n * always force 1.4.532\r\n */\r\n private async installLKGElectronToChromium(): Promise<void> {\r\n const cmd = 'npm install electron-to-chromium@1.4.532 --force';\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../packages/tools/wac-cli/src/angular15/main.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAUrD;;GAEG;AACH,oBAAY,WAAW;IACnB,cAAc,mBAAmB;IACjC,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;CAC9B;AAED;;GAEG;AACH,oBAAY,yBAAyB;IACjC,eAAe,2CAA2C;IAC1D,gBAAgB,4CAA4C;IAC5D,cAAc,8BAA8B;IAC5C,mBAAmB,yMAIlB;IACD,mBAAmB,2DAA2D;IAC9E,SAAS,uBAAuB;IAChC,kBAAkB,2D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AC,QAAQ,CAAC,mBAAmB,CAAc;IAClD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAoB;;IAQrD;;;;;;;;;;;;OAYG;IACU,OAAO,CAAC,QAAQ,UAAQ,EAAE,KAAK,SAAI,EAAE,QAAQ,UAAQ,EAAE,KAAK,UAAQ;cAkFjE,iCAAiC,IAAI,OAAO,CAAC,IAAI,CAAC;IA6BlE,SAAS,CAAC,cAAc;IAqBxB,SAAS,CAAC,gBAAgB,IAAI,IAAI;cAqClB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAInD,SAAS,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtC,SAAS,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAQpC,SAAS,CAAC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;cAQxB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;cAIvC,6BAA6B,IAAI,OAAO,CAAC,IAAI,CAAC;cAS9C,8BAA8B,IAAI,OAAO,CAAC,IAAI,CAAC;YAQjD,iBAAiB;YAKjB,sBAAsB;YAOtB,yBAAyB;YAOzB,sBAAsB;YAOtB,eAAe;YAOf,mBAAmB;YAWnB,sCAAsC;YAKtC,eAAe;IAa7B;;;;;OAKG;YACW,4BAA4B;CAK7C","file":"main.d.ts","sourcesContent":["import { Common } from '../common';\r\nimport { PackageJsonUpgrader } from './upgrader/package-json-upgrader';\r\nimport { TSConfigUpgrader } from './upgrader/tsconfig-upgrader';\r\nimport { Logger } from './utils/logger';\r\nimport { GitIgnoreUpgrader } from './upgrader/git-ignore-upgrader';\r\nimport { AngularJsonUpgrader } from './upgrader/angular-json-upgrader';\r\nimport { FileReplacementUpgrader } from './upgrader/file-replacement-upgrader';\r\nimport { CIBuildYmlUpgrader } from './upgrader/ci-build-yml-upgrader';\r\nimport { ReplaceUpgrader } from './upgrader/replace-upgrader';\r\nimport { srcTsConfigLibProdReplaces, srcTsConfigSpecRemoves } from './configs/config';\r\nimport { RemoveUpgrader } from './upgrader/remove-upgrader';\r\nimport { MainDebugger } from './utils/main-debugger';\r\nimport { runCommand } from './utils/command-runner';\r\nimport { LogParser } from './upgrader/audit/log-parser';\r\nimport { VersionJsonUpgrader } from './upgrader/version-json-upgrader';\r\nimport { JasmineTestUpgrader } from './upgrader/jasmine-test-upgrader';\r\nimport { updateShellReferences } from './utils/update-shell-references';\r\nimport { EslintUpgrader } from '../eslint/main';\r\nimport { UITestAutomationLegacyUpgrader } from './upgrader/ui-test-automation-legacy-upgrader';\r\nimport { EslintAutoFixUpgrader } from './upgrader/eslint-auto-fix-upgrader';\r\n\r\n/**\r\n * Represents the type of upgrade that needs to be performed.\r\n */\r\nexport enum UpgradeType {\r\n WithBaseConfig = 'WithBaseConfig',\r\n WithoutBaseConfig = 'WithoutBaseConfig',\r\n NoOperation = 'NoOperation'\r\n}\r\n\r\n/**\r\n * Represents the messages that are displayed during the upgrade process.\r\n */\r\nexport enum Angular15UpgraderMessages {\r\n StartingUpgrade = 'Starting Angular 15 upgrade process...',\r\n UpdateBasicPaths = 'Updating basic paths for the upgrade...',\r\n Initialization = 'Initializing upgraders...',\r\n FinalizeInfoLintFix = `There are eslint violations that needs fix... After fixing the violations, please run the following commands:\\n\r\n npx eslint . --fix \\n\r\n gulp lintApp \\n\r\n gulp build \\n\r\n `,\r\n InternalCommandOnly = 'This command is only available for internal extension.',\r\n Completed = 'Upgrade completed!',\r\n StartMessageStage0 = 'Starting stage 0: the default Angular 15 upgrade stage',\r\n StartMessageStage1 = 'Starting stage 1: the Angular core stage',\r\n StartMessageStage2 = 'Starting stage 2: the Angular 15 unit test stage',\r\n StartMessageStage3 = 'Starting stage 3: the legacy ui-test-automation stage',\r\n StartMessageStage4 = 'Starting stage 4: the eslint to support gulp lintApp --fix command stage'\r\n}\r\n\r\n/**\r\n * This is the main class of the EslintUpgrader tool.\r\n * It is responsible for upgrading the Tslint to Eslint.\r\n */\r\nexport class Angular15Upgrader {\r\n /**\r\n * The debug mode.\r\n */\r\n protected debug = false;\r\n\r\n /**\r\n * It determines whether to run angualr 15 upgrade for the internal extension or external sdk.\r\n */\r\n protected internal = false;\r\n\r\n /**\r\n * If running in the pipeline, the pipeline needs to automatically update for the @msft-sme pacakges instead of WAC CLI.\r\n */\r\n protected pipeline = false;\r\n\r\n /**\r\n * The main debugger.\r\n */\r\n protected mainDebugger: MainDebugger;\r\n\r\n /**\r\n * The main debugger version.\r\n */\r\n private readonly version = '1.0.1';\r\n\r\n /**\r\n * The paths of the configuration files.\r\n */\r\n private tsconfigBaseFilePath: string;\r\n private tsconfigFilePath: string;\r\n private angularJsonFilePath: string;\r\n private gitIgnoreFilePath: string;\r\n private packageJsonFilePath: string;\r\n private versionJsonFilePath: string;\r\n private packageLockJsonFilePath: string;\r\n private nodeModulesFolderPath: string;\r\n private e2eFolderPath: string;\r\n private testTsFilePath: string;\r\n private testTsFileTemplatePath: string;\r\n private cIBuildYmlFilePath: string;\r\n private pullRequestYmlFilePath: string;\r\n private srcTsConfigSpecFilePath: string;\r\n private srcTsConfigLibProdFilePath: string;\r\n private gulpCompileTsFilePath: string;\r\n private gulpCompileTsTemplatePath: string;\r\n private gulpIndexTsFilePath: string;\r\n private gulpIndexTsTemplatePath: string;\r\n private uiTestAutomationLegacyFilePath: string;\r\n private uiTestAutomationLegacyFolderPath: string;\r\n private logFilePath: string;\r\n private eslintrcFilePath: string;\r\n\r\n /**\r\n * The upgrader for each configuration file.\r\n */\r\n private packageJsonUpgrader: PackageJsonUpgrader;\r\n private versionJsonUpgrader: VersionJsonUpgrader;\r\n private tSConfigUpgrader: TSConfigUpgrader;\r\n private tSConfigBaseUpgrader: TSConfigUpgrader;\r\n private gitIgnoreUpgrader: GitIgnoreUpgrader;\r\n private angularJsonUpgrader: AngularJsonUpgrader;\r\n private testTsUpgrader: FileReplacementUpgrader;\r\n private cIBuildUpgrader: CIBuildYmlUpgrader;\r\n private pullRequestUpgrader: CIBuildYmlUpgrader;\r\n private srcTsConfigLibProdUpgrader: ReplaceUpgrader;\r\n private srcTsConfigSpecUpgrader: RemoveUpgrader;\r\n private gulpCompileTsUpgrader: FileReplacementUpgrader;\r\n private gulpIndexTsUpgrader: FileReplacementUpgrader;\r\n private logParser: LogParser;\r\n private jasmineTestUpgrader: JasmineTestUpgrader;\r\n private uITestAutomationLegacyUpgrader: UITestAutomationLegacyUpgrader;\r\n /**\r\n * The eslint fix upgrader to support linter fix command for stage 4.\r\n */\r\n private eslintAutoFixUpgrader: EslintAutoFixUpgrader;\r\n\r\n /**\r\n * The file names for each configuration file.\r\n */\r\n private readonly tsconfigBaseFileName = 'tsconfig.base.json';\r\n private readonly tsconfigFileName = 'tsconfig.json';\r\n private readonly packageJsonFileName = 'package.json';\r\n private readonly versionJsonFileName = 'version.json';\r\n private readonly packageLockJsonFileName = 'package-lock.json';\r\n private readonly angularFileName = 'angular.json';\r\n private readonly e2eFolderName = 'e2e';\r\n private readonly nodeModulesFolderName = 'node_modules';\r\n private readonly gitIgnoreFileName = '.gitignore';\r\n private readonly testTsFileName = 'test.ts';\r\n private readonly cIBuildYmlFileName = 'ci-build.yml';\r\n private readonly pullRequestYmlFileName = 'pull-request.yml';\r\n private readonly srcTsConfigLibProdFileName = 'tsconfig.lib.prod.json';\r\n private readonly srcTsConfigSpecFileName = 'tsconfig.spec.json';\r\n private readonly gulpCompileTsFileName = 'compile.ts';\r\n private readonly gulpIndexTsFileName = 'index.ts';\r\n private readonly logFileName = 'log.txt';\r\n private readonly eslintrcFileName = '.eslintrc.json';\r\n\r\n constructor() {\r\n Logger.log(Angular15UpgraderMessages.StartingUpgrade);\r\n Common.rootPath = process.cwd();\r\n Logger.log(Common.rootPath);\r\n }\r\n\r\n /**\r\n * The upgrader main function.\r\n * If only runs the unit test\r\n * node ./node_modules/@microsoft/windows-admin-center-sdk/tools/wac-cli/src/index.js angular15Upgrade --pipeline false --stage 2\r\n * @param pipeline It determines whether to run this command on the pipeline.\r\n * @param debug It determines whether to run the debug mode.\r\n * @param internal It determines whether to run angualr 15 upgrade for the internal extension or external sdk.\r\n * @param stage '0' - the default Angular 15 upgrade stage,\r\n * '1' - the Angular core stage,\r\n * '2' - the Angular 15 unit test stage,\r\n * '3' - the legacy ui-test-automation stage.\r\n * '4' - the eslint to support gulp lintApp --fix command.\r\n */\r\n public async upgrade(pipeline = false, stage = 0, internal = false, debug = false) {\r\n this.debug = !!debug;\r\n this.pipeline = !!pipeline;\r\n this.internal = !!internal;\r\n Logger.log(this.version);\r\n Logger.log(Angular15UpgraderMessages.StartingUpgrade);\r\n Logger.log('Passed in parameters: ' + this.pipeline + ' ' + stage + ' ' + this.internal + ' ' + this.debug );\r\n\r\n this.mainDebugger = this.debug ? new MainDebugger(): undefined;\r\n\r\n Logger.log(Angular15UpgraderMessages.UpdateBasicPaths);\r\n this.updateBasicPaths();\r\n\r\n Logger.log(Angular15UpgraderMessages.Initialization);\r\n this.initialization();\r\n\r\n switch (stage) {\r\n case 0:\r\n Logger.log(Angular15UpgraderMessages.StartMessageStage0);\r\n await this.criticalConfigurationFilesUpdates();\r\n await this.installDependenciesPreparation();\r\n await this.installLKGElectronToChromium();\r\n await this.installDependencies();\r\n // Fix any eslint errors that doesn't match the latest eslint rules.\r\n await this.fixEslintErrors(this.pipeline);\r\n await this.gulpQuick();\r\n await this.gulpBuildPostAudit();\r\n // Fix any eslint errors that is triggered by audit.\r\n await this.fixEslintErrors(this.pipeline);\r\n await this.gulpBuildProd();\r\n await this.gulpBuildProdPostAudit();\r\n // Fix any eslint errors clean-ups.\r\n await this.fixEslintErrors(this.pipeline);\r\n await this.jasmineTestUpgrader.run();\r\n break;\r\n case 1:\r\n Logger.log(Angular15UpgraderMessages.StartMessageStage1);\r\n await this.criticalConfigurationFilesUpdates();\r\n await this.installDependenciesPreparation();\r\n await this.installLKGElectronToChromium();\r\n await this.installDependencies();\r\n // Fix any eslint errors that doesn't match the latest eslint rules.\r\n await this.fixEslintErrors(this.pipeline);\r\n await this.gulpQuick();\r\n await this.gulpBuildPostAudit();\r\n // Fix any eslint errors that is triggered by audit.\r\n await this.fixEslintErrors(this.pipeline);\r\n await this.gulpBuildProd();\r\n await this.gulpBuildProdPostAudit();\r\n // Fix any eslint errors clean-ups.\r\n await this.fixEslintErrors(this.pipeline);\r\n break;\r\n case 2:\r\n Logger.log(Angular15UpgraderMessages.StartMessageStage2);\r\n await this.gulpIndexTsUpgrader.run();\r\n await this.testTsUpgrader.run();\r\n await this.jasmineTestUpgrader.run();\r\n break;\r\n case 3:\r\n Logger.log(Angular15UpgraderMessages.StartMessageStage3);\r\n if (!this.internal) {\r\n Logger.log(Angular15UpgraderMessages.InternalCommandOnly);\r\n } else {\r\n await this.packageJsonUpgrader.run(this.pipeline),\r\n await this.installUTALegacyDevDependency();\r\n await this.uITestAutomationLegacyUpgrader.run();\r\n await this.installDependenciesForUITestAutomation();\r\n }\r\n case 4:\r\n Logger.log(Angular15UpgraderMessages.StartMessageStage4);\r\n if (!this.internal) {\r\n Logger.log(Angular15UpgraderMessages.InternalCommandOnly);\r\n } else {\r\n await this.eslintAutoFixUpgrader.run();\r\n await this.gulpLintFix();\r\n }\r\n default:\r\n Logger.log('default');\r\n break;\r\n }\r\n }\r\n\r\n protected async criticalConfigurationFilesUpdates(): Promise<void> {\r\n Promise.all([\r\n this.packageJsonUpgrader.run(this.pipeline),\r\n this.versionJsonUpgrader.run(),\r\n this.tSConfigBaseUpgrader.runBase(),\r\n this.tSConfigUpgrader.run(),\r\n this.gitIgnoreUpgrader.run(),\r\n this.angularJsonUpgrader.run(),\r\n this.testTsUpgrader.run(),\r\n this.cIBuildUpgrader.run(),\r\n this.pullRequestUpgrader.run(),\r\n this.srcTsConfigLibProdUpgrader.run(),\r\n this.srcTsConfigSpecUpgrader.run(),\r\n this.gulpCompileTsUpgrader.run(),\r\n this.gulpIndexTsUpgrader.run()\r\n ]).then((results) => {\r\n console.log('All Promises have completed:', results);\r\n\r\n if (this.debug) {\r\n this.mainDebugger.verifyTestData(this).then(() => {\r\n Logger.log(Angular15UpgraderMessages.Completed);\r\n });\r\n }\r\n })\r\n .catch((error) => {\r\n Logger.error('At least one Promise encountered an error:' + error);\r\n });\r\n }\r\n\r\n protected initialization() {\r\n this.packageJsonUpgrader = new PackageJsonUpgrader(this.packageJsonFilePath);\r\n this.versionJsonUpgrader = new VersionJsonUpgrader(this.versionJsonFilePath);\r\n this.tSConfigBaseUpgrader = new TSConfigUpgrader(this.tsconfigBaseFilePath, this.tsconfigBaseFileName);\r\n this.tSConfigUpgrader = new TSConfigUpgrader(this.tsconfigFilePath, this.tsconfigFileName);\r\n this.gitIgnoreUpgrader = new GitIgnoreUpgrader(this.gitIgnoreFilePath);\r\n this.angularJsonUpgrader = new AngularJsonUpgrader(this.angularJsonFilePath);\r\n this.testTsUpgrader = new FileReplacementUpgrader(this.testTsFileTemplatePath, this.testTsFilePath);\r\n this.cIBuildUpgrader = new CIBuildYmlUpgrader(this.cIBuildYmlFilePath, this.cIBuildYmlFileName);\r\n this.pullRequestUpgrader = new CIBuildYmlUpgrader(this.pullRequestYmlFilePath, this.pullRequestYmlFileName);\r\n this.srcTsConfigLibProdUpgrader = new ReplaceUpgrader(this.srcTsConfigLibProdFilePath, srcTsConfigLibProdReplaces, this.srcTsConfigLibProdFileName);\r\n this.srcTsConfigSpecUpgrader = new RemoveUpgrader(this.srcTsConfigSpecFilePath, srcTsConfigSpecRemoves, this.srcTsConfigSpecFileName);\r\n this.gulpCompileTsUpgrader = new FileReplacementUpgrader(this.gulpCompileTsTemplatePath, this.gulpCompileTsFilePath);\r\n this.gulpIndexTsUpgrader = new FileReplacementUpgrader(this.gulpIndexTsTemplatePath, this.gulpIndexTsFilePath);\r\n this.jasmineTestUpgrader = new JasmineTestUpgrader(this.testTsFilePath, this.debug);\r\n this.uITestAutomationLegacyUpgrader = new UITestAutomationLegacyUpgrader(this.uiTestAutomationLegacyFilePath, this.packageJsonFileName);\r\n this.eslintAutoFixUpgrader = new EslintAutoFixUpgrader(this.eslintrcFilePath);\r\n\r\n this.logParser = new LogParser(this.logFilePath, this.logFileName);\r\n }\r\n\r\n protected updateBasicPaths(): void {\r\n this.tsconfigBaseFilePath = Common.rootPath + '\\\\' + this.tsconfigBaseFileName;\r\n this.tsconfigFilePath = Common.rootPath + '\\\\' + this.tsconfigFileName;\r\n this.angularJsonFilePath = Common.rootPath + '\\\\' + this.angularFileName;\r\n this.packageJsonFilePath = Common.rootPath + '\\\\' + this.packageJsonFileName;\r\n this.versionJsonFilePath = Common.rootPath + '\\\\' + this.versionJsonFileName;\r\n this.packageLockJsonFilePath = Common.rootPath + '\\\\' + this.packageLockJsonFileName;\r\n this.nodeModulesFolderPath = Common.rootPath + '\\\\' + this.nodeModulesFolderName;\r\n this.e2eFolderPath = Common.rootPath + '\\\\' + this.e2eFolderName;\r\n this.gitIgnoreFilePath = Common.rootPath + '\\\\' + this.gitIgnoreFileName;\r\n this.eslintrcFilePath = Common.rootPath + '\\\\' + this.eslintrcFileName;\r\n\r\n this.srcTsConfigLibProdFilePath = Common.rootPath + '\\\\src\\\\' + this.srcTsConfigLibProdFileName;\r\n this.srcTsConfigSpecFilePath = Common.rootPath + '\\\\src\\\\' + this.srcTsConfigSpecFileName;\r\n\r\n this.cIBuildYmlFilePath = Common.rootPath + '\\\\build\\\\pipelines\\\\' + this.cIBuildYmlFileName;\r\n this.pullRequestYmlFilePath = Common.rootPath + '\\\\build\\\\pipelines\\\\' + this.pullRequestYmlFileName;\r\n\r\n this.testTsFilePath = Common.rootPath + '\\\\src\\\\' + this.testTsFileName;\r\n this.testTsFileTemplatePath = Common.cliRootPath.replace('wac-cli', 'module-template\\\\angular15\\\\test.ts');\r\n\r\n this.gulpCompileTsFilePath = Common.rootPath + '\\\\gulpfile.ts\\\\common\\\\' + this.gulpCompileTsFileName;\r\n this.gulpCompileTsTemplatePath = Common.cliRootPath.replace('wac-cli', 'module-template\\\\angular15\\\\gulpfile.ts\\\\common\\\\compile.ts');\r\n\r\n this.gulpIndexTsFilePath = Common.rootPath + '\\\\gulpfile.ts\\\\' + this.gulpIndexTsFileName;\r\n this.gulpIndexTsTemplatePath = Common.cliRootPath.replace('wac-cli', 'module-template\\\\angular15\\\\gulpfile.ts\\\\index.ts');\r\n\r\n this.uiTestAutomationLegacyFilePath = Common.rootPath + '\\\\ui-test-automation\\\\' + this.packageJsonFileName;\r\n this.uiTestAutomationLegacyFolderPath = Common.rootPath + '\\\\ui-test-automation\\\\';\r\n\r\n this.logFilePath = Common.rootPath + '\\\\' + this.logFileName;\r\n\r\n if (this.debug) {\r\n this.mainDebugger.updateTestData(this);\r\n }\r\n }\r\n\r\n protected async gulpBuildPostAudit(): Promise<void> {\r\n return this.logParser.run();\r\n }\r\n\r\n protected gulpLintFix(): Promise<void> {\r\n const gulpLintFixCmd = 'gulp lintApp --fix';\r\n Logger.log(gulpLintFixCmd);\r\n return runCommand(gulpLintFixCmd, this.debug, true, Angular15UpgraderMessages.Completed, this.logFileName).then((response) => {\r\n console.log(response);\r\n });\r\n }\r\n\r\n protected gulpQuick(): Promise<void> {\r\n const gulpQuick = 'gulp quick';\r\n Logger.log(gulpQuick);\r\n return runCommand(gulpQuick, this.debug, true, Angular15UpgraderMessages.Completed, this.logFileName).then((response) => {\r\n console.log(response);\r\n });\r\n }\r\n\r\n protected gulpBuildProd(): Promise<void> {\r\n const gulpBuild = 'gulp build --prod';\r\n Logger.log(gulpBuild);\r\n return runCommand(gulpBuild, this.debug, true, Angular15UpgraderMessages.Completed, this.logFileName).then((response) => {\r\n console.log(response);\r\n });\r\n }\r\n\r\n protected async gulpBuildProdPostAudit(): Promise<void> {\r\n return this.logParser.run();\r\n }\r\n\r\n protected async installUTALegacyDevDependency(): Promise<void> {\r\n const setprefixCmd = 'npm config set save-prefix=';\r\n Logger.log(setprefixCmd);\r\n await runCommand(setprefixCmd, this.debug);\r\n const cmd = 'npm install @msft-sme/ui-test-automation@latest --save-dev --force';\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n protected async installDependenciesPreparation(): Promise<void> {\r\n await this.removeNodeModuleFolder();\r\n await this.removePackageLockJsonFile();\r\n await this.removeE2EFolder();\r\n await this.checkEslintRCFile();\r\n updateShellReferences('', this.internal);\r\n }\r\n\r\n private async checkEslintRCFile(): Promise<void> {\r\n const esLintUpgrader = new EslintUpgrader();\r\n await esLintUpgrader.replaceEslintConfig();\r\n }\r\n\r\n private async installMicrosftSignalR(): Promise<void> {\r\n const cmd = 'npm install @microsoft/signalr@6.0.8 --save';\r\n\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async removePackageLockJsonFile(): Promise<void> {\r\n const cmd = `del ${this.packageLockJsonFilePath}`;\r\n\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async removeNodeModuleFolder(): Promise<void> {\r\n const cmd = `rmdir /s /q ${this.nodeModulesFolderPath}`;\r\n\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async removeE2EFolder(): Promise<void> {\r\n const cmd = `rmdir /s /q ${this.e2eFolderPath}`;\r\n\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async installDependencies(): Promise<void> {\r\n // Needs to be installed on the SDK root dependency.\r\n if (!this.internal) {\r\n await this.installMicrosftSignalR();\r\n }\r\n const cmd = 'npm install --force';\r\n\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async installDependenciesForUITestAutomation(): Promise<void> {\r\n const cmd = 'pushd ' + this.uiTestAutomationLegacyFolderPath + '&& del package-lock.json && npm install && popd';\r\n await runCommand(cmd, this.debug);\r\n }\r\n\r\n private async fixEslintErrors(ignore = false): Promise<void> {\r\n if (ignore) {\r\n return;\r\n }\r\n \r\n const rootFileLinterFix = 'npx eslint . --fix';\r\n Logger.log(rootFileLinterFix);\r\n await runCommand(rootFileLinterFix, this.debug, true, Angular15UpgraderMessages.FinalizeInfoLintFix);\r\n const projectLinterFix = 'npx ng lint --fix';\r\n Logger.log(projectLinterFix);\r\n await runCommand(projectLinterFix, this.debug, true, Angular15UpgraderMessages.FinalizeInfoLintFix);\r\n }\r\n\r\n /**\r\n * electron-to-chromium 1.4.533 - 1.4.535 are bad versions that is also the latest, meaning any dependency uses ^1.4.xxx are also blocked,\r\n * below are the dependency list:\r\n * /@angular-devkit/build-angular@15.2.8 -> browserslist@4.21.5 that has dependency on ^1.4.284(which always grab 1.4.535)\r\n * always force 1.4.532\r\n */\r\n private async installLKGElectronToChromium(): Promise<void> {\r\n const cmd = 'npm install electron-to-chromium@1.4.532 --force';\r\n Logger.log(cmd);\r\n await runCommand(cmd, this.debug);\r\n }\r\n}\r\n"]}
|