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.
Files changed (150) hide show
  1. package/application/files/src/app/layout/basic/widgets/clear-storage.component.ts +1 -1
  2. package/application/files/src/app/layout/basic/widgets/fullscreen.component.ts +1 -1
  3. package/application/files/src/app/layout/basic/widgets/i18n.component.ts +3 -0
  4. package/application/index.js +43 -43
  5. package/application/index.js.map +1 -1
  6. package/application/index.ts +8 -8
  7. package/application/schema.json +1 -1
  8. package/collection.json +2 -3
  9. package/curd/index.js +2 -2
  10. package/curd/index.js.map +1 -1
  11. package/curd/schema.json +34 -27
  12. package/docs/generate.en-US.md +7 -7
  13. package/docs/generate.zh-CN.md +7 -7
  14. package/docs/plugin.en-US.md +0 -13
  15. package/docs/plugin.zh-CN.md +0 -13
  16. package/edit/index.js +1 -1
  17. package/edit/index.js.map +1 -1
  18. package/edit/schema.json +2 -7
  19. package/empty/index.js +1 -1
  20. package/empty/index.js.map +1 -1
  21. package/empty/schema.json +2 -7
  22. package/list/index.js +1 -1
  23. package/list/index.js.map +1 -1
  24. package/list/schema.json +2 -7
  25. package/migration.json +5 -10
  26. package/module/index.js +18 -18
  27. package/module/index.js.map +1 -1
  28. package/module/schema.json +1 -1
  29. package/ng-add/index.js +24 -26
  30. package/ng-add/index.js.map +1 -1
  31. package/ng-add/index.spec.ts +13 -3
  32. package/ng-add/index.ts +19 -21
  33. package/ng-add/schema.json +1 -1
  34. package/ng-update/data/attribute-selectors.js +1 -1
  35. package/ng-update/data/attribute-selectors.ts +1 -1
  36. package/ng-update/data/class-names.js +1 -1
  37. package/ng-update/data/class-names.ts +1 -1
  38. package/ng-update/data/constructor-checks.js +1 -1
  39. package/ng-update/data/constructor-checks.ts +1 -1
  40. package/ng-update/data/css-selectors.js +1 -1
  41. package/ng-update/data/css-selectors.ts +1 -1
  42. package/ng-update/data/element-selectors.js +1 -1
  43. package/ng-update/data/element-selectors.ts +1 -1
  44. package/ng-update/data/input-names.js +1 -1
  45. package/ng-update/data/input-names.ts +1 -1
  46. package/ng-update/data/method-call-checks.js +1 -1
  47. package/ng-update/data/method-call-checks.ts +1 -1
  48. package/ng-update/data/output-names.js +1 -1
  49. package/ng-update/data/output-names.ts +1 -1
  50. package/ng-update/data/property-names.js +1 -1
  51. package/ng-update/data/property-names.ts +1 -1
  52. package/ng-update/index.js +8 -13
  53. package/ng-update/index.js.map +1 -1
  54. package/ng-update/index.ts +5 -10
  55. package/ng-update/upgrade-data.js +3 -1
  56. package/ng-update/upgrade-data.js.map +1 -1
  57. package/ng-update/upgrade-data.ts +3 -2
  58. package/ng-update/upgrade-rules/checks/_src-to-nz-image-rule.js +1 -1
  59. package/ng-update/upgrade-rules/checks/_src-to-nz-image-rule.js.map +1 -1
  60. package/ng-update/upgrade-rules/v12/index.js +32 -32
  61. package/ng-update/upgrade-rules/v12/index.js.map +1 -1
  62. package/ng-update/upgrade-rules/v12/index.ts +1 -5
  63. package/ng-update/upgrade-rules/v12/schema.json +1 -1
  64. package/ng-update/upgrade-rules/v13/index.js +56 -0
  65. package/ng-update/upgrade-rules/v13/index.js.map +1 -0
  66. package/ng-update/upgrade-rules/v13/index.spec.ts +32 -0
  67. package/ng-update/upgrade-rules/v13/index.ts +51 -0
  68. package/package.json +2 -2
  69. package/plugin/files/rtl/layout/basic/widgets/rtl.component.ts +1 -1
  70. package/plugin/index.js +10 -14
  71. package/plugin/index.js.map +1 -1
  72. package/plugin/index.ts +0 -4
  73. package/plugin/plugin.code-style.js +2 -2
  74. package/plugin/plugin.code-style.js.map +1 -1
  75. package/plugin/plugin.default-language.js +3 -3
  76. package/plugin/plugin.default-language.js.map +1 -1
  77. package/plugin/plugin.default-language.ts +1 -1
  78. package/plugin/plugin.docker.js +6 -6
  79. package/plugin/plugin.docker.js.map +1 -1
  80. package/plugin/plugin.icon.js +7 -7
  81. package/plugin/plugin.icon.js.map +1 -1
  82. package/plugin/plugin.icon.ts +2 -2
  83. package/plugin/plugin.rtl.js +11 -11
  84. package/plugin/plugin.rtl.js.map +1 -1
  85. package/plugin/plugin.sts.js +1 -1
  86. package/plugin/plugin.sts.js.map +1 -1
  87. package/plugin/schema.json +1 -1
  88. package/schema.json +10 -0
  89. package/sta/index.js +13 -13
  90. package/sta/index.js.map +1 -1
  91. package/sta/schema.json +1 -1
  92. package/tpl/index.js +2 -2
  93. package/tpl/index.js.map +1 -1
  94. package/tpl/index.ts +1 -1
  95. package/tpl/schema.json +3 -8
  96. package/utils/alain.js +17 -18
  97. package/utils/alain.js.map +1 -1
  98. package/utils/alain.ts +1 -2
  99. package/utils/file.js +2 -2
  100. package/utils/file.js.map +1 -1
  101. package/utils/html.js +1 -1
  102. package/utils/html.js.map +1 -1
  103. package/utils/json.js +1 -1
  104. package/utils/json.js.map +1 -1
  105. package/utils/lib-versions.js +2 -2
  106. package/utils/lib-versions.ts +2 -2
  107. package/utils/log.js +3 -3
  108. package/utils/log.js.map +1 -1
  109. package/utils/log.ts +3 -3
  110. package/utils/node.js +8 -0
  111. package/utils/node.js.map +1 -0
  112. package/utils/node.ts +3 -0
  113. package/utils/package.js +4 -4
  114. package/utils/package.js.map +1 -1
  115. package/utils/package.ts +2 -2
  116. package/utils/testing.js +3 -3
  117. package/utils/testing.js.map +1 -1
  118. package/utils/versions.js +21 -20
  119. package/utils/versions.js.map +1 -1
  120. package/utils/versions.ts +17 -16
  121. package/utils/workspace.js +5 -5
  122. package/utils/workspace.js.map +1 -1
  123. package/view/index.js +1 -1
  124. package/view/index.js.map +1 -1
  125. package/view/schema.json +2 -7
  126. package/ng-update/upgrade-rules/v11/files-tpl/main.js +0 -31
  127. package/ng-update/upgrade-rules/v11/files-tpl/main.js.map +0 -1
  128. package/ng-update/upgrade-rules/v11/files-tpl/main.ts +0 -28
  129. package/ng-update/upgrade-rules/v11/hmr.js +0 -103
  130. package/ng-update/upgrade-rules/v11/hmr.js.map +0 -1
  131. package/ng-update/upgrade-rules/v11/hmr.ts +0 -109
  132. package/ng-update/upgrade-rules/v11/index.js +0 -72
  133. package/ng-update/upgrade-rules/v11/index.js.map +0 -1
  134. package/ng-update/upgrade-rules/v11/index.spec.ts +0 -51
  135. package/ng-update/upgrade-rules/v11/index.ts +0 -80
  136. package/ng-update/upgrade-rules/v11/layout.js +0 -39
  137. package/ng-update/upgrade-rules/v11/layout.js.map +0 -1
  138. package/ng-update/upgrade-rules/v11/layout.ts +0 -47
  139. package/ng-update/upgrade-rules/v117/index.js +0 -82
  140. package/ng-update/upgrade-rules/v117/index.js.map +0 -1
  141. package/ng-update/upgrade-rules/v117/index.spec.ts +0 -58
  142. package/ng-update/upgrade-rules/v117/index.ts +0 -71
  143. package/plugin/files/ie/tsconfig-es5.app.js +0 -9
  144. package/plugin/files/ie/tsconfig-es5.app.js.map +0 -1
  145. package/plugin/files/ie/tsconfig-es5.spec.js +0 -9
  146. package/plugin/files/ie/tsconfig-es5.spec.js.map +0 -1
  147. package/plugin/plugin.ie.js +0 -128
  148. package/plugin/plugin.ie.js.map +0 -1
  149. package/plugin/plugin.ie.spec.ts +0 -35
  150. package/plugin/plugin.ie.ts +0 -144
@@ -1,82 +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.v117Rule = void 0;
13
- const schematics_1 = require("@angular-devkit/schematics");
14
- const workspace_1 = require("@schematics/angular/utility/workspace");
15
- const utils_1 = require("../../../utils");
16
- const versions_1 = require("../../../utils/versions");
17
- function removeAjvLib(context) {
18
- return workspace_1.updateWorkspace((workspace) => __awaiter(this, void 0, void 0, function* () {
19
- workspace.projects.forEach(project => {
20
- [utils_1.BUILD_TARGET_BUILD, utils_1.BUILD_TARGET_TEST].forEach(targetName => {
21
- var _a, _b;
22
- const targetOptions = (_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.get(targetName)) === null || _b === void 0 ? void 0 : _b.options;
23
- if (!targetOptions) {
24
- return;
25
- }
26
- // options
27
- const scripts = targetOptions.scripts;
28
- const ajvJsPath = `node_modules/ajv/dist/ajv.bundle.js`;
29
- if (Array.isArray(scripts)) {
30
- const idx = scripts.findIndex(w => w === ajvJsPath);
31
- if (idx !== -1) {
32
- scripts.splice(idx, 1);
33
- }
34
- }
35
- // add allowedCommonJsDependencies
36
- if (targetName === utils_1.BUILD_TARGET_BUILD) {
37
- let allowedCommonJsDependencies = targetOptions.allowedCommonJsDependencies;
38
- if (!Array.isArray(allowedCommonJsDependencies)) {
39
- allowedCommonJsDependencies = [];
40
- }
41
- allowedCommonJsDependencies.push(`ajv`);
42
- allowedCommonJsDependencies.push(`ajv-formats`);
43
- targetOptions.allowedCommonJsDependencies = allowedCommonJsDependencies;
44
- }
45
- });
46
- });
47
- utils_1.logInfo(context, `Remove ajv lib`);
48
- }));
49
- }
50
- function removeQriousLib(context) {
51
- return workspace_1.updateWorkspace((workspace) => __awaiter(this, void 0, void 0, function* () {
52
- workspace.projects.forEach(project => {
53
- [utils_1.BUILD_TARGET_BUILD, utils_1.BUILD_TARGET_TEST].forEach(targetName => {
54
- var _a, _b;
55
- const targetOptions = (_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.get(targetName)) === null || _b === void 0 ? void 0 : _b.options;
56
- if (!targetOptions) {
57
- return;
58
- }
59
- // options
60
- const scripts = targetOptions.scripts;
61
- const removePath = `node_modules/qrious/dist/qrious.min.js`;
62
- if (Array.isArray(scripts)) {
63
- const idx = scripts.findIndex(w => w === removePath);
64
- if (idx !== -1) {
65
- scripts.splice(idx, 1);
66
- }
67
- }
68
- });
69
- });
70
- utils_1.logInfo(context, `Remove qrious lib`);
71
- }));
72
- }
73
- function v117Rule() {
74
- return (tree, context) => __awaiter(this, void 0, void 0, function* () {
75
- versions_1.UpgradeMainVersions(tree);
76
- utils_1.logStart(context, `Upgrade @delon/* version number`);
77
- utils_1.removePackage(tree, ['qrious'], 'dependencies');
78
- return schematics_1.chain([removeAjvLib(context), removeQriousLib(context)]);
79
- });
80
- }
81
- exports.v117Rule = v117Rule;
82
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../schematics/ng-update/upgrade-rules/v117/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAiF;AACjF,qEAAwE;AAExE,0CAAyG;AACzG,sDAA8D;AAE9D,SAAS,YAAY,CAAC,OAAyB;IAC7C,OAAO,2BAAe,CAAC,CAAM,SAAS,EAAC,EAAE;QACvC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACnC,CAAC,0BAAkB,EAAE,yBAAiB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;;gBAC3D,MAAM,aAAa,GAAG,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,GAAG,CAAC,UAAU,CAAC,0CAAE,OAAO,CAAC;gBAChE,IAAI,CAAC,aAAa,EAAE;oBAClB,OAAO;iBACR;gBACD,UAAU;gBACV,MAAM,OAAO,GAAG,aAAa,CAAC,OAA4C,CAAC;gBAC3E,MAAM,SAAS,GAAG,qCAAqC,CAAC;gBACxD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;oBAC1B,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;oBACpD,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;wBACd,OAAO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AK,CAAC,CAAC,EAAE;wBACd,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;qBACxB;iBACF;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,eAAO,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;IACxC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,QAAQ;IACtB,OAAO,CAAO,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,8BAAmB,CAAC,IAAI,CAAC,CAAC;QAC1B,gBAAQ,CAAC,OAAO,EAAE,iCAAiC,CAAC,CAAC;QACrD,qBAAa,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC;QAChD,OAAO,kBAAK,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC,CAAA,CAAC;AACJ,CAAC;AAPD,4BAOC"}
@@ -1,58 +0,0 @@
1
- import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
2
-
3
- import { createAlainApp, migrationCollection } from '../../../utils/testing';
4
-
5
- describe('Schematic: ng-update: v117Rule', () => {
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-v117', {}, tree).toPromise();
16
- }
17
-
18
- it(`should be working`, async () => {
19
- const filePath = `/angular.json`;
20
- tree.overwrite(
21
- filePath,
22
- `{
23
- "version": 1,
24
- "newProjectRoot": "projects",
25
- "projects": {
26
- "ng-alain": {
27
- "projectType": "application",
28
- "root": "",
29
- "sourceRoot": "src",
30
- "prefix": "app",
31
- "schematics": {
32
- "@schematics/angular:component": {
33
- "style": "less"
34
- }
35
- },
36
- "architect": {
37
- "build": {
38
- "options": {
39
- "scripts": ["node_modules/ajv/dist/ajv.bundle.js", "node_modules/qrious/dist/qrious.min.js"]
40
- }
41
- },
42
- "test": {
43
- "options": {
44
- "scripts": ["node_modules/ajv/dist/ajv.bundle.js", "node_modules/qrious/dist/qrious.min.js"]
45
- }
46
- }
47
- }
48
- }
49
- }
50
- }`
51
- );
52
- await runMigration();
53
- const content = tree.readContent(filePath);
54
- expect(content).toContain(`allowedCommonJsDependencies`);
55
- expect(content).not.toContain(`ajv.bundle.js`);
56
- expect(content).not.toContain(`qrious.min.js`);
57
- });
58
- });
@@ -1,71 +0,0 @@
1
- import { chain, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
2
- import { updateWorkspace } from '@schematics/angular/utility/workspace';
3
-
4
- import { BUILD_TARGET_BUILD, BUILD_TARGET_TEST, logInfo, logStart, removePackage } from '../../../utils';
5
- import { UpgradeMainVersions } from '../../../utils/versions';
6
-
7
- function removeAjvLib(context: SchematicContext): Rule {
8
- return updateWorkspace(async workspace => {
9
- workspace.projects.forEach(project => {
10
- [BUILD_TARGET_BUILD, BUILD_TARGET_TEST].forEach(targetName => {
11
- const targetOptions = project.targets?.get(targetName)?.options;
12
- if (!targetOptions) {
13
- return;
14
- }
15
- // options
16
- const scripts = targetOptions.scripts as Array<string | { input: string }>;
17
- const ajvJsPath = `node_modules/ajv/dist/ajv.bundle.js`;
18
- if (Array.isArray(scripts)) {
19
- const idx = scripts.findIndex(w => w === ajvJsPath);
20
- if (idx !== -1) {
21
- scripts.splice(idx, 1);
22
- }
23
- }
24
-
25
- // add allowedCommonJsDependencies
26
- if (targetName === BUILD_TARGET_BUILD) {
27
- let allowedCommonJsDependencies = targetOptions.allowedCommonJsDependencies as string[];
28
- if (!Array.isArray(allowedCommonJsDependencies)) {
29
- allowedCommonJsDependencies = [];
30
- }
31
- allowedCommonJsDependencies.push(`ajv`);
32
- allowedCommonJsDependencies.push(`ajv-formats`);
33
- targetOptions.allowedCommonJsDependencies = allowedCommonJsDependencies;
34
- }
35
- });
36
- });
37
- logInfo(context, `Remove ajv lib`);
38
- });
39
- }
40
-
41
- function removeQriousLib(context: SchematicContext): Rule {
42
- return updateWorkspace(async workspace => {
43
- workspace.projects.forEach(project => {
44
- [BUILD_TARGET_BUILD, BUILD_TARGET_TEST].forEach(targetName => {
45
- const targetOptions = project.targets?.get(targetName)?.options;
46
- if (!targetOptions) {
47
- return;
48
- }
49
- // options
50
- const scripts = targetOptions.scripts as Array<string | { input: string }>;
51
- const removePath = `node_modules/qrious/dist/qrious.min.js`;
52
- if (Array.isArray(scripts)) {
53
- const idx = scripts.findIndex(w => w === removePath);
54
- if (idx !== -1) {
55
- scripts.splice(idx, 1);
56
- }
57
- }
58
- });
59
- });
60
- logInfo(context, `Remove qrious lib`);
61
- });
62
- }
63
-
64
- export function v117Rule(): Rule {
65
- return async (tree: Tree, context: SchematicContext) => {
66
- UpgradeMainVersions(tree);
67
- logStart(context, `Upgrade @delon/* version number`);
68
- removePackage(tree, ['qrious'], 'dependencies');
69
- return chain([removeAjvLib(context), removeQriousLib(context)]);
70
- };
71
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- extends: './tsconfig.app.json',
5
- compilerOptions: {
6
- target: 'es5',
7
- },
8
- };
9
- //# sourceMappingURL=tsconfig-es5.app.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tsconfig-es5.app.js","sourceRoot":"","sources":["../../../../../schematics/plugin/files/ie/tsconfig-es5.app.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,OAAO,EAAE,qBAAqB;IAC9B,eAAe,EAAE;QACf,MAAM,EAAE,KAAK;KACd;CACF,CAAC"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- extends: './tsconfig.spec.json',
5
- compilerOptions: {
6
- target: 'es5',
7
- },
8
- };
9
- //# sourceMappingURL=tsconfig-es5.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tsconfig-es5.spec.js","sourceRoot":"","sources":["../../../../../schematics/plugin/files/ie/tsconfig-es5.spec.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,OAAO,EAAE,sBAAsB;IAC/B,eAAe,EAAE;QACf,MAAM,EAAE,KAAK;KACd;CACF,CAAC"}
@@ -1,128 +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.pluginIE = 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 tsconfig_es5_app_1 = require("./files/ie/tsconfig-es5.app");
18
- const tsconfig_es5_spec_1 = require("./files/ie/tsconfig-es5.spec");
19
- let project;
20
- function setAngularJson(options) {
21
- return workspace_1.updateWorkspace((workspace) => __awaiter(this, void 0, void 0, function* () {
22
- const p = utils_1.getProjectFromWorkspace(workspace, options.project);
23
- if (options.type === 'add') {
24
- p.targets.get(utils_1.BUILD_TARGET_BUILD).configurations.es5 = { tsConfig: './tsconfig-es5.app.json' };
25
- p.targets.get(utils_1.BUILD_TARGET_SERVE).configurations.es5 = {
26
- browserTarget: `${options.project}:${utils_1.BUILD_TARGET_BUILD}:es5`
27
- };
28
- p.targets.get(utils_1.BUILD_TARGET_TEST).configurations = {
29
- es5: { tsConfig: './tsconfig-es5.app.json' }
30
- };
31
- }
32
- else {
33
- [utils_1.BUILD_TARGET_BUILD, utils_1.BUILD_TARGET_SERVE, utils_1.BUILD_TARGET_TEST]
34
- .map(key => p.targets.get(key))
35
- .filter(item => !!item)
36
- .forEach(item => {
37
- delete item.configurations.es5;
38
- });
39
- }
40
- }));
41
- }
42
- function setBrowserslist(options) {
43
- return (tree) => {
44
- const filePath = `${options.root}/.browserslistrc`;
45
- let content = utils_1.readContent(tree, filePath);
46
- if (options.type === 'add') {
47
- content = content.replace(`not IE 11`, `IE 11`);
48
- }
49
- else {
50
- content = content.replace(`IE 11`, `not IE 11`);
51
- }
52
- utils_1.overwriteFile({ tree, filePath, content, overwrite: true, contentIsString: true });
53
- };
54
- }
55
- function setPackage(options) {
56
- return (tree) => {
57
- // libs
58
- (options.type === 'add' ? utils_1.addPackage : utils_1.removePackage)(tree, ['classlist.js@^1.1.0', 'web-animations-js@^2.3.2'], 'dependencies');
59
- // scripts
60
- (options.type === 'add' ? utils_1.addPackage : utils_1.removePackage)(tree, ['ie:start@ng serve -o --configuration es5', 'ie:hmr@ng serve --hmr --configuration es5'], 'scripts');
61
- };
62
- }
63
- function setPolyfills(options) {
64
- return (tree) => {
65
- const filePath = `${project.sourceRoot}/polyfills.ts`;
66
- let content = '';
67
- if (options.type === 'add') {
68
- content = `import 'core-js/modules/es.array.includes';
69
- import 'classlist.js';
70
- import 'web-animations-js';
71
- import 'zone.js';`;
72
- }
73
- else {
74
- content = `import 'zone.js';`;
75
- }
76
- utils_1.overwriteFile({ tree, filePath, content, overwrite: true, contentIsString: true });
77
- };
78
- }
79
- function setTsConfig(options) {
80
- return (tree) => {
81
- const buildFilePath = `${options.root}/tsconfig-es5.app.json`;
82
- if (tree.exists(buildFilePath)) {
83
- tree.delete(buildFilePath);
84
- }
85
- if (options.type === 'add') {
86
- utils_1.overwriteFile({
87
- tree,
88
- filePath: buildFilePath,
89
- content: JSON.stringify(tsconfig_es5_app_1.default, null, 2),
90
- overwrite: true,
91
- contentIsString: true
92
- });
93
- }
94
- // spec
95
- const specFilePath = `${options.root}/tsconfig-es5.spec.json`;
96
- if (tree.exists(specFilePath))
97
- tree.delete(specFilePath);
98
- if (options.type === 'add') {
99
- utils_1.overwriteFile({
100
- tree,
101
- filePath: specFilePath,
102
- content: JSON.stringify(tsconfig_es5_spec_1.default, null, 2),
103
- overwrite: true,
104
- contentIsString: true
105
- });
106
- }
107
- };
108
- }
109
- function finished() {
110
- return (_, context) => {
111
- context.logger.info(colors.yellow(` ⚠ If you encounter [No provider for AlainConfigService], please refer to https://github.com/ng-alain/ng-alain/issues/1624#issuecomment-623071468`));
112
- };
113
- }
114
- function pluginIE(options) {
115
- return (tree) => __awaiter(this, void 0, void 0, function* () {
116
- project = (yield utils_1.getProject(tree, options.project)).project;
117
- return schematics_1.chain([
118
- setAngularJson(options),
119
- setBrowserslist(options),
120
- setPackage(options),
121
- setPolyfills(options),
122
- setTsConfig(options),
123
- finished()
124
- ]);
125
- });
126
- }
127
- exports.pluginIE = pluginIE;
128
- //# sourceMappingURL=plugin.ie.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.ie.js","sourceRoot":"","sources":["../../../schematics/plugin/plugin.ie.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2DAAiF;AACjF,qEAAwE;AACxE,sCAAsC;AAEtC,oCAUkB;AAClB,kEAAyD;AACzD,oEAA2D;AAG3D,IAAI,OAA0B,CAAC;AAE/B,SAAS,cAAc,CAAC,OAAsB;IAC5C,OAAO,2BAAe,CAAC,CAAM,SAAS,EAAC,EAAE;QACvC,MAAM,CAAC,GAAG,+BAAuB,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,EAAE;YAC1B,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,0BAAkB,CAAC,CAAC,cAAc,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,yBAAyB,EAAE,CAAC;YAC/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AAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC;AAbD,4BAaC"}
@@ -1,35 +0,0 @@
1
- import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
2
-
3
- import { APPNAME, createAlainApp } from '../utils/testing';
4
-
5
- describe('NgAlainSchematic: plugin: ie', () => {
6
- let runner: SchematicTestRunner;
7
- let tree: UnitTestTree;
8
-
9
- beforeEach(async () => {
10
- ({ runner, tree } = await createAlainApp());
11
- tree = await runner.runSchematicAsync('plugin', { name: 'ie', type: 'add', project: APPNAME }, tree).toPromise();
12
- });
13
-
14
- describe('when add', () => {
15
- it(`should be working`, () => {
16
- expect(tree.exists(`/projects/${APPNAME}/tsconfig-es5.app.json`)).toBe(true);
17
- expect(tree.exists(`/projects/${APPNAME}/tsconfig-es5.spec.json`)).toBe(true);
18
- expect(tree.readContent(`/projects/${APPNAME}/.browserslistrc`).includes(`IE 11`)).toBe(true);
19
- });
20
- });
21
-
22
- describe('when remove', () => {
23
- beforeEach(
24
- async () =>
25
- (tree = await runner
26
- .runSchematicAsync('plugin', { name: 'ie', type: 'remove', project: APPNAME }, tree)
27
- .toPromise())
28
- );
29
- it(`should be working`, () => {
30
- expect(tree.exists(`/projects/${APPNAME}/tsconfig-es5.app.json`)).toBe(false);
31
- expect(tree.exists(`/projects/${APPNAME}/tsconfig-es5.spec.json`)).toBe(false);
32
- expect(tree.readContent(`/projects/${APPNAME}/.browserslistrc`).includes(`not IE 11`)).toBe(true);
33
- });
34
- });
35
- });
@@ -1,144 +0,0 @@
1
- import { ProjectDefinition } from '@angular-devkit/core/src/workspace';
2
- import { chain, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
3
- import { updateWorkspace } from '@schematics/angular/utility/workspace';
4
- import * as colors from 'ansi-colors';
5
-
6
- import {
7
- addPackage,
8
- BUILD_TARGET_BUILD,
9
- BUILD_TARGET_SERVE,
10
- BUILD_TARGET_TEST,
11
- getProject,
12
- getProjectFromWorkspace,
13
- overwriteFile,
14
- readContent,
15
- removePackage
16
- } from '../utils';
17
- import tsConfigEs5App from './files/ie/tsconfig-es5.app';
18
- import tsConfigEs5Spec from './files/ie/tsconfig-es5.spec';
19
- import { PluginOptions } from './interface';
20
-
21
- let project: ProjectDefinition;
22
-
23
- function setAngularJson(options: PluginOptions): Rule {
24
- return updateWorkspace(async workspace => {
25
- const p = getProjectFromWorkspace(workspace, options.project);
26
- if (options.type === 'add') {
27
- p.targets.get(BUILD_TARGET_BUILD).configurations.es5 = { tsConfig: './tsconfig-es5.app.json' };
28
- p.targets.get(BUILD_TARGET_SERVE).configurations.es5 = {
29
- browserTarget: `${options.project}:${BUILD_TARGET_BUILD}:es5`
30
- };
31
- p.targets.get(BUILD_TARGET_TEST).configurations = {
32
- es5: { tsConfig: './tsconfig-es5.app.json' }
33
- };
34
- } else {
35
- [BUILD_TARGET_BUILD, BUILD_TARGET_SERVE, BUILD_TARGET_TEST]
36
- .map(key => p.targets.get(key))
37
- .filter(item => !!item)
38
- .forEach(item => {
39
- delete item.configurations.es5;
40
- });
41
- }
42
- });
43
- }
44
-
45
- function setBrowserslist(options: PluginOptions): Rule {
46
- return (tree: Tree) => {
47
- const filePath = `${options.root}/.browserslistrc`;
48
- let content = readContent(tree, filePath);
49
- if (options.type === 'add') {
50
- content = content.replace(`not IE 11`, `IE 11`);
51
- } else {
52
- content = content.replace(`IE 11`, `not IE 11`);
53
- }
54
- overwriteFile({ tree, filePath, content, overwrite: true, contentIsString: true });
55
- };
56
- }
57
-
58
- function setPackage(options: PluginOptions): Rule {
59
- return (tree: Tree) => {
60
- // libs
61
- (options.type === 'add' ? addPackage : removePackage)(
62
- tree,
63
- ['classlist.js@^1.1.0', 'web-animations-js@^2.3.2'],
64
- 'dependencies'
65
- );
66
- // scripts
67
- (options.type === 'add' ? addPackage : removePackage)(
68
- tree,
69
- ['ie:start@ng serve -o --configuration es5', 'ie:hmr@ng serve --hmr --configuration es5'],
70
- 'scripts'
71
- );
72
- };
73
- }
74
-
75
- function setPolyfills(options: PluginOptions): Rule {
76
- return (tree: Tree) => {
77
- const filePath = `${project.sourceRoot}/polyfills.ts`;
78
- let content = '';
79
- if (options.type === 'add') {
80
- content = `import 'core-js/modules/es.array.includes';
81
- import 'classlist.js';
82
- import 'web-animations-js';
83
- import 'zone.js';`;
84
- } else {
85
- content = `import 'zone.js';`;
86
- }
87
- overwriteFile({ tree, filePath, content, overwrite: true, contentIsString: true });
88
- };
89
- }
90
-
91
- function setTsConfig(options: PluginOptions): Rule {
92
- return (tree: Tree) => {
93
- const buildFilePath = `${options.root}/tsconfig-es5.app.json`;
94
- if (tree.exists(buildFilePath)) {
95
- tree.delete(buildFilePath);
96
- }
97
- if (options.type === 'add') {
98
- overwriteFile({
99
- tree,
100
- filePath: buildFilePath,
101
- content: JSON.stringify(tsConfigEs5App, null, 2),
102
- overwrite: true,
103
- contentIsString: true
104
- });
105
- }
106
- // spec
107
- const specFilePath = `${options.root}/tsconfig-es5.spec.json`;
108
- if (tree.exists(specFilePath)) tree.delete(specFilePath);
109
- if (options.type === 'add') {
110
- overwriteFile({
111
- tree,
112
- filePath: specFilePath,
113
- content: JSON.stringify(tsConfigEs5Spec, null, 2),
114
- overwrite: true,
115
- contentIsString: true
116
- });
117
- }
118
- };
119
- }
120
-
121
- function finished(): Rule {
122
- return (_: Tree, context: SchematicContext) => {
123
- context.logger.info(
124
- colors.yellow(
125
- ` ⚠ If you encounter [No provider for AlainConfigService], please refer to https://github.com/ng-alain/ng-alain/issues/1624#issuecomment-623071468`
126
- )
127
- );
128
- };
129
- }
130
-
131
- export function pluginIE(options: PluginOptions): Rule {
132
- return async (tree: Tree) => {
133
- project = (await getProject(tree, options.project)).project;
134
-
135
- return chain([
136
- setAngularJson(options),
137
- setBrowserslist(options),
138
- setPackage(options),
139
- setPolyfills(options),
140
- setTsConfig(options),
141
- finished()
142
- ]);
143
- };
144
- }