@schematics/angular 14.2.3 → 15.0.0-next.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.
Files changed (51) hide show
  1. package/app-shell/schema.d.ts +0 -4
  2. package/app-shell/schema.json +0 -5
  3. package/class/schema.d.ts +1 -1
  4. package/class/schema.json +1 -1
  5. package/component/index.js +8 -69
  6. package/component/schema.d.ts +1 -1
  7. package/component/schema.json +1 -1
  8. package/directive/index.js +8 -65
  9. package/directive/schema.d.ts +1 -1
  10. package/directive/schema.json +1 -1
  11. package/enum/schema.d.ts +1 -1
  12. package/enum/schema.json +1 -1
  13. package/guard/schema.d.ts +1 -1
  14. package/guard/schema.json +1 -1
  15. package/interceptor/schema.d.ts +1 -1
  16. package/interceptor/schema.json +1 -1
  17. package/interface/schema.d.ts +1 -1
  18. package/interface/schema.json +1 -1
  19. package/migrations/migration-collection.json +4 -29
  20. package/migrations/{update-14/remove-default-project-option.d.ts → update-15/remove-browserslist-config.d.ts} +1 -1
  21. package/migrations/update-15/remove-browserslist-config.js +94 -0
  22. package/module/index.js +2 -2
  23. package/module/schema.d.ts +1 -1
  24. package/module/schema.json +1 -1
  25. package/package.json +4 -4
  26. package/pipe/index.js +8 -63
  27. package/pipe/schema.d.ts +1 -1
  28. package/pipe/schema.json +1 -1
  29. package/resolver/schema.d.ts +1 -1
  30. package/resolver/schema.json +1 -1
  31. package/service/schema.d.ts +1 -1
  32. package/service/schema.json +1 -1
  33. package/universal/schema.d.ts +0 -5
  34. package/universal/schema.json +0 -7
  35. package/utility/add-declaration-to-ng-module.d.ts +19 -0
  36. package/utility/add-declaration-to-ng-module.js +68 -0
  37. package/utility/generate-from-files.d.ts +1 -1
  38. package/utility/latest-versions/package.json +3 -3
  39. package/utility/latest-versions.js +1 -1
  40. package/application/files/.browserslistrc.template +0 -16
  41. package/migrations/update-14/angular-packages-version-prefix.d.ts +0 -29
  42. package/migrations/update-14/angular-packages-version-prefix.js +0 -61
  43. package/migrations/update-14/remove-default-project-option.js +0 -17
  44. package/migrations/update-14/remove-show-circular-dependencies-option.d.ts +0 -10
  45. package/migrations/update-14/remove-show-circular-dependencies-option.js +0 -26
  46. package/migrations/update-14/replace-default-collection-option.d.ts +0 -10
  47. package/migrations/update-14/replace-default-collection-option.js +0 -32
  48. package/migrations/update-14/update-libraries-secondary-entrypoints.d.ts +0 -10
  49. package/migrations/update-14/update-libraries-secondary-entrypoints.js +0 -51
  50. package/migrations/update-14/update-tsconfig-target.d.ts +0 -10
  51. package/migrations/update-14/update-tsconfig-target.js +0 -51
@@ -2,10 +2,6 @@
2
2
  * Generates an application shell for running a server-side version of an app.
3
3
  */
4
4
  export interface Schema {
5
- /**
6
- * The name of the application directory.
7
- */
8
- appDir?: string;
9
5
  /**
10
6
  * The application ID to use in withServerTransition().
11
7
  */
@@ -29,11 +29,6 @@
29
29
  "description": "The name of the main entry-point file.",
30
30
  "default": "main.server.ts"
31
31
  },
32
- "appDir": {
33
- "type": "string",
34
- "description": "The name of the application directory.",
35
- "default": "app"
36
- },
37
32
  "rootModuleFileName": {
38
33
  "type": "string",
39
34
  "description": "The name of the root module file",
package/class/schema.d.ts CHANGED
@@ -13,7 +13,7 @@ export interface Schema {
13
13
  /**
14
14
  * The name of the project.
15
15
  */
16
- project?: string;
16
+ project: string;
17
17
  /**
18
18
  * Do not create "spec.ts" test files for the new class.
19
19
  */
package/class/schema.json CHANGED
@@ -42,5 +42,5 @@
42
42
  "description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\"."
43
43
  }
44
44
  },
45
- "required": ["name"]
45
+ "required": ["name", "project"]
46
46
  }
@@ -6,81 +6,14 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
9
  Object.defineProperty(exports, "__esModule", { value: true });
33
10
  const schematics_1 = require("@angular-devkit/schematics");
34
- const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
35
- const ast_utils_1 = require("../utility/ast-utils");
36
- const change_1 = require("../utility/change");
11
+ const add_declaration_to_ng_module_1 = require("../utility/add-declaration-to-ng-module");
37
12
  const find_module_1 = require("../utility/find-module");
38
13
  const parse_name_1 = require("../utility/parse-name");
39
14
  const validation_1 = require("../utility/validation");
40
15
  const workspace_1 = require("../utility/workspace");
41
16
  const schema_1 = require("./schema");
42
- function readIntoSourceFile(host, modulePath) {
43
- const sourceText = host.readText(modulePath);
44
- return ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
45
- }
46
- function addDeclarationToNgModule(options) {
47
- return (host) => {
48
- if (options.skipImport || options.standalone || !options.module) {
49
- return host;
50
- }
51
- options.type = options.type != null ? options.type : 'Component';
52
- const modulePath = options.module;
53
- const source = readIntoSourceFile(host, modulePath);
54
- const componentPath = `/${options.path}/` +
55
- (options.flat ? '' : schematics_1.strings.dasherize(options.name) + '/') +
56
- schematics_1.strings.dasherize(options.name) +
57
- (options.type ? '.' : '') +
58
- schematics_1.strings.dasherize(options.type);
59
- const relativePath = (0, find_module_1.buildRelativePath)(modulePath, componentPath);
60
- const classifiedName = schematics_1.strings.classify(options.name) + schematics_1.strings.classify(options.type);
61
- const declarationChanges = (0, ast_utils_1.addDeclarationToModule)(source, modulePath, classifiedName, relativePath);
62
- const declarationRecorder = host.beginUpdate(modulePath);
63
- for (const change of declarationChanges) {
64
- if (change instanceof change_1.InsertChange) {
65
- declarationRecorder.insertLeft(change.pos, change.toAdd);
66
- }
67
- }
68
- host.commitUpdate(declarationRecorder);
69
- if (options.export) {
70
- // Need to refresh the AST because we overwrote the file in the host.
71
- const source = readIntoSourceFile(host, modulePath);
72
- const exportRecorder = host.beginUpdate(modulePath);
73
- const exportChanges = (0, ast_utils_1.addExportToModule)(source, modulePath, schematics_1.strings.classify(options.name) + schematics_1.strings.classify(options.type), relativePath);
74
- for (const change of exportChanges) {
75
- if (change instanceof change_1.InsertChange) {
76
- exportRecorder.insertLeft(change.pos, change.toAdd);
77
- }
78
- }
79
- host.commitUpdate(exportRecorder);
80
- }
81
- return host;
82
- };
83
- }
84
17
  function buildSelector(options, projectPrefix) {
85
18
  let selector = schematics_1.strings.dasherize(options.name);
86
19
  if (options.prefix) {
@@ -130,7 +63,13 @@ function default_1(options) {
130
63
  : (0, schematics_1.noop)(),
131
64
  (0, schematics_1.move)(parsedPath.path),
132
65
  ]);
133
- return (0, schematics_1.chain)([addDeclarationToNgModule(options), (0, schematics_1.mergeWith)(templateSource)]);
66
+ return (0, schematics_1.chain)([
67
+ (0, add_declaration_to_ng_module_1.addDeclarationToNgModule)({
68
+ type: 'component',
69
+ ...options,
70
+ }),
71
+ (0, schematics_1.mergeWith)(templateSource),
72
+ ]);
134
73
  };
135
74
  }
136
75
  exports.default = default_1;
@@ -48,7 +48,7 @@ export interface Schema {
48
48
  /**
49
49
  * The name of the project.
50
50
  */
51
- project?: string;
51
+ project: string;
52
52
  /**
53
53
  * The HTML selector to use for this component.
54
54
  */
@@ -136,5 +136,5 @@
136
136
  "x-user-analytics": 19
137
137
  }
138
138
  },
139
- "required": ["name"]
139
+ "required": ["name", "project"]
140
140
  }
@@ -6,76 +6,13 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
9
  Object.defineProperty(exports, "__esModule", { value: true });
33
10
  const schematics_1 = require("@angular-devkit/schematics");
34
- const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
35
- const ast_utils_1 = require("../utility/ast-utils");
36
- const change_1 = require("../utility/change");
11
+ const add_declaration_to_ng_module_1 = require("../utility/add-declaration-to-ng-module");
37
12
  const find_module_1 = require("../utility/find-module");
38
13
  const parse_name_1 = require("../utility/parse-name");
39
14
  const validation_1 = require("../utility/validation");
40
15
  const workspace_1 = require("../utility/workspace");
41
- function addDeclarationToNgModule(options) {
42
- return (host) => {
43
- if (options.skipImport || options.standalone || !options.module) {
44
- return host;
45
- }
46
- const modulePath = options.module;
47
- const sourceText = host.readText(modulePath);
48
- const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
49
- const directivePath = `/${options.path}/` +
50
- (options.flat ? '' : schematics_1.strings.dasherize(options.name) + '/') +
51
- schematics_1.strings.dasherize(options.name) +
52
- '.directive';
53
- const relativePath = (0, find_module_1.buildRelativePath)(modulePath, directivePath);
54
- const classifiedName = schematics_1.strings.classify(`${options.name}Directive`);
55
- const declarationChanges = (0, ast_utils_1.addDeclarationToModule)(source, modulePath, classifiedName, relativePath);
56
- const declarationRecorder = host.beginUpdate(modulePath);
57
- for (const change of declarationChanges) {
58
- if (change instanceof change_1.InsertChange) {
59
- declarationRecorder.insertLeft(change.pos, change.toAdd);
60
- }
61
- }
62
- host.commitUpdate(declarationRecorder);
63
- if (options.export) {
64
- // Need to refresh the AST because we overwrote the file in the host.
65
- const sourceText = host.readText(modulePath);
66
- const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
67
- const exportRecorder = host.beginUpdate(modulePath);
68
- const exportChanges = (0, ast_utils_1.addExportToModule)(source, modulePath, schematics_1.strings.classify(`${options.name}Directive`), relativePath);
69
- for (const change of exportChanges) {
70
- if (change instanceof change_1.InsertChange) {
71
- exportRecorder.insertLeft(change.pos, change.toAdd);
72
- }
73
- }
74
- host.commitUpdate(exportRecorder);
75
- }
76
- return host;
77
- };
78
- }
79
16
  function buildSelector(options, projectPrefix) {
80
17
  let selector = options.name;
81
18
  if (options.prefix) {
@@ -111,7 +48,13 @@ function default_1(options) {
111
48
  }),
112
49
  (0, schematics_1.move)(parsedPath.path),
113
50
  ]);
114
- return (0, schematics_1.chain)([addDeclarationToNgModule(options), (0, schematics_1.mergeWith)(templateSource)]);
51
+ return (0, schematics_1.chain)([
52
+ (0, add_declaration_to_ng_module_1.addDeclarationToNgModule)({
53
+ type: 'directive',
54
+ ...options,
55
+ }),
56
+ (0, schematics_1.mergeWith)(templateSource),
57
+ ]);
115
58
  };
116
59
  }
117
60
  exports.default = default_1;
@@ -30,7 +30,7 @@ export interface Schema {
30
30
  /**
31
31
  * The name of the project.
32
32
  */
33
- project?: string;
33
+ project: string;
34
34
  /**
35
35
  * The HTML selector to use for this directive.
36
36
  */
@@ -85,5 +85,5 @@
85
85
  "x-user-analytics": 19
86
86
  }
87
87
  },
88
- "required": ["name"]
88
+ "required": ["name", "project"]
89
89
  }
package/enum/schema.d.ts CHANGED
@@ -14,7 +14,7 @@ export interface Schema {
14
14
  * The name of the project in which to create the enum. Default is the configured default
15
15
  * project for the workspace.
16
16
  */
17
- project?: string;
17
+ project: string;
18
18
  /**
19
19
  * Adds a developer-defined type to the filename, in the format "name.type.ts".
20
20
  */
package/enum/schema.json CHANGED
@@ -36,5 +36,5 @@
36
36
  "description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\"."
37
37
  }
38
38
  },
39
- "required": ["name"]
39
+ "required": ["name", "project"]
40
40
  }
package/guard/schema.d.ts CHANGED
@@ -22,7 +22,7 @@ export interface Schema {
22
22
  /**
23
23
  * The name of the project.
24
24
  */
25
- project?: string;
25
+ project: string;
26
26
  /**
27
27
  * Do not create "spec.ts" test files for the new guard.
28
28
  */
package/guard/schema.json CHANGED
@@ -55,5 +55,5 @@
55
55
  "x-prompt": "Which interfaces would you like to implement?"
56
56
  }
57
57
  },
58
- "required": ["name"]
58
+ "required": ["name", "project"]
59
59
  }
@@ -17,7 +17,7 @@ export interface Schema {
17
17
  /**
18
18
  * The name of the project.
19
19
  */
20
- project?: string;
20
+ project: string;
21
21
  /**
22
22
  * Do not create "spec.ts" test files for the new interceptor.
23
23
  */
@@ -43,5 +43,5 @@
43
43
  "x-user-analytics": 12
44
44
  }
45
45
  },
46
- "required": ["name"]
46
+ "required": ["name", "project"]
47
47
  }
@@ -17,7 +17,7 @@ export interface Schema {
17
17
  /**
18
18
  * The name of the project.
19
19
  */
20
- project?: string;
20
+ project: string;
21
21
  /**
22
22
  * Adds a developer-defined type to the filename, in the format "name.type.ts".
23
23
  */
@@ -44,5 +44,5 @@
44
44
  }
45
45
  }
46
46
  },
47
- "required": ["name"]
47
+ "required": ["name", "project"]
48
48
  }
@@ -1,34 +1,9 @@
1
1
  {
2
2
  "schematics": {
3
- "update-angular-packages-version-prefix": {
4
- "version": "14.0.0",
5
- "factory": "./update-14/angular-packages-version-prefix",
6
- "description": "Update Angular packages 'dependencies' and 'devDependencies' version prefix to '^' instead of '~'."
7
- },
8
- "update-tsconfig-target": {
9
- "version": "14.0.0",
10
- "factory": "./update-14/update-tsconfig-target",
11
- "description": "Update TypeScript compilation target to 'ES2020'."
12
- },
13
- "remove-show-circular-dependencies-option": {
14
- "version": "14.0.0",
15
- "factory": "./update-14/remove-show-circular-dependencies-option",
16
- "description": "Remove 'showCircularDependencies' option from browser and server builders."
17
- },
18
- "remove-default-project-option": {
19
- "version": "14.0.0",
20
- "factory": "./update-14/remove-default-project-option",
21
- "description": "Remove 'defaultProject' option from workspace configuration. The project to use will be determined from the current working directory."
22
- },
23
- "replace-default-collection-option": {
24
- "version": "14.0.0",
25
- "factory": "./update-14/replace-default-collection-option",
26
- "description": "Replace 'defaultCollection' option in workspace configuration with 'schematicCollections'."
27
- },
28
- "update-libraries-secondary-entrypoints": {
29
- "version": "14.0.0",
30
- "factory": "./update-14/update-libraries-secondary-entrypoints",
31
- "description": "Remove 'package.json' files from library projects secondary entrypoints."
3
+ "remove-browserslist-config": {
4
+ "version": "15.0.0",
5
+ "factory": "./update-15/remove-browserslist-config",
6
+ "description": "Remove Browserslist configuration files that matches the Angular CLI default configuration."
32
7
  }
33
8
  }
34
9
  }
@@ -6,5 +6,5 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { Rule } from '@angular-devkit/schematics';
9
- /** Migration to remove 'defaultProject' option from angular.json. */
9
+ export declare const DEFAULT_BROWSERS: string[];
10
10
  export default function (): Rule;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.DEFAULT_BROWSERS = void 0;
34
+ const core_1 = require("@angular-devkit/core");
35
+ const validBrowserslistConfigFilenames = new Set(['browserslist', '.browserslistrc']);
36
+ exports.DEFAULT_BROWSERS = [
37
+ 'last 1 Chrome version',
38
+ 'last 1 Firefox version',
39
+ 'last 2 Edge major versions',
40
+ 'last 2 Safari major versions',
41
+ 'last 2 iOS major versions',
42
+ 'Firefox ESR',
43
+ ];
44
+ function* visit(directory) {
45
+ for (const path of directory.subfiles) {
46
+ if (validBrowserslistConfigFilenames.has(path)) {
47
+ yield (0, core_1.join)(directory.path, path);
48
+ }
49
+ }
50
+ for (const path of directory.subdirs) {
51
+ if (path === 'node_modules') {
52
+ continue;
53
+ }
54
+ yield* visit(directory.dir(path));
55
+ }
56
+ }
57
+ function default_1() {
58
+ return async (tree, { logger }) => {
59
+ let browserslist;
60
+ try {
61
+ browserslist = (await Promise.resolve().then(() => __importStar(require('browserslist')))).default;
62
+ }
63
+ catch {
64
+ logger.warn('Skipping migration because the "browserslist" package could not be loaded.');
65
+ return;
66
+ }
67
+ // Set the defaults to match the defaults in build-angular.
68
+ browserslist.defaults = exports.DEFAULT_BROWSERS;
69
+ const defaultSupportedBrowsers = new Set(browserslist(exports.DEFAULT_BROWSERS));
70
+ const es5Browsers = new Set(browserslist(['supports es6-module']));
71
+ for (const path of visit(tree.root)) {
72
+ const { defaults: browsersListConfig, ...otherConfigs } = browserslist.parseConfig(tree.readText(path));
73
+ if (Object.keys(otherConfigs).length) {
74
+ // The config contains additional sections.
75
+ continue;
76
+ }
77
+ const browserslistInProject = browserslist(
78
+ // Exclude from the list ES5 browsers which are not supported.
79
+ browsersListConfig.map((s) => `${s} and supports es6-module`), {
80
+ ignoreUnknownVersions: true,
81
+ });
82
+ if (defaultSupportedBrowsers.size !== browserslistInProject.length) {
83
+ continue;
84
+ }
85
+ const shouldDelete = browserslistInProject.every((browser) => defaultSupportedBrowsers.has(browser));
86
+ if (shouldDelete) {
87
+ // All browsers are the same as the default config.
88
+ // Delete file as it's redundant.
89
+ tree.delete(path);
90
+ }
91
+ }
92
+ };
93
+ }
94
+ exports.default = default_1;
package/module/index.js CHANGED
@@ -47,7 +47,7 @@ function buildRelativeModulePath(options, modulePath) {
47
47
  '.module');
48
48
  return (0, find_module_1.buildRelativePath)(modulePath, importModulePath);
49
49
  }
50
- function addDeclarationToNgModule(options) {
50
+ function addImportToNgModule(options) {
51
51
  return (host) => {
52
52
  if (!options.module) {
53
53
  return host;
@@ -144,7 +144,7 @@ function default_1(options) {
144
144
  project: options.project,
145
145
  };
146
146
  return (0, schematics_1.chain)([
147
- !isLazyLoadedModuleGen ? addDeclarationToNgModule(options) : (0, schematics_1.noop)(),
147
+ !isLazyLoadedModuleGen ? addImportToNgModule(options) : (0, schematics_1.noop)(),
148
148
  addRouteDeclarationToNgModule(options, routingModulePath),
149
149
  (0, schematics_1.mergeWith)(templateSource),
150
150
  isLazyLoadedModuleGen ? (0, schematics_1.schematic)('component', componentOptions) : (0, schematics_1.noop)(),
@@ -25,7 +25,7 @@ export interface Schema {
25
25
  /**
26
26
  * The name of the project.
27
27
  */
28
- project?: string;
28
+ project: string;
29
29
  /**
30
30
  * The route path for a lazy-loaded module. When supplied, creates a component in the new
31
31
  * module, and adds the route to that component in the `Routes` array declared in the module
@@ -64,5 +64,5 @@
64
64
  "alias": "m"
65
65
  }
66
66
  },
67
- "required": ["name"]
67
+ "required": ["name", "project"]
68
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "14.2.3",
3
+ "version": "15.0.0-next.1",
4
4
  "description": "Schematics specific to Angular",
5
5
  "homepage": "https://github.com/angular/angular-cli",
6
6
  "keywords": [
@@ -23,9 +23,9 @@
23
23
  },
24
24
  "schematics": "./collection.json",
25
25
  "dependencies": {
26
- "@angular-devkit/core": "14.2.3",
27
- "@angular-devkit/schematics": "14.2.3",
28
- "jsonc-parser": "3.1.0"
26
+ "@angular-devkit/core": "15.0.0-next.1",
27
+ "@angular-devkit/schematics": "15.0.0-next.1",
28
+ "jsonc-parser": "3.2.0"
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
package/pipe/index.js CHANGED
@@ -6,74 +6,13 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
9
  Object.defineProperty(exports, "__esModule", { value: true });
33
10
  const schematics_1 = require("@angular-devkit/schematics");
34
- const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
35
- const ast_utils_1 = require("../utility/ast-utils");
36
- const change_1 = require("../utility/change");
11
+ const add_declaration_to_ng_module_1 = require("../utility/add-declaration-to-ng-module");
37
12
  const find_module_1 = require("../utility/find-module");
38
13
  const parse_name_1 = require("../utility/parse-name");
39
14
  const validation_1 = require("../utility/validation");
40
15
  const workspace_1 = require("../utility/workspace");
41
- function addDeclarationToNgModule(options) {
42
- return (host) => {
43
- if (options.skipImport || options.standalone || !options.module) {
44
- return host;
45
- }
46
- const modulePath = options.module;
47
- const sourceText = host.readText(modulePath);
48
- const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
49
- const pipePath = `/${options.path}/` +
50
- (options.flat ? '' : schematics_1.strings.dasherize(options.name) + '/') +
51
- schematics_1.strings.dasherize(options.name) +
52
- '.pipe';
53
- const relativePath = (0, find_module_1.buildRelativePath)(modulePath, pipePath);
54
- const changes = (0, ast_utils_1.addDeclarationToModule)(source, modulePath, schematics_1.strings.classify(`${options.name}Pipe`), relativePath);
55
- const recorder = host.beginUpdate(modulePath);
56
- for (const change of changes) {
57
- if (change instanceof change_1.InsertChange) {
58
- recorder.insertLeft(change.pos, change.toAdd);
59
- }
60
- }
61
- host.commitUpdate(recorder);
62
- if (options.export) {
63
- const sourceText = host.readText(modulePath);
64
- const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
65
- const exportRecorder = host.beginUpdate(modulePath);
66
- const exportChanges = (0, ast_utils_1.addExportToModule)(source, modulePath, schematics_1.strings.classify(`${options.name}Pipe`), relativePath);
67
- for (const change of exportChanges) {
68
- if (change instanceof change_1.InsertChange) {
69
- exportRecorder.insertLeft(change.pos, change.toAdd);
70
- }
71
- }
72
- host.commitUpdate(exportRecorder);
73
- }
74
- return host;
75
- };
76
- }
77
16
  function default_1(options) {
78
17
  return async (host) => {
79
18
  var _a;
@@ -92,7 +31,13 @@ function default_1(options) {
92
31
  }),
93
32
  (0, schematics_1.move)(parsedPath.path),
94
33
  ]);
95
- return (0, schematics_1.chain)([addDeclarationToNgModule(options), (0, schematics_1.mergeWith)(templateSource)]);
34
+ return (0, schematics_1.chain)([
35
+ (0, add_declaration_to_ng_module_1.addDeclarationToNgModule)({
36
+ type: 'pipe',
37
+ ...options,
38
+ }),
39
+ (0, schematics_1.mergeWith)(templateSource),
40
+ ]);
96
41
  };
97
42
  }
98
43
  exports.default = default_1;
package/pipe/schema.d.ts CHANGED
@@ -25,7 +25,7 @@ export interface Schema {
25
25
  /**
26
26
  * The name of the project.
27
27
  */
28
- project?: string;
28
+ project: string;
29
29
  /**
30
30
  * Do not import this pipe into the owning NgModule.
31
31
  */
package/pipe/schema.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "x-user-analytics": 19
67
67
  }
68
68
  },
69
- "required": ["name"]
69
+ "required": ["name", "project"]
70
70
  }
@@ -18,7 +18,7 @@ export interface Schema {
18
18
  /**
19
19
  * The name of the project.
20
20
  */
21
- project?: string;
21
+ project: string;
22
22
  /**
23
23
  * Do not create "spec.ts" test files for the new resolver.
24
24
  */
@@ -43,5 +43,5 @@
43
43
  }
44
44
  }
45
45
  },
46
- "required": ["name"]
46
+ "required": ["name", "project"]
47
47
  }
@@ -17,7 +17,7 @@ export interface Schema {
17
17
  /**
18
18
  * The name of the project.
19
19
  */
20
- project?: string;
20
+ project: string;
21
21
  /**
22
22
  * Do not create "spec.ts" test files for the new service.
23
23
  */
@@ -42,5 +42,5 @@
42
42
  "x-user-analytics": 12
43
43
  }
44
44
  },
45
- "required": ["name"]
45
+ "required": ["name", "project"]
46
46
  }
@@ -2,11 +2,6 @@
2
2
  * Pass this schematic to the "run" command to set up server-side rendering for an app.
3
3
  */
4
4
  export interface Schema {
5
- /**
6
- * The name of the application folder.
7
- * @deprecated This option has no effect.
8
- */
9
- appDir?: string;
10
5
  /**
11
6
  * The application identifier to use for transition.
12
7
  */
@@ -25,13 +25,6 @@
25
25
  "description": "The name of the main entry-point file.",
26
26
  "default": "main.server.ts"
27
27
  },
28
- "appDir": {
29
- "type": "string",
30
- "format": "path",
31
- "description": "The name of the application folder.",
32
- "default": "app",
33
- "x-deprecated": "This option has no effect."
34
- },
35
28
  "rootModuleFileName": {
36
29
  "type": "string",
37
30
  "format": "path",
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Rule } from '@angular-devkit/schematics';
9
+ export interface DeclarationToNgModuleOptions {
10
+ module?: string;
11
+ path?: string;
12
+ name: string;
13
+ flat?: boolean;
14
+ export?: boolean;
15
+ type: string;
16
+ skipImport?: boolean;
17
+ standalone?: boolean;
18
+ }
19
+ export declare function addDeclarationToNgModule(options: DeclarationToNgModuleOptions): Rule;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.addDeclarationToNgModule = void 0;
34
+ const schematics_1 = require("@angular-devkit/schematics");
35
+ const ts = __importStar(require("../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
36
+ const ast_utils_1 = require("./ast-utils");
37
+ const change_1 = require("./change");
38
+ const find_module_1 = require("./find-module");
39
+ function addDeclarationToNgModule(options) {
40
+ return (host) => {
41
+ const modulePath = options.module;
42
+ if (options.skipImport || options.standalone || !modulePath) {
43
+ return host;
44
+ }
45
+ const sourceText = host.readText(modulePath);
46
+ const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
47
+ const filePath = `/${options.path}/` +
48
+ (options.flat ? '' : schematics_1.strings.dasherize(options.name) + '/') +
49
+ schematics_1.strings.dasherize(options.name) +
50
+ (options.type ? '.' : '') +
51
+ schematics_1.strings.dasherize(options.type);
52
+ const importPath = (0, find_module_1.buildRelativePath)(modulePath, filePath);
53
+ const classifiedName = schematics_1.strings.classify(options.name) + schematics_1.strings.classify(options.type);
54
+ const changes = (0, ast_utils_1.addDeclarationToModule)(source, modulePath, classifiedName, importPath);
55
+ if (options.export) {
56
+ changes.push(...(0, ast_utils_1.addSymbolToNgModuleMetadata)(source, modulePath, 'exports', classifiedName));
57
+ }
58
+ const recorder = host.beginUpdate(modulePath);
59
+ for (const change of changes) {
60
+ if (change instanceof change_1.InsertChange) {
61
+ recorder.insertLeft(change.pos, change.toAdd);
62
+ }
63
+ }
64
+ host.commitUpdate(recorder);
65
+ return host;
66
+ };
67
+ }
68
+ exports.addDeclarationToNgModule = addDeclarationToNgModule;
@@ -11,7 +11,7 @@ export interface GenerateFromFilesOptions {
11
11
  name: string;
12
12
  path?: string;
13
13
  prefix?: string;
14
- project?: string;
14
+ project: string;
15
15
  skipTests?: boolean;
16
16
  }
17
17
  export declare function generateFromFiles(options: GenerateFromFilesOptions, extraTemplateValues?: Record<string, string | ((v: string) => string)>): Rule;
@@ -3,16 +3,16 @@
3
3
  "comment": "This file is needed so that dependencies are synced by Renovate.",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@types/jasmine": "~4.0.0",
6
+ "@types/jasmine": "~4.3.0",
7
7
  "@types/node": "^14.15.0",
8
- "jasmine-core": "~4.3.0",
8
+ "jasmine-core": "~4.4.0",
9
9
  "jasmine-spec-reporter": "~7.0.0",
10
10
  "karma-chrome-launcher": "~3.1.0",
11
11
  "karma-coverage": "~2.2.0",
12
12
  "karma-jasmine-html-reporter": "~2.0.0",
13
13
  "karma-jasmine": "~5.1.0",
14
14
  "karma": "~6.4.0",
15
- "ng-packagr": "^14.2.0",
15
+ "ng-packagr": "^15.0.0-next.0",
16
16
  "protractor": "~7.0.0",
17
17
  "rxjs": "~7.5.0",
18
18
  "tslib": "^2.3.0",
@@ -13,7 +13,7 @@ exports.latestVersions = {
13
13
  // but ts_library doesn't support JSON inputs.
14
14
  ...require('./latest-versions/package.json')['dependencies'],
15
15
  // As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
16
- Angular: '^14.2.0',
16
+ Angular: '^15.0.0-next.0',
17
17
  // Since @angular-devkit/build-angular and @schematics/angular are always
18
18
  // published together from the same monorepo, and they are both
19
19
  // non-experimental, they will always have the same version.
@@ -1,16 +0,0 @@
1
- # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
- # For additional information regarding the format and rule options, please see:
3
- # https://github.com/browserslist/browserslist#queries
4
-
5
- # For the full list of supported browsers by the Angular framework, please see:
6
- # https://angular.io/guide/browser-support
7
-
8
- # You can see what browsers were selected by your queries by running:
9
- # npx browserslist
10
-
11
- last 1 Chrome version
12
- last 1 Firefox version
13
- last 2 Edge major versions
14
- last 2 Safari major versions
15
- last 2 iOS major versions
16
- Firefox ESR
@@ -1,29 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- /**
10
- * This migrations updates Angular packages 'dependencies' and 'devDependencies' version prefix to '^' instead of '~'.
11
- *
12
- * @example
13
- * **Before**
14
- * ```json
15
- * dependencies: {
16
- * "@angular/animations": "~13.1.0",
17
- * "@angular/common": "~13.1.0"
18
- * }
19
- * ```
20
- *
21
- * **After**
22
- * ```json
23
- * dependencies: {
24
- * "@angular/animations": "^13.1.0",
25
- * "@angular/common": "^13.1.0"
26
- * }
27
- * ```
28
- */
29
- export default function (): Rule;
@@ -1,61 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const tasks_1 = require("@angular-devkit/schematics/tasks");
11
- const dependencies_1 = require("../../utility/dependencies");
12
- const json_file_1 = require("../../utility/json-file");
13
- const PACKAGES_REGEXP = /^@(?:angular|nguniversal|schematics|angular-devkit)\/|^ng-packagr$/;
14
- /**
15
- * This migrations updates Angular packages 'dependencies' and 'devDependencies' version prefix to '^' instead of '~'.
16
- *
17
- * @example
18
- * **Before**
19
- * ```json
20
- * dependencies: {
21
- * "@angular/animations": "~13.1.0",
22
- * "@angular/common": "~13.1.0"
23
- * }
24
- * ```
25
- *
26
- * **After**
27
- * ```json
28
- * dependencies: {
29
- * "@angular/animations": "^13.1.0",
30
- * "@angular/common": "^13.1.0"
31
- * }
32
- * ```
33
- */
34
- function default_1() {
35
- return (tree, context) => {
36
- const json = new json_file_1.JSONFile(tree, '/package.json');
37
- updateVersionPrefixToTilde(json, dependencies_1.NodeDependencyType.Default);
38
- updateVersionPrefixToTilde(json, dependencies_1.NodeDependencyType.Dev);
39
- context.addTask(new tasks_1.NodePackageInstallTask());
40
- };
41
- }
42
- exports.default = default_1;
43
- function updateVersionPrefixToTilde(json, dependencyType) {
44
- const dependencyTypePath = [dependencyType];
45
- const dependencies = json.get(dependencyTypePath);
46
- if (!dependencies || typeof dependencies !== 'object') {
47
- return;
48
- }
49
- const updatedDependencies = new Map();
50
- for (const [name, version] of Object.entries(dependencies)) {
51
- if (typeof version === 'string' && version.charAt(0) === '~' && PACKAGES_REGEXP.test(name)) {
52
- updatedDependencies.set(name, `^${version.substring(1)}`);
53
- }
54
- }
55
- if (updatedDependencies.size) {
56
- json.modify(dependencyTypePath, {
57
- ...dependencies,
58
- ...Object.fromEntries(updatedDependencies),
59
- });
60
- }
61
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const workspace_1 = require("../../utility/workspace");
11
- /** Migration to remove 'defaultProject' option from angular.json. */
12
- function default_1() {
13
- return (0, workspace_1.updateWorkspace)((workspace) => {
14
- delete workspace.extensions['defaultProject'];
15
- });
16
- }
17
- exports.default = default_1;
@@ -1,10 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- /** Migration to remove 'showCircularDependencies' option from browser and server builders. */
10
- export default function (): Rule;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const workspace_1 = require("../../utility/workspace");
11
- /** Migration to remove 'showCircularDependencies' option from browser and server builders. */
12
- function default_1() {
13
- return (0, workspace_1.updateWorkspace)((workspace) => {
14
- for (const project of workspace.projects.values()) {
15
- for (const target of project.targets.values()) {
16
- if (target.builder === '@angular-devkit/build-angular:server' ||
17
- target.builder === '@angular-devkit/build-angular:browser') {
18
- for (const [, options] of (0, workspace_1.allTargetOptions)(target)) {
19
- delete options.showCircularDependencies;
20
- }
21
- }
22
- }
23
- }
24
- });
25
- }
26
- exports.default = default_1;
@@ -1,10 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- /** Migration to replace 'defaultCollection' option in angular.json. */
10
- export default function (): Rule;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const core_1 = require("@angular-devkit/core");
11
- const workspace_1 = require("../../utility/workspace");
12
- /** Migration to replace 'defaultCollection' option in angular.json. */
13
- function default_1() {
14
- return (0, workspace_1.updateWorkspace)((workspace) => {
15
- // workspace level
16
- replaceDefaultCollection(workspace.extensions['cli']);
17
- // Project level
18
- for (const project of workspace.projects.values()) {
19
- replaceDefaultCollection(project.extensions['cli']);
20
- }
21
- });
22
- }
23
- exports.default = default_1;
24
- function replaceDefaultCollection(cliExtension) {
25
- if (cliExtension && (0, core_1.isJsonObject)(cliExtension) && cliExtension['defaultCollection']) {
26
- // If `schematicsCollection` defined `defaultCollection` is ignored hence no need to warn.
27
- if (!cliExtension['schematicCollections']) {
28
- cliExtension['schematicCollections'] = [cliExtension['defaultCollection']];
29
- }
30
- delete cliExtension['defaultCollection'];
31
- }
32
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- /** Migration to remove secondary entrypoints 'package.json' files and migrate ng-packagr configurations. */
10
- export default function (): Rule;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const core_1 = require("@angular-devkit/core");
11
- const workspace_1 = require("../../utility/workspace");
12
- function* visitPackageJsonFiles(directory, includedInLookup = false) {
13
- if (includedInLookup) {
14
- for (const path of directory.subfiles) {
15
- if (path !== 'package.json') {
16
- continue;
17
- }
18
- yield (0, core_1.join)(directory.path, path);
19
- }
20
- }
21
- for (const path of directory.subdirs) {
22
- if (path === 'node_modules' || path.startsWith('.')) {
23
- continue;
24
- }
25
- yield* visitPackageJsonFiles(directory.dir(path), true);
26
- }
27
- }
28
- /** Migration to remove secondary entrypoints 'package.json' files and migrate ng-packagr configurations. */
29
- function default_1() {
30
- return async (tree) => {
31
- const workspace = await (0, workspace_1.getWorkspace)(tree);
32
- for (const project of workspace.projects.values()) {
33
- if (project.extensions['projectType'] !== 'library' ||
34
- ![...project.targets.values()].some(({ builder }) => builder === '@angular-devkit/build-angular:ng-packagr')) {
35
- // Project is not a library or doesn't use ng-packagr, skip.
36
- continue;
37
- }
38
- for (const path of visitPackageJsonFiles(tree.getDir(project.root))) {
39
- const json = tree.readJson(path);
40
- if ((0, core_1.isJsonObject)(json) && json['ngPackage']) {
41
- // Migrate ng-packagr config to an ng-packagr config file.
42
- const configFilePath = (0, core_1.join)((0, core_1.dirname)((0, core_1.normalize)(path)), 'ng-package.json');
43
- tree.create(configFilePath, JSON.stringify(json['ngPackage'], undefined, 2));
44
- }
45
- // Delete package.json as it is no longer needed in APF 14.
46
- tree.delete(path);
47
- }
48
- }
49
- };
50
- }
51
- exports.default = default_1;
@@ -1,10 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- /** Migration to update tsconfig compilation target option to es2020. */
10
- export default function (): Rule;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const json_file_1 = require("../../utility/json-file");
11
- const workspace_1 = require("../../utility/workspace");
12
- const workspace_models_1 = require("../../utility/workspace-models");
13
- /** Migration to update tsconfig compilation target option to es2020. */
14
- function default_1() {
15
- return async (host) => {
16
- var _a, _b;
17
- /** Builders for which the migration will run. */
18
- const supportedBuilders = [workspace_models_1.Builders.Karma, workspace_models_1.Builders.NgPackagr, workspace_models_1.Builders.Browser];
19
- /** Compilation targets values that should not be amended. */
20
- const skipTargets = ['es2020', 'es2021', 'es2022', 'esnext'];
21
- const uniqueTsConfigs = new Set(['/tsconfig.json']);
22
- // Find all tsconfig files which are refereced by the builders.
23
- const workspace = await (0, workspace_1.getWorkspace)(host);
24
- for (const project of workspace.projects.values()) {
25
- for (const target of project.targets.values()) {
26
- if (!supportedBuilders.includes(target.builder)) {
27
- // Unknown builder.
28
- continue;
29
- }
30
- // Update all other known CLI builders that use a tsconfig.
31
- const allOptions = [(_a = target.options) !== null && _a !== void 0 ? _a : {}, ...Object.values((_b = target.configurations) !== null && _b !== void 0 ? _b : {})];
32
- for (const opt of allOptions) {
33
- if (typeof (opt === null || opt === void 0 ? void 0 : opt.tsConfig) === 'string') {
34
- uniqueTsConfigs.add(opt.tsConfig);
35
- }
36
- }
37
- }
38
- }
39
- // Modify tsconfig files
40
- const targetJsonPath = ['compilerOptions', 'target'];
41
- for (const tsConfigPath of uniqueTsConfigs) {
42
- const json = new json_file_1.JSONFile(host, tsConfigPath);
43
- const target = json.get(targetJsonPath);
44
- // Update compilation target when it's current set lower than es2020.
45
- if (typeof target === 'string' && !skipTargets.includes(target.toLowerCase())) {
46
- json.modify(targetJsonPath, 'es2020');
47
- }
48
- }
49
- };
50
- }
51
- exports.default = default_1;