ng-alain 12.4.0 → 13.0.0-beta.2
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/application/schema.json +1 -1
- package/collection.json +2 -3
- package/curd/index.js +2 -2
- package/curd/index.js.map +1 -1
- package/curd/schema.json +34 -27
- package/docs/generate.en-US.md +7 -7
- package/docs/generate.zh-CN.md +7 -7
- 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/edit/schema.json +2 -7
- package/empty/index.js +1 -1
- package/empty/index.js.map +1 -1
- package/empty/schema.json +2 -7
- package/list/index.js +1 -1
- package/list/index.js.map +1 -1
- package/list/schema.json +2 -7
- package/migration.json +5 -10
- package/module/index.js +18 -18
- package/module/index.js.map +1 -1
- package/module/schema.json +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-add/schema.json +1 -1
- 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/v12/schema.json +1 -1
- package/ng-update/upgrade-rules/v13/index.js +56 -0
- package/ng-update/upgrade-rules/v13/index.js.map +1 -0
- package/ng-update/upgrade-rules/v13/index.spec.ts +32 -0
- package/ng-update/upgrade-rules/v13/index.ts +51 -0
- package/package.json +2 -2
- 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/plugin/schema.json +1 -1
- package/schema.json +10 -0
- package/sta/index.js +13 -13
- package/sta/index.js.map +1 -1
- package/sta/schema.json +1 -1
- package/tpl/index.js +2 -2
- package/tpl/index.js.map +1 -1
- package/tpl/index.ts +1 -1
- package/tpl/schema.json +3 -8
- 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/log.js +3 -3
- package/utils/log.js.map +1 -1
- package/utils/log.ts +3 -3
- 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 +21 -20
- package/utils/versions.js.map +1 -1
- package/utils/versions.ts +17 -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/view/schema.json +2 -7
- 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/view/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/view/index.ts"],"names":[],"mappings":";;AAAA,2DAAyD;AAEzD,oCAAsC;AAGtC,mBAAyB,OAAe;IACtC,OAAO,kBAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/view/index.ts"],"names":[],"mappings":";;AAAA,2DAAyD;AAEzD,oCAAsC;AAGtC,mBAAyB,OAAe;IACtC,OAAO,IAAA,kBAAK,EAAC,CAAC,IAAA,kBAAU,kBAAG,aAAa,EAAE,MAAM,IAAK,OAAO,EAAG,CAAC,CAAC,CAAC;AACpE,CAAC;AAFD,4BAEC"}
|
package/view/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "SchematicsNgAlainViewComponent",
|
|
4
4
|
"title": "Ng Alain View Component Options Schema",
|
|
5
5
|
"type": "object",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"description": "Include template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file.",
|
|
45
45
|
"type": "boolean",
|
|
46
46
|
"default": false,
|
|
47
|
+
"alias": "t",
|
|
47
48
|
"x-user-analytics": 10
|
|
48
49
|
},
|
|
49
50
|
"viewEncapsulation": {
|
|
@@ -119,12 +120,6 @@
|
|
|
119
120
|
"description": "The declaring NgModule exports this component.",
|
|
120
121
|
"x-user-analytics": 19
|
|
121
122
|
},
|
|
122
|
-
"lintFix": {
|
|
123
|
-
"type": "boolean",
|
|
124
|
-
"description": "Apply lint fixes after generating the component.",
|
|
125
|
-
"x-user-analytics": 15,
|
|
126
|
-
"x-deprecated": "Use \"ng lint --fix\" directly instead."
|
|
127
|
-
},
|
|
128
123
|
"withoutPrefix": {
|
|
129
124
|
"type": "boolean",
|
|
130
125
|
"description": "组件名不加前缀 (Without prefix to selectors)",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = `import { enableProdMode, ViewEncapsulation } from '@angular/core';
|
|
4
|
-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
5
|
-
import { preloaderFinished } from '@delon/theme';
|
|
6
|
-
import { NzSafeAny } from 'ng-zorro-antd/core/types';
|
|
7
|
-
|
|
8
|
-
import { AppModule } from './app/app.module';
|
|
9
|
-
import { environment } from './environments/environment';
|
|
10
|
-
|
|
11
|
-
preloaderFinished();
|
|
12
|
-
|
|
13
|
-
if (environment.production) {
|
|
14
|
-
enableProdMode();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
platformBrowserDynamic()
|
|
18
|
-
.bootstrapModule(AppModule, {
|
|
19
|
-
defaultEncapsulation: ViewEncapsulation.Emulated,
|
|
20
|
-
preserveWhitespaces: false,
|
|
21
|
-
})
|
|
22
|
-
.then((res) => {
|
|
23
|
-
const win = window as NzSafeAny;
|
|
24
|
-
if (win && win.appBootstrap) {
|
|
25
|
-
win.appBootstrap();
|
|
26
|
-
}
|
|
27
|
-
return res;
|
|
28
|
-
})
|
|
29
|
-
.catch((err) => console.error(err));
|
|
30
|
-
`;
|
|
31
|
-
//# sourceMappingURL=main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../../../schematics/ng-update/upgrade-rules/v11/files-tpl/main.ts"],"names":[],"mappings":";;AAAA,kBAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Bd,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export default `import { enableProdMode, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
3
|
-
import { preloaderFinished } from '@delon/theme';
|
|
4
|
-
import { NzSafeAny } from 'ng-zorro-antd/core/types';
|
|
5
|
-
|
|
6
|
-
import { AppModule } from './app/app.module';
|
|
7
|
-
import { environment } from './environments/environment';
|
|
8
|
-
|
|
9
|
-
preloaderFinished();
|
|
10
|
-
|
|
11
|
-
if (environment.production) {
|
|
12
|
-
enableProdMode();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
platformBrowserDynamic()
|
|
16
|
-
.bootstrapModule(AppModule, {
|
|
17
|
-
defaultEncapsulation: ViewEncapsulation.Emulated,
|
|
18
|
-
preserveWhitespaces: false,
|
|
19
|
-
})
|
|
20
|
-
.then((res) => {
|
|
21
|
-
const win = window as NzSafeAny;
|
|
22
|
-
if (win && win.appBootstrap) {
|
|
23
|
-
win.appBootstrap();
|
|
24
|
-
}
|
|
25
|
-
return res;
|
|
26
|
-
})
|
|
27
|
-
.catch((err) => console.error(err));
|
|
28
|
-
`;
|
|
@@ -1,103 +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.fixHmr = void 0;
|
|
13
|
-
const core_1 = require("@angular-devkit/core");
|
|
14
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
15
|
-
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
16
|
-
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
17
|
-
const ts = require("typescript");
|
|
18
|
-
const utils_1 = require("../../../utils");
|
|
19
|
-
const main_1 = require("./files-tpl/main");
|
|
20
|
-
function removeHmrOfAngularJson(context) {
|
|
21
|
-
return workspace_1.updateWorkspace((workspace) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
workspace.projects.forEach(project => {
|
|
23
|
-
[utils_1.BUILD_TARGET_BUILD, utils_1.BUILD_TARGET_SERVE]
|
|
24
|
-
.filter(targetName => !!project.targets.get(targetName).configurations)
|
|
25
|
-
.forEach(targetName => {
|
|
26
|
-
delete project.targets.get(targetName).configurations.hmr;
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
utils_1.logInfo(context, `Remove '@angularclass/hmr'`);
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
function removeHmrInEnt(sourceRoot, name) {
|
|
33
|
-
return (tree) => {
|
|
34
|
-
const src = core_1.normalize(`${sourceRoot}/environments/${name}`);
|
|
35
|
-
if (!tree.exists(src))
|
|
36
|
-
return;
|
|
37
|
-
const source = utils_1.getSourceFile(tree, src);
|
|
38
|
-
const hmrNode = ast_utils_1.findNode(source, ts.SyntaxKind.Identifier, 'hmr');
|
|
39
|
-
if (hmrNode == null || hmrNode.parent == null || hmrNode.parent.kind !== ts.SyntaxKind.PropertyAssignment) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const content = utils_1.readContent(tree, src);
|
|
43
|
-
const prefix = content.substring(0, hmrNode.pos);
|
|
44
|
-
const suffix = content.substring(hmrNode.parent.end);
|
|
45
|
-
tree.overwrite(src, `${prefix}${suffix}`.replace(/,,/g, ','));
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function removeHmrTs(sourceRoot) {
|
|
49
|
-
return (tree, context) => {
|
|
50
|
-
// 删除 `environment.hmr.ts`
|
|
51
|
-
const environmentHmrTsPath = core_1.normalize(`${sourceRoot}/environments/environment.hmr.ts`);
|
|
52
|
-
if (tree.exists(environmentHmrTsPath)) {
|
|
53
|
-
tree.delete(environmentHmrTsPath);
|
|
54
|
-
}
|
|
55
|
-
utils_1.logInfo(context, `Removed 'environments.hmr.ts' file`);
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function fixPackage() {
|
|
59
|
-
return (tree, context) => {
|
|
60
|
-
const packageJson = utils_1.readPackage(tree);
|
|
61
|
-
delete packageJson.devDependencies['@angularclass/hmr'];
|
|
62
|
-
if (packageJson.scripts.hmr) {
|
|
63
|
-
packageJson.scripts.hmr = packageJson.scripts.hmr.replace(`-c=hmr`, `--hmr`);
|
|
64
|
-
}
|
|
65
|
-
utils_1.writePackage(tree, packageJson);
|
|
66
|
-
utils_1.logInfo(context, `'-c=hmr' instead of '--hmr' in package.json`);
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function fixMainTs(hmrTsPath, sourceRoot) {
|
|
70
|
-
return (tree, context) => {
|
|
71
|
-
tree.delete(hmrTsPath);
|
|
72
|
-
tree.overwrite(core_1.normalize(`${sourceRoot}/main.ts`), main_1.default);
|
|
73
|
-
utils_1.logInfo(context, `Modify 'main.ts' and remove 'hmr.ts' file`);
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function fixHmr(sourceRoot) {
|
|
77
|
-
return (tree, context) => {
|
|
78
|
-
utils_1.logStart(context, `Using built-in hmr instead of '@angularclass/hmr'`);
|
|
79
|
-
// 检查是否存在 `hmr.ts` 文件作为是否已经安装 hmr 的前提条件
|
|
80
|
-
const hmrTsPath = core_1.normalize(`${sourceRoot}/hmr.ts`);
|
|
81
|
-
if (!tree.exists(hmrTsPath)) {
|
|
82
|
-
utils_1.logWarn(context, `Ingored the part migration when not found '${hmrTsPath}'`);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
return schematics_1.chain([
|
|
86
|
-
// 1、移除所有 `@angularclass/hmr` 的引用
|
|
87
|
-
removeHmrOfAngularJson(context),
|
|
88
|
-
// 2、移除 angular.json 里面的 hmr 配置项,以及 environments 下相关的 hmr 配置
|
|
89
|
-
utils_1.removeAllowedCommonJsDependencies('@angularclass/hmr'),
|
|
90
|
-
// 移除 `environments.ts` 的 `hmr: false`
|
|
91
|
-
removeHmrInEnt(sourceRoot, 'environment.prod.ts'),
|
|
92
|
-
removeHmrInEnt(sourceRoot, 'environment.ts'),
|
|
93
|
-
// 删除 `environment.hmr.ts`
|
|
94
|
-
removeHmrTs(sourceRoot),
|
|
95
|
-
// 3、修改 package.json 命令行 `-c=hmr` 为 `--hmr`
|
|
96
|
-
fixPackage(),
|
|
97
|
-
// 4、修改 `main.ts` 并移除 `hmr.ts` 文件
|
|
98
|
-
fixMainTs(hmrTsPath, sourceRoot)
|
|
99
|
-
]);
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
exports.fixHmr = fixHmr;
|
|
103
|
-
//# sourceMappingURL=hmr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hmr.js","sourceRoot":"","sources":["../../../../../schematics/ng-update/upgrade-rules/v11/hmr.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAiD;AACjD,2DAAiF;AACjF,qEAAiE;AACjE,qEAAwE;AACxE,iCAAiC;AAEjC,0CAWwB;AACxB,2CAA2C;AAE3C,SAAS,sBAAsB,CAAC,OAAyB;IACvD,OAAO,2BAAe,CAAC,CAAM,SAAS,EAAC,EAAE;QACvC,SAAS,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,gBAAS,CAAC,GAAG,UAAU,UAAU,CAAC,EAAE,cAAW,CAAC,CAAC;QAChE,eAAO,CAAC,OAAO,EAAE,2CAA2C,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,MAAM,CAAC,UAAkB;IACvC,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,gBAAQ,CAAC,OAAO,EAAE,mDAAmD,CAAC,CAAC;QAEvE,uCAAuC;QACvC,MAAM,SAAS,GAAG,gBAAS,CAAC,GAAG,UAAU,SAAS,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YAC3B,eAAO,CAAC,OAAO,EAAE,8CAA8C,SAAS,GAAG,CAAC,CAAC;YAC7E,OAAO;SACR;QACD,OAAO,kBAAK,CAAC;YACX,iCAAiC;YACjC,sBAAsB,CAAC,OAAO,CAAC;YAC/B,4DAA4D;YAC5D,yCAAiC,CAAC,mBAAmB,CAAC;YACtD,sCAAsC;YACtC,cAAc,CAAC,UAAU,EAAE,qBAAqB,CAAC;YACjD,cAAc,CAAC,UAAU,EAAE,gBAAgB,CAAC;YAC5C,0BAA0B;YAC1B,WAAW,CAAC,UAAU,CAAC;YACvB,2CAA2C;YAC3C,UAAU,EAAE;YACZ,iCAAiC;YACjC,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC;SACjC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AA1BD,wBA0BC"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { normalize } from '@angular-devkit/core';
|
|
2
|
-
import { chain, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
3
|
-
import { findNode } from '@schematics/angular/utility/ast-utils';
|
|
4
|
-
import { updateWorkspace } from '@schematics/angular/utility/workspace';
|
|
5
|
-
import * as ts from 'typescript';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
BUILD_TARGET_BUILD,
|
|
9
|
-
BUILD_TARGET_SERVE,
|
|
10
|
-
getSourceFile,
|
|
11
|
-
logInfo,
|
|
12
|
-
logStart,
|
|
13
|
-
logWarn,
|
|
14
|
-
readContent,
|
|
15
|
-
readPackage,
|
|
16
|
-
removeAllowedCommonJsDependencies,
|
|
17
|
-
writePackage
|
|
18
|
-
} from '../../../utils';
|
|
19
|
-
import mainContent from './files-tpl/main';
|
|
20
|
-
|
|
21
|
-
function removeHmrOfAngularJson(context: SchematicContext): Rule {
|
|
22
|
-
return updateWorkspace(async workspace => {
|
|
23
|
-
workspace.projects.forEach(project => {
|
|
24
|
-
[BUILD_TARGET_BUILD, BUILD_TARGET_SERVE]
|
|
25
|
-
.filter(targetName => !!project.targets.get(targetName).configurations)
|
|
26
|
-
.forEach(targetName => {
|
|
27
|
-
delete project.targets.get(targetName).configurations.hmr;
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
logInfo(context, `Remove '@angularclass/hmr'`);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function removeHmrInEnt(sourceRoot: string, name: string): Rule {
|
|
35
|
-
return (tree: Tree) => {
|
|
36
|
-
const src = normalize(`${sourceRoot}/environments/${name}`);
|
|
37
|
-
if (!tree.exists(src)) return;
|
|
38
|
-
|
|
39
|
-
const source = getSourceFile(tree, src);
|
|
40
|
-
const hmrNode = findNode(source, ts.SyntaxKind.Identifier, 'hmr');
|
|
41
|
-
if (hmrNode == null || hmrNode.parent == null || hmrNode.parent.kind !== ts.SyntaxKind.PropertyAssignment) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const content = readContent(tree, src);
|
|
46
|
-
const prefix = content.substring(0, hmrNode.pos);
|
|
47
|
-
const suffix = content.substring(hmrNode.parent.end);
|
|
48
|
-
tree.overwrite(src, `${prefix}${suffix}`.replace(/,,/g, ','));
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function removeHmrTs(sourceRoot: string): Rule {
|
|
53
|
-
return (tree: Tree, context: SchematicContext) => {
|
|
54
|
-
// 删除 `environment.hmr.ts`
|
|
55
|
-
const environmentHmrTsPath = normalize(`${sourceRoot}/environments/environment.hmr.ts`);
|
|
56
|
-
if (tree.exists(environmentHmrTsPath)) {
|
|
57
|
-
tree.delete(environmentHmrTsPath);
|
|
58
|
-
}
|
|
59
|
-
logInfo(context, `Removed 'environments.hmr.ts' file`);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function fixPackage(): Rule {
|
|
64
|
-
return (tree: Tree, context: SchematicContext) => {
|
|
65
|
-
const packageJson = readPackage(tree);
|
|
66
|
-
delete packageJson.devDependencies['@angularclass/hmr'];
|
|
67
|
-
if (packageJson.scripts.hmr) {
|
|
68
|
-
packageJson.scripts.hmr = (packageJson.scripts.hmr as string).replace(`-c=hmr`, `--hmr`);
|
|
69
|
-
}
|
|
70
|
-
writePackage(tree, packageJson);
|
|
71
|
-
logInfo(context, `'-c=hmr' instead of '--hmr' in package.json`);
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function fixMainTs(hmrTsPath: string, sourceRoot: string): Rule {
|
|
76
|
-
return (tree: Tree, context: SchematicContext) => {
|
|
77
|
-
tree.delete(hmrTsPath);
|
|
78
|
-
tree.overwrite(normalize(`${sourceRoot}/main.ts`), mainContent);
|
|
79
|
-
logInfo(context, `Modify 'main.ts' and remove 'hmr.ts' file`);
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function fixHmr(sourceRoot: string): Rule {
|
|
84
|
-
return (tree: Tree, context: SchematicContext) => {
|
|
85
|
-
logStart(context, `Using built-in hmr instead of '@angularclass/hmr'`);
|
|
86
|
-
|
|
87
|
-
// 检查是否存在 `hmr.ts` 文件作为是否已经安装 hmr 的前提条件
|
|
88
|
-
const hmrTsPath = normalize(`${sourceRoot}/hmr.ts`);
|
|
89
|
-
if (!tree.exists(hmrTsPath)) {
|
|
90
|
-
logWarn(context, `Ingored the part migration when not found '${hmrTsPath}'`);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
return chain([
|
|
94
|
-
// 1、移除所有 `@angularclass/hmr` 的引用
|
|
95
|
-
removeHmrOfAngularJson(context),
|
|
96
|
-
// 2、移除 angular.json 里面的 hmr 配置项,以及 environments 下相关的 hmr 配置
|
|
97
|
-
removeAllowedCommonJsDependencies('@angularclass/hmr'),
|
|
98
|
-
// 移除 `environments.ts` 的 `hmr: false`
|
|
99
|
-
removeHmrInEnt(sourceRoot, 'environment.prod.ts'),
|
|
100
|
-
removeHmrInEnt(sourceRoot, 'environment.ts'),
|
|
101
|
-
// 删除 `environment.hmr.ts`
|
|
102
|
-
removeHmrTs(sourceRoot),
|
|
103
|
-
// 3、修改 package.json 命令行 `-c=hmr` 为 `--hmr`
|
|
104
|
-
fixPackage(),
|
|
105
|
-
// 4、修改 `main.ts` 并移除 `hmr.ts` 文件
|
|
106
|
-
fixMainTs(hmrTsPath, sourceRoot)
|
|
107
|
-
]);
|
|
108
|
-
};
|
|
109
|
-
}
|
|
@@ -1,72 +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.v11Rule = void 0;
|
|
13
|
-
const color_1 = require("@angular/cli/utilities/color");
|
|
14
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
15
|
-
const utils_1 = require("../../../utils");
|
|
16
|
-
const versions_1 = require("../../../utils/versions");
|
|
17
|
-
const hmr_1 = require("./hmr");
|
|
18
|
-
const layout_1 = require("./layout");
|
|
19
|
-
let project;
|
|
20
|
-
function fixVersion() {
|
|
21
|
-
return (tree, context) => {
|
|
22
|
-
versions_1.UpgradeMainVersions(tree);
|
|
23
|
-
utils_1.logStart(context, `Upgrade @delon/* version number`);
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function fixThirdVersion() {
|
|
27
|
-
return (tree, context) => {
|
|
28
|
-
// dependencies
|
|
29
|
-
utils_1.addPackage(tree, [
|
|
30
|
-
`ng-zorro-antd@^12.0.1`,
|
|
31
|
-
`ngx-ueditor@^12.0.0`,
|
|
32
|
-
`ngx-tinymce@^12.0.0`,
|
|
33
|
-
`ngx-countdown@^12.0.1`,
|
|
34
|
-
'ajv@^8.6.2'
|
|
35
|
-
], 'dependencies');
|
|
36
|
-
// dependencies
|
|
37
|
-
utils_1.addPackage(tree, [`ng-alain-plugin-theme@^12.0.0`, `ng-alain-sts@^0.0.1`], 'devDependencies');
|
|
38
|
-
utils_1.logStart(context, `Upgrade third libs version number`);
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function fixAnalyze() {
|
|
42
|
-
return (tree, context) => {
|
|
43
|
-
const packageJson = utils_1.readPackage(tree);
|
|
44
|
-
delete packageJson.devDependencies['webpack-bundle-analyzer'];
|
|
45
|
-
packageJson.devDependencies['source-map-explorer'] = '^2.5.1';
|
|
46
|
-
if (packageJson.scripts.analyze) {
|
|
47
|
-
packageJson.scripts.analyze = packageJson.scripts.analyze.replace(`--stats-json`, `--source-map`);
|
|
48
|
-
packageJson.scripts['analyze:view'] = `source-map-explorer dist/**/*.js`;
|
|
49
|
-
}
|
|
50
|
-
utils_1.logStart(context, `Usd source-map-explorer instead of webpack-bundle-analyzer`);
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function finished() {
|
|
54
|
-
return (_tree, context) => {
|
|
55
|
-
context.logger.info(color_1.colors.green(` ✓ Congratulations, Abort more detail please refer to upgrade guide https://github.com/ng-alain/ng-alain/issues/1863`));
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function v11Rule() {
|
|
59
|
-
return (tree) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
project = (yield utils_1.getProject(tree)).project;
|
|
61
|
-
return schematics_1.chain([
|
|
62
|
-
fixVersion(),
|
|
63
|
-
fixThirdVersion(),
|
|
64
|
-
fixAnalyze(),
|
|
65
|
-
hmr_1.fixHmr(project.sourceRoot),
|
|
66
|
-
layout_1.fixLayout(project),
|
|
67
|
-
finished()
|
|
68
|
-
]);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
exports.v11Rule = v11Rule;
|
|
72
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../schematics/ng-update/upgrade-rules/v11/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wDAAsD;AAGtD,2DAAiF;AAEjF,0CAAwF;AACxF,sDAA8D;AAC9D,+BAA+B;AAC/B,qCAAqC;AAErC,IAAI,OAA0B,CAAC;AAE/B,SAAS,UAAU;IACjB,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,8BAAmB,CAAC,IAAI,CAAC,CAAC;QAC1B,gBAAQ,CAAC,OAAO,EAAE,iCAAiC,CAAC,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,eAAe;QACf,kBAAU,CACR,IAAI,EACJ;YACE,qCAAqC;YACrC,mCAAmC;YACnC,mCAAmC;YACnC,qCAAqC;YACrC,2BAA2B;SAC5B,EACD,cAAc,CACf,C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YAClB,QAAQ,EAAE;SACX,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC;AAbD,0BAaC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
-
|
|
3
|
-
import { createAlainApp, FILE_PREFIX, migrationCollection } from '../../../utils/testing';
|
|
4
|
-
|
|
5
|
-
describe('Schematic: ng-update: v11Rule', () => {
|
|
6
|
-
let runner: SchematicTestRunner;
|
|
7
|
-
let tree: UnitTestTree;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
({ runner, tree } = await createAlainApp());
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
async function runMigration(): Promise<void> {
|
|
14
|
-
runner = new SchematicTestRunner('schematics', migrationCollection);
|
|
15
|
-
await runner.runSchematicAsync('migration-v11', {}, tree).toPromise();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
it(`should be can't migrate when 'hmr.ts' not found`, async () => {
|
|
19
|
-
const hmrTsPath = `${FILE_PREFIX}/src/hmr.ts`;
|
|
20
|
-
expect(tree.exists(hmrTsPath)).toBe(false);
|
|
21
|
-
await runMigration();
|
|
22
|
-
expect(tree.exists(hmrTsPath)).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe('', () => {
|
|
26
|
-
beforeEach(() => {
|
|
27
|
-
tree.create(`${FILE_PREFIX}/src/hmr.ts`, '');
|
|
28
|
-
tree.overwrite(
|
|
29
|
-
`${FILE_PREFIX}/src/environments/environment.prod.ts`,
|
|
30
|
-
`
|
|
31
|
-
// This file can be replaced during build b
|
|
32
|
-
|
|
33
|
-
export const environment = {
|
|
34
|
-
SERVER_URL: '/',
|
|
35
|
-
production: false,
|
|
36
|
-
hmr: false,
|
|
37
|
-
useHash: true,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
|
41
|
-
|
|
42
|
-
`
|
|
43
|
-
);
|
|
44
|
-
});
|
|
45
|
-
it('should working', async () => {
|
|
46
|
-
await runMigration();
|
|
47
|
-
const content = tree.readContent(`${FILE_PREFIX}/src/environments/environment.prod.ts`);
|
|
48
|
-
expect(content.includes('hmr: false')).toBe(false);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { colors } from '@angular/cli/utilities/color';
|
|
2
|
-
|
|
3
|
-
import { ProjectDefinition } from '@angular-devkit/core/src/workspace';
|
|
4
|
-
import { chain, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
5
|
-
|
|
6
|
-
import { addPackage, getProject, logStart, readPackage, VERSION } from '../../../utils';
|
|
7
|
-
import { UpgradeMainVersions } from '../../../utils/versions';
|
|
8
|
-
import { fixHmr } from './hmr';
|
|
9
|
-
import { fixLayout } from './layout';
|
|
10
|
-
|
|
11
|
-
let project: ProjectDefinition;
|
|
12
|
-
|
|
13
|
-
function fixVersion(): Rule {
|
|
14
|
-
return (tree: Tree, context: SchematicContext) => {
|
|
15
|
-
UpgradeMainVersions(tree);
|
|
16
|
-
logStart(context, `Upgrade @delon/* version number`);
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function fixThirdVersion(): Rule {
|
|
21
|
-
return (tree: Tree, context: SchematicContext) => {
|
|
22
|
-
// dependencies
|
|
23
|
-
addPackage(
|
|
24
|
-
tree,
|
|
25
|
-
[
|
|
26
|
-
`ng-zorro-antd@^12.0.1`,
|
|
27
|
-
`ngx-ueditor@^12.0.0`,
|
|
28
|
-
`ngx-tinymce@^12.0.0`,
|
|
29
|
-
`ngx-countdown@^12.0.1`,
|
|
30
|
-
'ajv@^8.6.2'
|
|
31
|
-
],
|
|
32
|
-
'dependencies'
|
|
33
|
-
);
|
|
34
|
-
// dependencies
|
|
35
|
-
addPackage(
|
|
36
|
-
tree,
|
|
37
|
-
[`ng-alain-plugin-theme@^12.0.0`, `ng-alain-sts@^0.0.1`],
|
|
38
|
-
'devDependencies'
|
|
39
|
-
);
|
|
40
|
-
logStart(context, `Upgrade third libs version number`);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function fixAnalyze(): Rule {
|
|
45
|
-
return (tree: Tree, context: SchematicContext) => {
|
|
46
|
-
const packageJson = readPackage(tree);
|
|
47
|
-
delete packageJson.devDependencies['webpack-bundle-analyzer'];
|
|
48
|
-
packageJson.devDependencies['source-map-explorer'] = '^2.5.1';
|
|
49
|
-
if (packageJson.scripts.analyze) {
|
|
50
|
-
packageJson.scripts.analyze = (packageJson.scripts.analyze as string).replace(`--stats-json`, `--source-map`);
|
|
51
|
-
packageJson.scripts['analyze:view'] = `source-map-explorer dist/**/*.js`;
|
|
52
|
-
}
|
|
53
|
-
logStart(context, `Usd source-map-explorer instead of webpack-bundle-analyzer`);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function finished(): Rule {
|
|
58
|
-
return (_tree: Tree, context: SchematicContext) => {
|
|
59
|
-
context.logger.info(
|
|
60
|
-
colors.green(
|
|
61
|
-
` ✓ Congratulations, Abort more detail please refer to upgrade guide https://github.com/ng-alain/ng-alain/issues/1863`
|
|
62
|
-
)
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function v11Rule(): Rule {
|
|
68
|
-
return async (tree: Tree) => {
|
|
69
|
-
project = (await getProject(tree)).project;
|
|
70
|
-
|
|
71
|
-
return chain([
|
|
72
|
-
fixVersion(),
|
|
73
|
-
fixThirdVersion(),
|
|
74
|
-
fixAnalyze(),
|
|
75
|
-
fixHmr(project.sourceRoot),
|
|
76
|
-
fixLayout(project),
|
|
77
|
-
finished()
|
|
78
|
-
]);
|
|
79
|
-
};
|
|
80
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fixLayout = void 0;
|
|
4
|
-
const core_1 = require("@angular-devkit/core");
|
|
5
|
-
const utils_1 = require("../../../utils");
|
|
6
|
-
let project;
|
|
7
|
-
let tree;
|
|
8
|
-
let context;
|
|
9
|
-
function upgradeStylePath() {
|
|
10
|
-
const stylesLessPath = core_1.normalize(`${project.sourceRoot}/styles.less`);
|
|
11
|
-
if (!tree.exists(stylesLessPath)) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
// 更新样式引入路径
|
|
15
|
-
const stylesLessContent = utils_1.readContent(tree, stylesLessPath)
|
|
16
|
-
.replace(`~@delon/theme/layout/default/index`, `~@delon/theme/layout-default/style/index`)
|
|
17
|
-
.replace(`~@delon/theme/layout/fullscreen/index`, `~@delon/theme/layout-blank/style/index`);
|
|
18
|
-
tree.overwrite(stylesLessPath, stylesLessContent);
|
|
19
|
-
utils_1.logInfo(context, `Update style import path`);
|
|
20
|
-
// 修改 fullscreen 的样式
|
|
21
|
-
const fullscreenComponentPath = core_1.normalize(`${project.sourceRoot}/app/layout/fullscreen/fullscreen.component.ts`);
|
|
22
|
-
if (!tree.exists(fullscreenComponentPath)) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const fullscreenComponentContent = utils_1.readContent(tree, fullscreenComponentPath).replace(`alain-fullscreen`, `alain-blank`);
|
|
26
|
-
tree.overwrite(fullscreenComponentPath, fullscreenComponentContent);
|
|
27
|
-
utils_1.logInfo(context, `Update alain-fullscreen to alain-blank`);
|
|
28
|
-
}
|
|
29
|
-
function fixLayout(p) {
|
|
30
|
-
return (t, c) => {
|
|
31
|
-
project = p;
|
|
32
|
-
tree = t;
|
|
33
|
-
context = c;
|
|
34
|
-
utils_1.logStart(context, `Use @delon/theme/layout instead`);
|
|
35
|
-
upgradeStylePath();
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
exports.fixLayout = fixLayout;
|
|
39
|
-
//# sourceMappingURL=layout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../../../schematics/ng-update/upgrade-rules/v11/layout.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AAIjD,0CAAgE;AAEhE,IAAI,OAA0B,CAAC;AAC/B,IAAI,IAAU,CAAC;AACf,IAAI,OAAyB,CAAC;AAE9B,SAAS,gBAAgB;IACvB,MAAM,cAAc,GAAG,gBAAS,CAAC,GAAG,OAAO,CAAC,UAAU,cAAc,CAAC,CAAC;IACtE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;QAChC,OAAO;KACR;IAED,WAAW;IACX,MAAM,iBAAiB,GAAG,mBAAW,CAAC,IAAI,EAAE,cAAc,CAAC;SACxD,OAAO,CAAC,oCAAoC,EAAE,0CAA0C,CAAC;SACzF,OAAO,CAAC,uCAAuC,EAAE,wCAAwC,CAAC,CAAC;IAC9F,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;IAClD,eAAO,CAAC,OAAO,EAAE,0BAA0B,CAAC,CAAC;IAE7C,oBAAoB;IACpB,MAAM,uBAAuB,GAAG,gBAAS,CAAC,GAAG,OAAO,CAAC,UAAU,gDAAgD,CAAC,CAAC;IACjH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,EAAE;QACzC,OAAO;KACR;IACD,MAAM,0BAA0B,GAAG,mBAAW,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC,OAAO,CACnF,kBAAkB,EAClB,aAAa,CACd,CAAC;IACF,IAAI,CAAC,SAAS,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,CAAC;IACpE,eAAO,CAAC,OAAO,EAAE,wCAAwC,CAAC,CAAC;AAC7D,CAAC;AAED,SAAgB,SAAS,CAAC,CAAoB;IAC5C,OAAO,CAAC,CAAO,EAAE,CAAmB,EAAE,EAAE;QACtC,OAAO,GAAG,CAAC,CAAC;QACZ,IAAI,GAAG,CAAC,CAAC;QACT,OAAO,GAAG,CAAC,CAAC;QAEZ,gBAAQ,CAAC,OAAO,EAAE,iCAAiC,CAAC,CAAC;QAErD,gBAAgB,EAAE,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC;AAVD,8BAUC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { normalize } from '@angular-devkit/core';
|
|
2
|
-
import { ProjectDefinition } from '@angular-devkit/core/src/workspace';
|
|
3
|
-
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
4
|
-
|
|
5
|
-
import { logInfo, logStart, readContent } from '../../../utils';
|
|
6
|
-
|
|
7
|
-
let project: ProjectDefinition;
|
|
8
|
-
let tree: Tree;
|
|
9
|
-
let context: SchematicContext;
|
|
10
|
-
|
|
11
|
-
function upgradeStylePath(): void {
|
|
12
|
-
const stylesLessPath = normalize(`${project.sourceRoot}/styles.less`);
|
|
13
|
-
if (!tree.exists(stylesLessPath)) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// 更新样式引入路径
|
|
18
|
-
const stylesLessContent = readContent(tree, stylesLessPath)
|
|
19
|
-
.replace(`~@delon/theme/layout/default/index`, `~@delon/theme/layout-default/style/index`)
|
|
20
|
-
.replace(`~@delon/theme/layout/fullscreen/index`, `~@delon/theme/layout-blank/style/index`);
|
|
21
|
-
tree.overwrite(stylesLessPath, stylesLessContent);
|
|
22
|
-
logInfo(context, `Update style import path`);
|
|
23
|
-
|
|
24
|
-
// 修改 fullscreen 的样式
|
|
25
|
-
const fullscreenComponentPath = normalize(`${project.sourceRoot}/app/layout/fullscreen/fullscreen.component.ts`);
|
|
26
|
-
if (!tree.exists(fullscreenComponentPath)) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const fullscreenComponentContent = readContent(tree, fullscreenComponentPath).replace(
|
|
30
|
-
`alain-fullscreen`,
|
|
31
|
-
`alain-blank`
|
|
32
|
-
);
|
|
33
|
-
tree.overwrite(fullscreenComponentPath, fullscreenComponentContent);
|
|
34
|
-
logInfo(context, `Update alain-fullscreen to alain-blank`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function fixLayout(p: ProjectDefinition): Rule {
|
|
38
|
-
return (t: Tree, c: SchematicContext) => {
|
|
39
|
-
project = p;
|
|
40
|
-
tree = t;
|
|
41
|
-
context = c;
|
|
42
|
-
|
|
43
|
-
logStart(context, `Use @delon/theme/layout instead`);
|
|
44
|
-
|
|
45
|
-
upgradeStylePath();
|
|
46
|
-
};
|
|
47
|
-
}
|