ng-alain 12.4.2 → 13.0.0-beta.1
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/src/app/layout/basic/widgets/clear-storage.component.ts +1 -1
- package/application/files/src/app/layout/basic/widgets/fullscreen.component.ts +1 -1
- package/application/files/src/app/layout/basic/widgets/i18n.component.ts +3 -0
- package/application/index.js +43 -43
- package/application/index.js.map +1 -1
- package/application/index.ts +8 -8
- package/collection.json +2 -3
- package/curd/index.js +2 -2
- package/curd/index.js.map +1 -1
- package/docs/plugin.en-US.md +0 -13
- package/docs/plugin.zh-CN.md +0 -13
- package/edit/index.js +1 -1
- package/edit/index.js.map +1 -1
- package/empty/index.js +1 -1
- package/empty/index.js.map +1 -1
- package/list/index.js +1 -1
- package/list/index.js.map +1 -1
- package/migration.json +5 -10
- package/module/index.js +18 -18
- package/module/index.js.map +1 -1
- package/ng-add/index.js +24 -26
- package/ng-add/index.js.map +1 -1
- package/ng-add/index.spec.ts +13 -3
- package/ng-add/index.ts +19 -21
- 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 +8 -13
- package/ng-update/index.js.map +1 -1
- package/ng-update/index.ts +5 -10
- package/ng-update/upgrade-data.js +3 -1
- package/ng-update/upgrade-data.js.map +1 -1
- package/ng-update/upgrade-data.ts +3 -2
- package/ng-update/upgrade-rules/checks/_src-to-nz-image-rule.js +1 -1
- package/ng-update/upgrade-rules/checks/_src-to-nz-image-rule.js.map +1 -1
- package/ng-update/upgrade-rules/v12/index.js +32 -32
- package/ng-update/upgrade-rules/v12/index.js.map +1 -1
- package/ng-update/upgrade-rules/v12/index.ts +1 -5
- package/ng-update/upgrade-rules/v13/index.js +44 -0
- package/ng-update/upgrade-rules/v13/index.js.map +1 -0
- package/ng-update/upgrade-rules/v13/index.spec.ts +26 -0
- package/ng-update/upgrade-rules/v13/index.ts +40 -0
- package/package.json +1 -1
- package/plugin/files/rtl/layout/basic/widgets/rtl.component.ts +1 -1
- package/plugin/index.js +10 -14
- package/plugin/index.js.map +1 -1
- package/plugin/index.ts +0 -4
- package/plugin/plugin.code-style.js +2 -2
- package/plugin/plugin.code-style.js.map +1 -1
- package/plugin/plugin.default-language.js +3 -3
- package/plugin/plugin.default-language.js.map +1 -1
- package/plugin/plugin.default-language.ts +1 -1
- package/plugin/plugin.docker.js +6 -6
- package/plugin/plugin.docker.js.map +1 -1
- package/plugin/plugin.icon.js +7 -7
- package/plugin/plugin.icon.js.map +1 -1
- package/plugin/plugin.icon.ts +2 -2
- package/plugin/plugin.rtl.js +11 -11
- package/plugin/plugin.rtl.js.map +1 -1
- package/plugin/plugin.sts.js +1 -1
- package/plugin/plugin.sts.js.map +1 -1
- package/schema.json +10 -0
- package/sta/index.js +13 -13
- package/sta/index.js.map +1 -1
- package/tpl/index.js +2 -2
- package/tpl/index.js.map +1 -1
- package/tpl/index.ts +1 -1
- package/utils/alain.js +17 -18
- package/utils/alain.js.map +1 -1
- package/utils/alain.ts +1 -2
- package/utils/file.js +2 -2
- package/utils/file.js.map +1 -1
- package/utils/html.js +1 -1
- package/utils/html.js.map +1 -1
- package/utils/json.js +1 -1
- package/utils/json.js.map +1 -1
- package/utils/lib-versions.js +2 -2
- package/utils/lib-versions.ts +2 -2
- package/utils/node.js +8 -0
- package/utils/node.js.map +1 -0
- package/utils/node.ts +3 -0
- package/utils/package.js +4 -4
- package/utils/package.js.map +1 -1
- package/utils/package.ts +2 -2
- package/utils/testing.js +3 -3
- package/utils/testing.js.map +1 -1
- package/utils/versions.js +20 -20
- package/utils/versions.js.map +1 -1
- package/utils/versions.ts +16 -16
- package/utils/workspace.js +5 -5
- package/utils/workspace.js.map +1 -1
- package/view/index.js +1 -1
- package/view/index.js.map +1 -1
- package/ng-update/upgrade-rules/v11/files-tpl/main.js +0 -31
- package/ng-update/upgrade-rules/v11/files-tpl/main.js.map +0 -1
- package/ng-update/upgrade-rules/v11/files-tpl/main.ts +0 -28
- package/ng-update/upgrade-rules/v11/hmr.js +0 -103
- package/ng-update/upgrade-rules/v11/hmr.js.map +0 -1
- package/ng-update/upgrade-rules/v11/hmr.ts +0 -109
- package/ng-update/upgrade-rules/v11/index.js +0 -72
- package/ng-update/upgrade-rules/v11/index.js.map +0 -1
- package/ng-update/upgrade-rules/v11/index.spec.ts +0 -51
- package/ng-update/upgrade-rules/v11/index.ts +0 -80
- package/ng-update/upgrade-rules/v11/layout.js +0 -39
- package/ng-update/upgrade-rules/v11/layout.js.map +0 -1
- package/ng-update/upgrade-rules/v11/layout.ts +0 -47
- package/ng-update/upgrade-rules/v117/index.js +0 -82
- package/ng-update/upgrade-rules/v117/index.js.map +0 -1
- package/ng-update/upgrade-rules/v117/index.spec.ts +0 -58
- package/ng-update/upgrade-rules/v117/index.ts +0 -71
- package/plugin/files/ie/tsconfig-es5.app.js +0 -9
- package/plugin/files/ie/tsconfig-es5.app.js.map +0 -1
- package/plugin/files/ie/tsconfig-es5.spec.js +0 -9
- package/plugin/files/ie/tsconfig-es5.spec.js.map +0 -1
- package/plugin/plugin.ie.js +0 -128
- package/plugin/plugin.ie.js.map +0 -1
- package/plugin/plugin.ie.spec.ts +0 -35
- package/plugin/plugin.ie.ts +0 -144
package/ng-add/index.js
CHANGED
|
@@ -3,52 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const color_1 = require("@angular/cli/utilities/color");
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
const path_1 = require("path");
|
|
8
6
|
const utils_1 = require("../utils");
|
|
9
|
-
const
|
|
7
|
+
const node_1 = require("../utils/node");
|
|
8
|
+
const V = 13;
|
|
10
9
|
function genRules(options) {
|
|
11
10
|
return () => {
|
|
12
11
|
const rules = [];
|
|
13
12
|
const applicationOptions = Object.assign({}, options);
|
|
14
|
-
rules.push(schematics_1.schematic('application', applicationOptions));
|
|
13
|
+
rules.push((0, schematics_1.schematic)('application', applicationOptions));
|
|
15
14
|
if (options.codeStyle) {
|
|
16
|
-
rules.push(schematics_1.schematic('plugin', { name: 'codeStyle', type: 'add' }));
|
|
15
|
+
rules.push((0, schematics_1.schematic)('plugin', { name: 'codeStyle', type: 'add' }));
|
|
17
16
|
}
|
|
18
17
|
if (options.defaultLanguage) {
|
|
19
|
-
rules.push(schematics_1.schematic('plugin', {
|
|
18
|
+
rules.push((0, schematics_1.schematic)('plugin', {
|
|
20
19
|
name: 'defaultLanguage',
|
|
21
20
|
type: 'add',
|
|
22
21
|
defaultLanguage: options.defaultLanguage
|
|
23
22
|
}));
|
|
24
23
|
}
|
|
25
24
|
if (options.npm) {
|
|
26
|
-
rules.push(schematics_1.schematic('plugin', {
|
|
25
|
+
rules.push((0, schematics_1.schematic)('plugin', {
|
|
27
26
|
name: 'networkEnv',
|
|
28
27
|
type: 'add',
|
|
29
28
|
packageManager: 'npm'
|
|
30
29
|
}));
|
|
31
30
|
}
|
|
32
31
|
if (options.yarn) {
|
|
33
|
-
rules.push(schematics_1.schematic('plugin', {
|
|
32
|
+
rules.push((0, schematics_1.schematic)('plugin', {
|
|
34
33
|
name: 'networkEnv',
|
|
35
34
|
type: 'add',
|
|
36
35
|
packageManager: 'yarn'
|
|
37
36
|
}));
|
|
38
37
|
}
|
|
39
|
-
return schematics_1.chain(rules);
|
|
38
|
+
return (0, schematics_1.chain)(rules);
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return [];
|
|
46
|
-
return fs_1.readdirSync(nodeModulesPath) || [];
|
|
47
|
-
}
|
|
48
|
-
function isUseCNPM() {
|
|
49
|
-
const names = getFiles();
|
|
50
|
-
const res = ['_@angular', '_ng-zorro-antd'].every(prefix => names.findIndex(w => w.startsWith(prefix)) !== -1);
|
|
51
|
-
return res;
|
|
41
|
+
function isYarn(tree) {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return ((_b = (_a = (0, utils_1.readJSON)(tree, '/angular.json')) === null || _a === void 0 ? void 0 : _a.cli) === null || _b === void 0 ? void 0 : _b.packageManager) === 'yarn';
|
|
52
44
|
}
|
|
53
45
|
function finished() {
|
|
54
46
|
return (_, context) => {
|
|
@@ -62,21 +54,27 @@ NG-ALAIN documentation site: https://ng-alain.com
|
|
|
62
54
|
}
|
|
63
55
|
function default_1(options) {
|
|
64
56
|
return (tree, context) => {
|
|
65
|
-
if (
|
|
66
|
-
|
|
57
|
+
if (!isYarn(tree)) {
|
|
58
|
+
context.logger.warn(`TIPS:: Please use yarn instead of NPM to install dependencies`);
|
|
59
|
+
}
|
|
60
|
+
const nodeVersion = (0, node_1.getNodeMajorVersion)();
|
|
61
|
+
const allowNodeVersions = [12, 14, 16];
|
|
62
|
+
if (!allowNodeVersions.some(v => nodeVersion === v)) {
|
|
63
|
+
const versions = allowNodeVersions.join(', ');
|
|
64
|
+
throw new schematics_1.SchematicsException(`Sorry, currently only supports ${versions} major version number of node (Got ${process.version}), pls refer to https://gist.github.com/LayZeeDK/c822cc812f75bb07b7c55d07ba2719b3`);
|
|
67
65
|
}
|
|
68
|
-
const pkg = utils_1.readPackage(tree);
|
|
66
|
+
const pkg = (0, utils_1.readPackage)(tree);
|
|
69
67
|
if (pkg.devDependencies['ng-alain']) {
|
|
70
|
-
throw new
|
|
68
|
+
throw new schematics_1.SchematicsException(`Already an NG-ALAIN project and can't be executed again: ng add ng-alain`);
|
|
71
69
|
}
|
|
72
70
|
let ngCoreVersion = pkg.dependencies['@angular/core'];
|
|
73
71
|
if (/^[\^|\~]/g.test(ngCoreVersion)) {
|
|
74
|
-
ngCoreVersion = ngCoreVersion.
|
|
72
|
+
ngCoreVersion = ngCoreVersion.substring(1);
|
|
75
73
|
}
|
|
76
74
|
if (!ngCoreVersion.startsWith(`${V}.`)) {
|
|
77
|
-
throw new
|
|
75
|
+
throw new schematics_1.SchematicsException(`Sorry, the current version only supports angular ${V}.x, pls downgrade the global Anguar-cli version: [yarn global add @angular/cli@${V}] (or via npm: [npm install -g @angular/cli@${V}])`);
|
|
78
76
|
}
|
|
79
|
-
return schematics_1.chain([genRules(options), finished()])(tree, context);
|
|
77
|
+
return (0, schematics_1.chain)([genRules(options), finished()])(tree, context);
|
|
80
78
|
};
|
|
81
79
|
}
|
|
82
80
|
exports.default = default_1;
|
package/ng-add/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;AAAA,wDAAsD;AAEtD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;AAAA,wDAAsD;AAEtD,2DAAiH;AACjH,4DAA0E;AAG1E,oCAAiD;AACjD,wCAAoD;AAGpD,MAAM,CAAC,GAAG,EAAE,CAAC;AAEb,SAAS,QAAQ,CAAC,OAAqB;IACrC,OAAO,GAAG,EAAE;QACV,MAAM,KAAK,GAAW,EAAE,CAAC;QAEzB,MAAM,kBAAkB,qBAA4B,OAAO,CAAE,CAAC;QAC9D,KAAK,CAAC,IAAI,CAAC,IAAA,sBAAS,EAAC,aAA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C,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC,CAAC;AACJ,CAAC;AAjCD,4BAiCC"}
|
package/ng-add/index.spec.ts
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
2
|
|
|
3
|
+
import * as nodeUtils from '../utils/node';
|
|
3
4
|
import { createAlainApp } from '../utils/testing';
|
|
4
5
|
|
|
5
6
|
describe('Schematic: ng-add', () => {
|
|
6
7
|
let runner: SchematicTestRunner;
|
|
7
8
|
let tree: UnitTestTree;
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
it('should dependencies @delon of an application', () => {
|
|
10
|
+
it('should dependencies @delon of an application', async () => {
|
|
11
|
+
({ runner, tree } = await createAlainApp());
|
|
12
12
|
const packageJson = JSON.parse(tree.readContent('package.json'));
|
|
13
13
|
expect(packageJson.dependencies['@delon/theme']).toBeDefined();
|
|
14
14
|
});
|
|
15
|
+
|
|
16
|
+
it('should throw errr when node version is not valid range', async () => {
|
|
17
|
+
spyOn(nodeUtils, 'getNodeMajorVersion').and.returnValue(10);
|
|
18
|
+
try {
|
|
19
|
+
await createAlainApp();
|
|
20
|
+
expect(true).toBe(false);
|
|
21
|
+
} catch (ex) {
|
|
22
|
+
expect(true).toBe(true);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
15
25
|
});
|
package/ng-add/index.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { colors } from '@angular/cli/utilities/color';
|
|
2
2
|
|
|
3
|
-
import { chain, Rule, schematic, Tree, SchematicContext } from '@angular-devkit/schematics';
|
|
3
|
+
import { chain, Rule, schematic, Tree, SchematicContext, SchematicsException } from '@angular-devkit/schematics';
|
|
4
4
|
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
|
|
5
|
-
import { readdirSync, statSync } from 'fs';
|
|
6
|
-
import { join } from 'path';
|
|
7
5
|
|
|
8
6
|
import { Schema as ApplicationOptions } from '../application/schema';
|
|
9
|
-
import { readPackage } from '../utils';
|
|
7
|
+
import { readJSON, readPackage } from '../utils';
|
|
8
|
+
import { getNodeMajorVersion } from '../utils/node';
|
|
10
9
|
import { Schema as NgAddOptions } from './schema';
|
|
11
10
|
|
|
12
|
-
const V =
|
|
11
|
+
const V = 13;
|
|
13
12
|
|
|
14
13
|
function genRules(options: NgAddOptions): Rule {
|
|
15
14
|
return () => {
|
|
@@ -56,16 +55,8 @@ function genRules(options: NgAddOptions): Rule {
|
|
|
56
55
|
};
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
if (!statSync(nodeModulesPath).isDirectory()) return [];
|
|
62
|
-
return readdirSync(nodeModulesPath) || [];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function isUseCNPM(): boolean {
|
|
66
|
-
const names = getFiles();
|
|
67
|
-
const res = ['_@angular', '_ng-zorro-antd'].every(prefix => names.findIndex(w => w.startsWith(prefix)) !== -1);
|
|
68
|
-
return res;
|
|
58
|
+
function isYarn(tree: Tree): boolean {
|
|
59
|
+
return readJSON(tree, '/angular.json')?.cli?.packageManager === 'yarn';
|
|
69
60
|
}
|
|
70
61
|
|
|
71
62
|
function finished(): Rule {
|
|
@@ -84,24 +75,31 @@ NG-ALAIN documentation site: https://ng-alain.com
|
|
|
84
75
|
|
|
85
76
|
export default function (options: NgAddOptions): Rule {
|
|
86
77
|
return (tree: Tree, context: SchematicContext) => {
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
78
|
+
if (!isYarn(tree)) {
|
|
79
|
+
context.logger.warn(`TIPS:: Please use yarn instead of NPM to install dependencies`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const nodeVersion = getNodeMajorVersion();
|
|
83
|
+
const allowNodeVersions = [12, 14, 16];
|
|
84
|
+
if (!allowNodeVersions.some(v => nodeVersion === v)) {
|
|
85
|
+
const versions = allowNodeVersions.join(', ');
|
|
86
|
+
throw new SchematicsException(
|
|
87
|
+
`Sorry, currently only supports ${versions} major version number of node (Got ${process.version}), pls refer to https://gist.github.com/LayZeeDK/c822cc812f75bb07b7c55d07ba2719b3`
|
|
90
88
|
);
|
|
91
89
|
}
|
|
92
90
|
|
|
93
91
|
const pkg = readPackage(tree);
|
|
94
92
|
|
|
95
93
|
if (pkg.devDependencies['ng-alain']) {
|
|
96
|
-
throw new
|
|
94
|
+
throw new SchematicsException(`Already an NG-ALAIN project and can't be executed again: ng add ng-alain`);
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
let ngCoreVersion = pkg.dependencies['@angular/core'] as string;
|
|
100
98
|
if (/^[\^|\~]/g.test(ngCoreVersion)) {
|
|
101
|
-
ngCoreVersion = ngCoreVersion.
|
|
99
|
+
ngCoreVersion = ngCoreVersion.substring(1);
|
|
102
100
|
}
|
|
103
101
|
if (!ngCoreVersion.startsWith(`${V}.`)) {
|
|
104
|
-
throw new
|
|
102
|
+
throw new SchematicsException(
|
|
105
103
|
`Sorry, the current version only supports angular ${V}.x, pls downgrade the global Anguar-cli version: [yarn global add @angular/cli@${V}] (or via npm: [npm install -g @angular/cli@${V}])`
|
|
106
104
|
);
|
|
107
105
|
}
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.attributeSelectors = void 0;
|
|
4
4
|
const schematics_1 = require("@angular/cdk/schematics");
|
|
5
5
|
exports.attributeSelectors = {
|
|
6
|
-
[schematics_1.TargetVersion.
|
|
6
|
+
[schematics_1.TargetVersion.V13]: []
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=attribute-selectors.js.map
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.classNames = void 0;
|
|
4
4
|
const schematics_1 = require("@angular/cdk/schematics");
|
|
5
5
|
exports.classNames = {
|
|
6
|
-
[schematics_1.TargetVersion.
|
|
6
|
+
[schematics_1.TargetVersion.V13]: []
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=class-names.js.map
|
|
@@ -8,6 +8,6 @@ const schematics_1 = require("@angular/cdk/schematics");
|
|
|
8
8
|
* automatically through type checking.
|
|
9
9
|
*/
|
|
10
10
|
exports.constructorChecks = {
|
|
11
|
-
[schematics_1.TargetVersion.
|
|
11
|
+
[schematics_1.TargetVersion.V13]: []
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=constructor-checks.js.map
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.cssSelectors = void 0;
|
|
4
4
|
const schematics_1 = require("@angular/cdk/schematics");
|
|
5
5
|
exports.cssSelectors = {
|
|
6
|
-
[schematics_1.TargetVersion.
|
|
6
|
+
[schematics_1.TargetVersion.V13]: []
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=css-selectors.js.map
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.elementSelectors = void 0;
|
|
4
4
|
const schematics_1 = require("@angular/cdk/schematics");
|
|
5
5
|
exports.elementSelectors = {
|
|
6
|
-
[schematics_1.TargetVersion.
|
|
6
|
+
[schematics_1.TargetVersion.V13]: []
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=element-selectors.js.map
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.inputNames = void 0;
|
|
4
4
|
const schematics_1 = require("@angular/cdk/schematics");
|
|
5
5
|
exports.inputNames = {
|
|
6
|
-
[schematics_1.TargetVersion.
|
|
6
|
+
[schematics_1.TargetVersion.V13]: []
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=input-names.js.map
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.methodCallChecks = void 0;
|
|
4
4
|
const schematics_1 = require("@angular/cdk/schematics");
|
|
5
5
|
exports.methodCallChecks = {
|
|
6
|
-
[schematics_1.TargetVersion.
|
|
6
|
+
[schematics_1.TargetVersion.V13]: []
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=method-call-checks.js.map
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.outputNames = void 0;
|
|
4
4
|
const schematics_1 = require("@angular/cdk/schematics");
|
|
5
5
|
exports.outputNames = {
|
|
6
|
-
[schematics_1.TargetVersion.
|
|
6
|
+
[schematics_1.TargetVersion.V13]: []
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=output-names.js.map
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.propertyNames = void 0;
|
|
4
4
|
const schematics_1 = require("@angular/cdk/schematics");
|
|
5
5
|
exports.propertyNames = {
|
|
6
|
-
[schematics_1.TargetVersion.
|
|
6
|
+
[schematics_1.TargetVersion.V13]: []
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=property-names.js.map
|
package/ng-update/index.js
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.postUpdate = exports.
|
|
3
|
+
exports.postUpdate = exports.updateToV13 = exports.updateToV12 = void 0;
|
|
4
4
|
const schematics_1 = require("@angular/cdk/schematics");
|
|
5
5
|
const schematics_2 = require("@angular-devkit/schematics");
|
|
6
6
|
const upgrade_data_1 = require("./upgrade-data");
|
|
7
7
|
const _src_to_nz_image_rule_1 = require("./upgrade-rules/checks/_src-to-nz-image-rule");
|
|
8
|
-
const v11_1 = require("./upgrade-rules/v11");
|
|
9
|
-
const v117_1 = require("./upgrade-rules/v117");
|
|
10
8
|
const v12_1 = require("./upgrade-rules/v12");
|
|
9
|
+
const v13_1 = require("./upgrade-rules/v13");
|
|
11
10
|
const migrations = [_src_to_nz_image_rule_1.SrcToNzImageRule];
|
|
12
|
-
function updateToV11() {
|
|
13
|
-
return schematics_2.chain([v11_1.v11Rule]);
|
|
14
|
-
}
|
|
15
|
-
exports.updateToV11 = updateToV11;
|
|
16
|
-
function updateToV117() {
|
|
17
|
-
return schematics_2.chain([v117_1.v117Rule]);
|
|
18
|
-
}
|
|
19
|
-
exports.updateToV117 = updateToV117;
|
|
20
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
12
|
function updateToV12(schema) {
|
|
22
|
-
const rule = v12_1.v12Rule(schema);
|
|
23
|
-
return schematics_2.chain([rule, schematics_1.createMigrationSchematicRule(schematics_1.TargetVersion.V12, migrations, upgrade_data_1.ruleUpgradeData, postUpdate)]);
|
|
13
|
+
const rule = (0, v12_1.v12Rule)(schema);
|
|
14
|
+
return (0, schematics_2.chain)([rule, (0, schematics_1.createMigrationSchematicRule)(schematics_1.TargetVersion.V12, migrations, upgrade_data_1.ruleUpgradeData, postUpdate)]);
|
|
24
15
|
}
|
|
25
16
|
exports.updateToV12 = updateToV12;
|
|
17
|
+
function updateToV13() {
|
|
18
|
+
return (0, schematics_2.chain)([(0, v13_1.v13Rule)(), (0, schematics_1.createMigrationSchematicRule)(schematics_1.TargetVersion.V13, migrations, upgrade_data_1.ruleUpgradeData, postUpdate)]);
|
|
19
|
+
}
|
|
20
|
+
exports.updateToV13 = updateToV13;
|
|
26
21
|
/** Post-update schematic to be called when update is finished. */
|
|
27
22
|
function postUpdate(context, targetVersion, hasFailures) {
|
|
28
23
|
context.logger.info('');
|
package/ng-update/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-update/index.ts"],"names":[],"mappings":";;;AAAA,wDAA+G;AAE/G,2DAA2E;AAE3E,iDAAiD;AACjD,wFAAgF;AAChF,6CAA8C;AAC9C
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-update/index.ts"],"names":[],"mappings":";;;AAAA,wDAA+G;AAE/G,2DAA2E;AAE3E,iDAAiD;AACjD,wFAAgF;AAChF,6CAA8C;AAC9C,6CAA8C;AAE9C,MAAM,UAAU,GAA8B,CAAC,wCAAgB,CAAC,CAAC;AAEjE,8DAA8D;AAC9D,SAAgB,WAAW,CAAC,MAAW;IACrC,MAAM,IAAI,GAAG,IAAA,aAAO,EAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,IAAA,kBAAK,EAAC,CAAC,IAAI,EAAE,IAAA,yCAA4B,EAAC,0BAAa,CAAC,GAAG,EAAE,UAAU,EAAE,8BAAe,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;AACjH,CAAC;AAHD,kCAGC;AAED,SAAgB,WAAW;IACzB,OAAO,IAAA,kBAAK,EAAC,CAAC,IAAA,aAAO,GAAE,EAAE,IAAA,yCAA4B,EAAC,0BAAa,CAAC,GAAG,EAAE,UAAU,EAAE,8BAAe,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;AACtH,CAAC;AAFD,kCAEC;AAED,kEAAkE;AAClE,SAAgB,UAAU,CAAC,OAAyB,EAAE,aAA4B,EAAE,WAAoB;IACtG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,aAAa,EAAE,CAAC,CAAC;IACjE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAExB,IAAI,WAAW,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,IAAI,CACjB,wFAAwF;YACtF,6CAA6C,CAChD,CAAC;KACH;AACH,CAAC;AAXD,gCAWC"}
|
package/ng-update/index.ts
CHANGED
|
@@ -4,26 +4,21 @@ import { chain, Rule, SchematicContext } from '@angular-devkit/schematics';
|
|
|
4
4
|
|
|
5
5
|
import { ruleUpgradeData } from './upgrade-data';
|
|
6
6
|
import { SrcToNzImageRule } from './upgrade-rules/checks/_src-to-nz-image-rule';
|
|
7
|
-
import { v11Rule } from './upgrade-rules/v11';
|
|
8
|
-
import { v117Rule } from './upgrade-rules/v117';
|
|
9
7
|
import { v12Rule } from './upgrade-rules/v12';
|
|
8
|
+
import { v13Rule } from './upgrade-rules/v13';
|
|
10
9
|
|
|
11
10
|
const migrations: NullableDevkitMigration[] = [SrcToNzImageRule];
|
|
12
11
|
|
|
13
|
-
export function updateToV11(): Rule {
|
|
14
|
-
return chain([v11Rule]);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function updateToV117(): Rule {
|
|
18
|
-
return chain([v117Rule]);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
13
|
export function updateToV12(schema: any): Rule {
|
|
23
14
|
const rule = v12Rule(schema);
|
|
24
15
|
return chain([rule, createMigrationSchematicRule(TargetVersion.V12, migrations, ruleUpgradeData, postUpdate)]);
|
|
25
16
|
}
|
|
26
17
|
|
|
18
|
+
export function updateToV13(): Rule {
|
|
19
|
+
return chain([v13Rule(), createMigrationSchematicRule(TargetVersion.V13, migrations, ruleUpgradeData, postUpdate)]);
|
|
20
|
+
}
|
|
21
|
+
|
|
27
22
|
/** Post-update schematic to be called when update is finished. */
|
|
28
23
|
export function postUpdate(context: SchematicContext, targetVersion: TargetVersion, hasFailures: boolean): void {
|
|
29
24
|
context.logger.info('');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ruleUpgradeData = void 0;
|
|
4
|
+
const schematics_1 = require("@angular/cdk/schematics");
|
|
4
5
|
const data_1 = require("./data");
|
|
5
6
|
exports.ruleUpgradeData = {
|
|
6
7
|
attributeSelectors: data_1.attributeSelectors,
|
|
@@ -11,6 +12,7 @@ exports.ruleUpgradeData = {
|
|
|
11
12
|
inputNames: data_1.inputNames,
|
|
12
13
|
methodCallChecks: data_1.methodCallChecks,
|
|
13
14
|
outputNames: data_1.outputNames,
|
|
14
|
-
propertyNames: data_1.propertyNames
|
|
15
|
+
propertyNames: data_1.propertyNames,
|
|
16
|
+
symbolRemoval: schematics_1.symbolRemoval
|
|
15
17
|
};
|
|
16
18
|
//# sourceMappingURL=upgrade-data.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-data.js","sourceRoot":"","sources":["../../../schematics/ng-update/upgrade-data.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"upgrade-data.js","sourceRoot":"","sources":["../../../schematics/ng-update/upgrade-data.ts"],"names":[],"mappings":";;;AAAA,wDAAqE;AAErE,iCAUgB;AAEH,QAAA,eAAe,GAAgB;IAC1C,kBAAkB,EAAlB,yBAAkB;IAClB,UAAU,EAAV,iBAAU;IACV,iBAAiB,EAAjB,wBAAiB;IACjB,YAAY,EAAZ,mBAAY;IACZ,gBAAgB,EAAhB,uBAAgB;IAChB,UAAU,EAAV,iBAAU;IACV,gBAAgB,EAAhB,uBAAgB;IAChB,WAAW,EAAX,kBAAW;IACX,aAAa,EAAb,oBAAa;IACb,aAAa,EAAb,0BAAa;CACd,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UpgradeData } from '@angular/cdk/schematics';
|
|
1
|
+
import { symbolRemoval, UpgradeData } from '@angular/cdk/schematics';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
attributeSelectors,
|
|
@@ -21,5 +21,6 @@ export const ruleUpgradeData: UpgradeData = {
|
|
|
21
21
|
inputNames,
|
|
22
22
|
methodCallChecks,
|
|
23
23
|
outputNames,
|
|
24
|
-
propertyNames
|
|
24
|
+
propertyNames,
|
|
25
|
+
symbolRemoval
|
|
25
26
|
};
|
|
@@ -9,7 +9,7 @@ class SrcToNzImageRule extends schematics_1.Migration {
|
|
|
9
9
|
}
|
|
10
10
|
visitTemplate(template) {
|
|
11
11
|
const deprecatedComponent = (deprecated) => {
|
|
12
|
-
schematics_1.findInputsOnElementWithAttr(template.content, '_src', [deprecated]).forEach(offset => {
|
|
12
|
+
(0, schematics_1.findInputsOnElementWithAttr)(template.content, '_src', [deprecated]).forEach(offset => {
|
|
13
13
|
this.failures.push({
|
|
14
14
|
filePath: template.filePath,
|
|
15
15
|
position: template.getCharacterAndLineOfPosition(offset),
|
|
@@ -1 +1 @@
|
|
|
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,wCAA2B,
|
|
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"}
|