ng-alain 14.3.0 → 15.0.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/application/files/root/.stylelintrc +2 -1
- package/application/files/src/assets/color.less +6 -1
- package/application/files/src/assets/style.compact.css +1 -1
- package/application/files/src/assets/style.dark.css +1 -1
- package/application/index.js +8 -7
- package/application/index.js.map +1 -1
- package/application/index.ts +8 -7
- package/migration.json +4 -14
- package/ng-add/index.js +2 -2
- package/ng-add/index.ts +2 -2
- package/ng-update/data/attribute-selectors.js +1 -1
- package/ng-update/data/attribute-selectors.ts +1 -1
- package/ng-update/data/class-names.js +1 -1
- package/ng-update/data/class-names.ts +1 -1
- package/ng-update/data/constructor-checks.js +1 -1
- package/ng-update/data/constructor-checks.ts +1 -1
- package/ng-update/data/css-selectors.js +1 -1
- package/ng-update/data/css-selectors.ts +1 -1
- package/ng-update/data/element-selectors.js +1 -1
- package/ng-update/data/element-selectors.ts +1 -1
- package/ng-update/data/input-names.js +1 -1
- package/ng-update/data/input-names.ts +1 -1
- package/ng-update/data/method-call-checks.js +1 -1
- package/ng-update/data/method-call-checks.ts +1 -1
- package/ng-update/data/output-names.js +1 -1
- package/ng-update/data/output-names.ts +1 -1
- package/ng-update/data/property-names.js +1 -1
- package/ng-update/data/property-names.ts +1 -1
- package/ng-update/index.js +6 -19
- package/ng-update/index.js.map +1 -1
- package/ng-update/index.ts +4 -17
- package/ng-update/upgrade-rules/v15/index.js +44 -0
- package/ng-update/upgrade-rules/v15/index.js.map +1 -0
- package/ng-update/upgrade-rules/v15/index.spec.ts +20 -0
- package/ng-update/upgrade-rules/v15/index.ts +38 -0
- package/package.json +4 -2
- package/plugin/plugin.icon.js +1 -0
- package/plugin/plugin.icon.js.map +1 -1
- package/plugin/plugin.icon.ts +4 -1
- package/tpl/schema.json +1 -1
- package/utils/less.js +19 -0
- package/utils/less.js.map +1 -0
- package/utils/less.ts +15 -0
- package/utils/lib-versions.js +2 -2
- package/utils/lib-versions.ts +2 -2
- package/utils/versions.js +15 -15
- package/utils/versions.ts +15 -15
- package/application/files/src/test.ts +0 -24
- package/ng-update/test-cases/v12/deprecated-src.spec.ts +0 -29
- package/ng-update/upgrade-rules/checks/_src-to-nz-image-rule.js +0 -25
- package/ng-update/upgrade-rules/checks/_src-to-nz-image-rule.js.map +0 -1
- package/ng-update/upgrade-rules/checks/_src-to-nz-image-rule.ts +0 -26
- package/ng-update/upgrade-rules/v12/index.js +0 -164
- package/ng-update/upgrade-rules/v12/index.js.map +0 -1
- package/ng-update/upgrade-rules/v12/index.spec.ts +0 -335
- package/ng-update/upgrade-rules/v12/index.ts +0 -187
- package/ng-update/upgrade-rules/v12/schema.js +0 -3
- package/ng-update/upgrade-rules/v12/schema.js.map +0 -1
- package/ng-update/upgrade-rules/v12/schema.json +0 -13
- package/ng-update/upgrade-rules/v12/schema.ts +0 -4
- package/ng-update/upgrade-rules/v13/index.js +0 -100
- package/ng-update/upgrade-rules/v13/index.js.map +0 -1
- package/ng-update/upgrade-rules/v13/index.spec.ts +0 -39
- package/ng-update/upgrade-rules/v13/index.ts +0 -110
- package/ng-update/upgrade-rules/v14/index.js +0 -80
- package/ng-update/upgrade-rules/v14/index.js.map +0 -1
- package/ng-update/upgrade-rules/v14/index.spec.ts +0 -305
- package/ng-update/upgrade-rules/v14/index.ts +0 -91
package/plugin/plugin.icon.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { strings } from '@angular-devkit/core';
|
|
2
2
|
import { Rule, Tree } from '@angular-devkit/schematics';
|
|
3
3
|
import { findNodes, getDecoratorMetadata } from '@schematics/angular/utility/ast-utils';
|
|
4
|
-
import {
|
|
4
|
+
import { parseFragment } from 'parse5';
|
|
5
|
+
import type { Attribute } from 'parse5/dist/common/token';
|
|
6
|
+
import type { Element } from 'parse5/dist/tree-adapters/default';
|
|
5
7
|
import * as ts from 'typescript';
|
|
6
8
|
|
|
7
9
|
import { getSourceFile } from '../utils';
|
|
@@ -25,6 +27,7 @@ const WHITE_ICONS = [
|
|
|
25
27
|
'CloseCircleOutline',
|
|
26
28
|
'CloseOutline',
|
|
27
29
|
'CopyOutline',
|
|
30
|
+
'DeleteOutline',
|
|
28
31
|
'DoubleLeftOutline',
|
|
29
32
|
'DoubleRightOutline',
|
|
30
33
|
'DownOutline',
|
package/tpl/schema.json
CHANGED
package/utils/less.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addImportNotation = void 0;
|
|
4
|
+
const json_1 = require("./json");
|
|
5
|
+
function addImportNotation() {
|
|
6
|
+
return (tree) => {
|
|
7
|
+
const filePath = '.stylelintrc';
|
|
8
|
+
const json = (0, json_1.readJSON)(tree, filePath);
|
|
9
|
+
if (json == null)
|
|
10
|
+
return tree;
|
|
11
|
+
if (!json.rules)
|
|
12
|
+
json.rules = {};
|
|
13
|
+
json.rules['import-notation'] = 'string';
|
|
14
|
+
(0, json_1.writeJSON)(tree, filePath, json);
|
|
15
|
+
return tree;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.addImportNotation = addImportNotation;
|
|
19
|
+
//# sourceMappingURL=less.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"less.js","sourceRoot":"","sources":["../../../schematics/utils/less.ts"],"names":[],"mappings":";;;AAEA,iCAA6C;AAE7C,SAAgB,iBAAiB;IAC/B,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,MAAM,QAAQ,GAAG,cAAc,CAAC;QAChC,MAAM,IAAI,GAAG,IAAA,eAAQ,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACtC,IAAI,IAAI,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,QAAQ,CAAC;QACzC,IAAA,gBAAS,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAVD,8CAUC"}
|
package/utils/less.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Rule, Tree } from '@angular-devkit/schematics';
|
|
2
|
+
|
|
3
|
+
import { readJSON, writeJSON } from './json';
|
|
4
|
+
|
|
5
|
+
export function addImportNotation(): Rule {
|
|
6
|
+
return (tree: Tree) => {
|
|
7
|
+
const filePath = '.stylelintrc';
|
|
8
|
+
const json = readJSON(tree, filePath);
|
|
9
|
+
if (json == null) return tree;
|
|
10
|
+
if (!json.rules) json.rules = {};
|
|
11
|
+
json.rules['import-notation'] = 'string';
|
|
12
|
+
writeJSON(tree, filePath, json);
|
|
13
|
+
return tree;
|
|
14
|
+
};
|
|
15
|
+
}
|
package/utils/lib-versions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZORROVERSION = exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '^
|
|
5
|
-
exports.ZORROVERSION = '^
|
|
4
|
+
exports.VERSION = '^15.0.0';
|
|
5
|
+
exports.ZORROVERSION = '^15.0.0';
|
|
6
6
|
//# sourceMappingURL=lib-versions.js.map
|
package/utils/lib-versions.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '^
|
|
2
|
-
export const ZORROVERSION = '^
|
|
1
|
+
export const VERSION = '^15.0.0';
|
|
2
|
+
export const ZORROVERSION = '^15.0.0';
|
package/utils/versions.js
CHANGED
|
@@ -21,29 +21,29 @@ const workspace_2 = require("./workspace");
|
|
|
21
21
|
function UpgradeMainVersions(tree, version = lib_versions_1.VERSION) {
|
|
22
22
|
(0, package_1.addPackage)(tree, ['abc', 'acl', 'auth', 'cache', 'form', 'mock', 'theme', 'util', 'chart'].map(name => `@delon/${name}@${version}`));
|
|
23
23
|
(0, package_1.addPackage)(tree, [
|
|
24
|
-
`@angular-eslint/builder@~
|
|
25
|
-
`@angular-eslint/eslint-plugin@~
|
|
26
|
-
`@angular-eslint/eslint-plugin-template@~
|
|
27
|
-
`@angular-eslint/schematics@~
|
|
28
|
-
`@angular-eslint/template-parser@~
|
|
29
|
-
`@typescript-eslint/eslint-plugin@~5.
|
|
30
|
-
`@typescript-eslint/parser@~5.
|
|
31
|
-
`eslint@^8.
|
|
24
|
+
`@angular-eslint/builder@~15.1.0`,
|
|
25
|
+
`@angular-eslint/eslint-plugin@~15.1.0`,
|
|
26
|
+
`@angular-eslint/eslint-plugin-template@~15.1.0`,
|
|
27
|
+
`@angular-eslint/schematics@~15.1.0`,
|
|
28
|
+
`@angular-eslint/template-parser@~15.1.0`,
|
|
29
|
+
`@typescript-eslint/eslint-plugin@~5.47.1`,
|
|
30
|
+
`@typescript-eslint/parser@~5.47.1`,
|
|
31
|
+
`eslint@^8.31.0`,
|
|
32
32
|
`eslint-config-prettier@~8.5.0`,
|
|
33
33
|
`eslint-plugin-import@~2.26.0`,
|
|
34
|
-
`eslint-plugin-jsdoc@~39.
|
|
34
|
+
`eslint-plugin-jsdoc@~39.6.4`,
|
|
35
35
|
`eslint-plugin-prefer-arrow@~1.2.3`,
|
|
36
36
|
`eslint-plugin-prettier@~4.2.1`,
|
|
37
|
-
`eslint-plugin-deprecation@~1.3.
|
|
38
|
-
`prettier@^2.
|
|
37
|
+
`eslint-plugin-deprecation@~1.3.3`,
|
|
38
|
+
`prettier@^2.8.1`,
|
|
39
39
|
`husky@^7.0.4`,
|
|
40
40
|
`ng-alain@${version}`,
|
|
41
|
-
`ng-alain-plugin-theme@^
|
|
42
|
-
`source-map-explorer@^2.5.
|
|
43
|
-
`@angular/language-service@^
|
|
41
|
+
`ng-alain-plugin-theme@^15.0.1`,
|
|
42
|
+
`source-map-explorer@^2.5.3`,
|
|
43
|
+
`@angular/language-service@^15.0.4`,
|
|
44
44
|
`@delon/testing@${version}`
|
|
45
45
|
], 'devDependencies');
|
|
46
|
-
(0, package_1.addPackage)(tree, [`rxjs@~7.5.0`, `ng-zorro-antd@^
|
|
46
|
+
(0, package_1.addPackage)(tree, [`rxjs@~7.5.0`, `ng-zorro-antd@^15.0.0`]);
|
|
47
47
|
}
|
|
48
48
|
exports.UpgradeMainVersions = UpgradeMainVersions;
|
|
49
49
|
function addESLintRule(context, showLog = true) {
|
package/utils/versions.ts
CHANGED
|
@@ -17,31 +17,31 @@ export function UpgradeMainVersions(tree: Tree, version: string = VERSION): void
|
|
|
17
17
|
addPackage(
|
|
18
18
|
tree,
|
|
19
19
|
[
|
|
20
|
-
`@angular-eslint/builder@~
|
|
21
|
-
`@angular-eslint/eslint-plugin@~
|
|
22
|
-
`@angular-eslint/eslint-plugin-template@~
|
|
23
|
-
`@angular-eslint/schematics@~
|
|
24
|
-
`@angular-eslint/template-parser@~
|
|
25
|
-
`@typescript-eslint/eslint-plugin@~5.
|
|
26
|
-
`@typescript-eslint/parser@~5.
|
|
27
|
-
`eslint@^8.
|
|
20
|
+
`@angular-eslint/builder@~15.1.0`,
|
|
21
|
+
`@angular-eslint/eslint-plugin@~15.1.0`,
|
|
22
|
+
`@angular-eslint/eslint-plugin-template@~15.1.0`,
|
|
23
|
+
`@angular-eslint/schematics@~15.1.0`,
|
|
24
|
+
`@angular-eslint/template-parser@~15.1.0`,
|
|
25
|
+
`@typescript-eslint/eslint-plugin@~5.47.1`,
|
|
26
|
+
`@typescript-eslint/parser@~5.47.1`,
|
|
27
|
+
`eslint@^8.31.0`,
|
|
28
28
|
`eslint-config-prettier@~8.5.0`,
|
|
29
29
|
`eslint-plugin-import@~2.26.0`,
|
|
30
|
-
`eslint-plugin-jsdoc@~39.
|
|
30
|
+
`eslint-plugin-jsdoc@~39.6.4`,
|
|
31
31
|
`eslint-plugin-prefer-arrow@~1.2.3`,
|
|
32
32
|
`eslint-plugin-prettier@~4.2.1`,
|
|
33
|
-
`eslint-plugin-deprecation@~1.3.
|
|
34
|
-
`prettier@^2.
|
|
33
|
+
`eslint-plugin-deprecation@~1.3.3`,
|
|
34
|
+
`prettier@^2.8.1`,
|
|
35
35
|
`husky@^7.0.4`,
|
|
36
36
|
`ng-alain@${version}`,
|
|
37
|
-
`ng-alain-plugin-theme@^
|
|
38
|
-
`source-map-explorer@^2.5.
|
|
39
|
-
`@angular/language-service@^
|
|
37
|
+
`ng-alain-plugin-theme@^15.0.1`,
|
|
38
|
+
`source-map-explorer@^2.5.3`,
|
|
39
|
+
`@angular/language-service@^15.0.4`,
|
|
40
40
|
`@delon/testing@${version}`
|
|
41
41
|
],
|
|
42
42
|
'devDependencies'
|
|
43
43
|
);
|
|
44
|
-
addPackage(tree, [`rxjs@~7.5.0`, `ng-zorro-antd@^
|
|
44
|
+
addPackage(tree, [`rxjs@~7.5.0`, `ng-zorro-antd@^15.0.0`]);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export function addESLintRule(context: SchematicContext, showLog: Boolean = true): Rule {
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unassigned-import */
|
|
2
|
-
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
3
|
-
|
|
4
|
-
import 'zone.js/testing';
|
|
5
|
-
import { getTestBed } from '@angular/core/testing';
|
|
6
|
-
import {
|
|
7
|
-
BrowserDynamicTestingModule,
|
|
8
|
-
platformBrowserDynamicTesting
|
|
9
|
-
} from '@angular/platform-browser-dynamic/testing';
|
|
10
|
-
|
|
11
|
-
declare const require: any;
|
|
12
|
-
|
|
13
|
-
// First, initialize the Angular testing environment.
|
|
14
|
-
getTestBed().initTestEnvironment(
|
|
15
|
-
BrowserDynamicTestingModule,
|
|
16
|
-
platformBrowserDynamicTesting(), {
|
|
17
|
-
teardown: { destroyAfterEach: false }
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
// Then we find all the tests.
|
|
22
|
-
const context = require.context('./', true, /\.spec\.ts$/);
|
|
23
|
-
// And load the modules.
|
|
24
|
-
context.keys().map(context);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
-
|
|
3
|
-
import { writeFile } from '../../../utils/file';
|
|
4
|
-
import { createTestApp, FILE_PREFIX, migrationCollection } from '../../../utils/testing';
|
|
5
|
-
|
|
6
|
-
describe('migration:v12 deprecated _src', () => {
|
|
7
|
-
let runner: SchematicTestRunner;
|
|
8
|
-
let tree: UnitTestTree;
|
|
9
|
-
let log: string[];
|
|
10
|
-
|
|
11
|
-
beforeEach(async () => {
|
|
12
|
-
({ runner, tree } = await createTestApp());
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
async function runMigration(): Promise<void> {
|
|
16
|
-
runner = new SchematicTestRunner('schematics', migrationCollection);
|
|
17
|
-
log = [];
|
|
18
|
-
runner.logger.subscribe(logEntry => log.push(logEntry.message));
|
|
19
|
-
await runner.runSchematicAsync('migration-v12', {}, tree).toPromise();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
it('should be _src to nz-image', async () => {
|
|
23
|
-
const file = `${FILE_PREFIX}/src/app/app.component.html`;
|
|
24
|
-
writeFile(tree, file, `<img _src="http://1.com/1.png" /><img [_src]="'http://1.com/1.png'" />`);
|
|
25
|
-
await runMigration();
|
|
26
|
-
expect(log).toContain(`${file}@1:6 - Found deprecated "_src" component. Use "nz-image" to instead please.`);
|
|
27
|
-
expect(log).toContain(`${file}@1:40 - Found deprecated "[_src]" component. Use "nz-image" to instead please.`);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SrcToNzImageRule = void 0;
|
|
4
|
-
const schematics_1 = require("@angular/cdk/schematics");
|
|
5
|
-
class SrcToNzImageRule extends schematics_1.Migration {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.enabled = this.targetVersion === schematics_1.TargetVersion.V12;
|
|
9
|
-
}
|
|
10
|
-
visitTemplate(template) {
|
|
11
|
-
const deprecatedComponent = (deprecated) => {
|
|
12
|
-
(0, schematics_1.findInputsOnElementWithAttr)(template.content, '_src', [deprecated]).forEach(offset => {
|
|
13
|
-
this.failures.push({
|
|
14
|
-
filePath: template.filePath,
|
|
15
|
-
position: template.getCharacterAndLineOfPosition(offset),
|
|
16
|
-
message: `Found deprecated "${deprecated}" component. Use "nz-image" to instead please.`
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
deprecatedComponent('_src');
|
|
21
|
-
deprecatedComponent('[_src]');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.SrcToNzImageRule = SrcToNzImageRule;
|
|
25
|
-
//# sourceMappingURL=_src-to-nz-image-rule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_src-to-nz-image-rule.js","sourceRoot":"","sources":["../../../../../schematics/ng-update/upgrade-rules/checks/_src-to-nz-image-rule.ts"],"names":[],"mappings":";;;AAAA,wDAMiC;AAEjC,MAAa,gBAAiB,SAAQ,sBAAsB;IAA5D;;QACE,YAAO,GAAG,IAAI,CAAC,aAAa,KAAK,0BAAa,CAAC,GAAG,CAAC;IAgBrD,CAAC;IAdC,aAAa,CAAC,QAA0B;QACtC,MAAM,mBAAmB,GAAG,CAAC,UAAkB,EAAQ,EAAE;YACvD,IAAA,wCAA2B,EAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACnF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;oBACjB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;oBAC3B,QAAQ,EAAE,QAAQ,CAAC,6BAA6B,CAAC,MAAM,CAAC;oBACxD,OAAO,EAAE,qBAAqB,UAAU,gDAAgD;iBACzF,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC5B,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;CACF;AAjBD,4CAiBC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
findInputsOnElementWithAttr,
|
|
3
|
-
Migration,
|
|
4
|
-
ResolvedResource,
|
|
5
|
-
TargetVersion,
|
|
6
|
-
UpgradeData
|
|
7
|
-
} from '@angular/cdk/schematics';
|
|
8
|
-
|
|
9
|
-
export class SrcToNzImageRule extends Migration<UpgradeData> {
|
|
10
|
-
enabled = this.targetVersion === TargetVersion.V12;
|
|
11
|
-
|
|
12
|
-
visitTemplate(template: ResolvedResource): void {
|
|
13
|
-
const deprecatedComponent = (deprecated: string): void => {
|
|
14
|
-
findInputsOnElementWithAttr(template.content, '_src', [deprecated]).forEach(offset => {
|
|
15
|
-
this.failures.push({
|
|
16
|
-
filePath: template.filePath,
|
|
17
|
-
position: template.getCharacterAndLineOfPosition(offset),
|
|
18
|
-
message: `Found deprecated "${deprecated}" component. Use "nz-image" to instead please.`
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
deprecatedComponent('_src');
|
|
24
|
-
deprecatedComponent('[_src]');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.v12Rule = void 0;
|
|
13
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
-
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
15
|
-
const colors = require("ansi-colors");
|
|
16
|
-
const utils_1 = require("../../../utils");
|
|
17
|
-
const code_style_1 = require("../../../utils/code-style");
|
|
18
|
-
const versions_1 = require("../../../utils/versions");
|
|
19
|
-
// 修正 angular.json 的格式
|
|
20
|
-
function fixAngularJson(context) {
|
|
21
|
-
return (0, workspace_1.updateWorkspace)((workspace) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
workspace.projects.forEach((project, name) => {
|
|
23
|
-
const removeKeys = [
|
|
24
|
-
'aot',
|
|
25
|
-
'vendorChunk',
|
|
26
|
-
'extractLicenses',
|
|
27
|
-
'buildOptimizer',
|
|
28
|
-
'sourceMap',
|
|
29
|
-
'optimization',
|
|
30
|
-
'namedChunks'
|
|
31
|
-
];
|
|
32
|
-
const build = project.targets.get(utils_1.BUILD_TARGET_BUILD);
|
|
33
|
-
if (build == null)
|
|
34
|
-
throw new Error(`Can't find build node in angular.json`);
|
|
35
|
-
const buildOptions = build.options;
|
|
36
|
-
removeKeys.forEach(key => delete buildOptions[key]);
|
|
37
|
-
const prodConfigurations = build === null || build === void 0 ? void 0 : build.configurations.production;
|
|
38
|
-
removeKeys.forEach(key => delete prodConfigurations[key]);
|
|
39
|
-
build.configurations.development = {
|
|
40
|
-
buildOptimizer: false,
|
|
41
|
-
optimization: false,
|
|
42
|
-
vendorChunk: true,
|
|
43
|
-
extractLicenses: false,
|
|
44
|
-
sourceMap: true,
|
|
45
|
-
namedChunks: true
|
|
46
|
-
};
|
|
47
|
-
build.defaultConfiguration = 'production';
|
|
48
|
-
// serve
|
|
49
|
-
const serve = project.targets.get(utils_1.BUILD_TARGET_SERVE);
|
|
50
|
-
if (serve == null)
|
|
51
|
-
throw new Error(`Can't find serve node in angular.json`);
|
|
52
|
-
serve.configurations.development = {
|
|
53
|
-
browserTarget: `${name}:build:development`
|
|
54
|
-
};
|
|
55
|
-
serve.defaultConfiguration = 'development';
|
|
56
|
-
});
|
|
57
|
-
(0, utils_1.logStart)(context, `Fix angular.json`);
|
|
58
|
-
}));
|
|
59
|
-
}
|
|
60
|
-
function upgradeThirdVersion() {
|
|
61
|
-
return (tree, context) => {
|
|
62
|
-
(0, utils_1.addPackage)(tree, [`ngx-tinymce@^14.0.0`], 'dependencies');
|
|
63
|
-
(0, utils_1.logStart)(context, `Upgrade third libs (ngx-tinymce) version number`);
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function removeThird() {
|
|
67
|
-
return (tree, context) => {
|
|
68
|
-
(0, utils_1.removePackage)(tree, [`ngx-countdown`], 'dependencies');
|
|
69
|
-
(0, utils_1.removePackage)(tree, ['nz-tslint-rules', 'ng-alain-codelyzer'], 'devDependencies');
|
|
70
|
-
(0, utils_1.logStart)(context, `Remove redundant dependencies: ngx-countdown, ng-alain-codelyzer, nz-tslint-rules`);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function migrateESLint(tree, context) {
|
|
74
|
-
return (0, workspace_1.updateWorkspace)(_ => {
|
|
75
|
-
(0, utils_1.logStart)(context, `Migrate to ESLint`);
|
|
76
|
-
// 新增 .eslintignore, .eslintrc.js
|
|
77
|
-
['.eslintignore', '.eslintrc.js'].forEach(f => {
|
|
78
|
-
(0, utils_1.overwriteFile)({
|
|
79
|
-
tree,
|
|
80
|
-
filePath: f,
|
|
81
|
-
content: (0, utils_1.getFileContentInApplicationFiles)(`root/${f}`),
|
|
82
|
-
overwrite: true,
|
|
83
|
-
contentIsString: true
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
(0, utils_1.logInfo)(context, `Add .eslintignore, .eslintrc.js`);
|
|
87
|
-
// 重命名 .prettierr -> .prettierr.js 并修正内容
|
|
88
|
-
(0, utils_1.tryDelFile)(tree, '.prettierrc');
|
|
89
|
-
(0, utils_1.overwriteFile)({
|
|
90
|
-
tree,
|
|
91
|
-
filePath: '.prettierrc.js',
|
|
92
|
-
content: (0, utils_1.getFileContentInApplicationFiles)(`root/.prettierrc.js`),
|
|
93
|
-
overwrite: true,
|
|
94
|
-
contentIsString: true
|
|
95
|
-
});
|
|
96
|
-
(0, utils_1.logInfo)(context, `Rename .prettierrc -> .prettierrc.js`);
|
|
97
|
-
// 更新 .vscode/settings 的 source.fixAll.tslint 为 source.fixAll.eslint
|
|
98
|
-
const vscodeSettingFilePath = `.vscode/settings.json`;
|
|
99
|
-
if (tree.exists(vscodeSettingFilePath)) {
|
|
100
|
-
const vscodeSettingContent = (0, utils_1.readContent)(tree, vscodeSettingFilePath).replace(`source.fixAll.tslint`, `source.fixAll.eslint`);
|
|
101
|
-
(0, utils_1.writeFile)(tree, vscodeSettingFilePath, vscodeSettingContent);
|
|
102
|
-
(0, utils_1.logInfo)(context, `Update .vscode/settings`);
|
|
103
|
-
}
|
|
104
|
-
// 移除 tslint.json
|
|
105
|
-
(0, utils_1.tryDelFile)(tree, 'tslint.json');
|
|
106
|
-
(0, utils_1.logInfo)(context, `Remove tslint.json`);
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
function upgradeHusky() {
|
|
110
|
-
return (tree, context) => {
|
|
111
|
-
(0, utils_1.logStart)(context, `Upgrade husky to 6.0`);
|
|
112
|
-
const packageJson = (0, utils_1.readPackage)(tree);
|
|
113
|
-
delete packageJson.scripts['pretty-quick'];
|
|
114
|
-
delete packageJson.scripts['tslint-check'];
|
|
115
|
-
packageJson.scripts['prepare'] = 'husky install';
|
|
116
|
-
delete packageJson.devDependencies['pretty-quick'];
|
|
117
|
-
delete packageJson['husky'];
|
|
118
|
-
packageJson[code_style_1.LINT_STAGED] = code_style_1.LINT_STAGED_CONFIG;
|
|
119
|
-
['.husky/.gitignore', '.husky/pre-commit'].forEach(f => {
|
|
120
|
-
(0, utils_1.overwriteFile)({
|
|
121
|
-
tree,
|
|
122
|
-
filePath: f,
|
|
123
|
-
content: (0, utils_1.getFileContentInApplicationFiles)(`root/${f}`),
|
|
124
|
-
overwrite: true,
|
|
125
|
-
contentIsString: true
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
(0, utils_1.writePackage)(tree, packageJson);
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
function formatJson() {
|
|
132
|
-
return (tree) => {
|
|
133
|
-
const angularJson = `angular.json`;
|
|
134
|
-
const json = (0, utils_1.readJSON)(tree, angularJson);
|
|
135
|
-
(0, utils_1.writeJSON)(tree, angularJson, json);
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function finished() {
|
|
139
|
-
return (_tree, context) => {
|
|
140
|
-
context.logger.warn(colors.yellow(` ✓ After the upgrade is complete, you still need to execute \`ng lint --fix\` to fix the code format, Abort more detail please refer to upgrade guide https://ng-alain.com/docs/style-guide`));
|
|
141
|
-
context.logger.info(colors.green(` ✓ Congratulations, Abort more detail please refer to upgrade guide https://github.com/ng-alain/ng-alain/issues/2027`));
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
function v12Rule(options) {
|
|
145
|
-
return (tree, context) => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
(0, utils_1.logStart)(context, `Upgrade @delon/* version number ${JSON.stringify(options)}`);
|
|
147
|
-
(0, versions_1.UpgradeMainVersions)(tree);
|
|
148
|
-
const rules = [
|
|
149
|
-
migrateESLint(tree, context),
|
|
150
|
-
(0, versions_1.addESLintRule)(context),
|
|
151
|
-
upgradeThirdVersion(),
|
|
152
|
-
removeThird(),
|
|
153
|
-
upgradeHusky(),
|
|
154
|
-
formatJson(),
|
|
155
|
-
finished()
|
|
156
|
-
];
|
|
157
|
-
if (options.fixAngularJson !== false) {
|
|
158
|
-
rules.splice(0, 0, fixAngularJson(context));
|
|
159
|
-
}
|
|
160
|
-
return (0, schematics_1.chain)(rules);
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
exports.v12Rule = v12Rule;
|
|
164
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../schematics/ng-update/upgrade-rules/v12/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAiF;AACjF,qEAAwE;AACxE,sCAAsC;AAEtC,0CAiBwB;AACxB,0DAA4E;AAC5E,sDAA6E;AAG7E,sBAAsB;AACtB,SAAS,cAAc,CAAC,OAAyB;IAC/C,OAAO,IAAA,2BAAe,EAAC,CAAM,SAAS,EAAC,EAAE;QACvC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;YAC3C,MAAM,UAAU,GAAG;gBACjB,KAAK;gBACL,aAAa;gBACb,iBAAiB;gBACjB,gBAAgB;gBAChB,WAAW;gBACX,cAAc;gBACd,aAAa;aACd,CAAC;YACF,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,0BAAkB,CAAC,CAAC;YACtD,IAAI,KAAK,IAAI,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;YAC5E,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC;YACnC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;YACpD,MAAM,kBAAkB,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,cAAc,CAAC,UAAU,CAAC;YAC5D,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,O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