@schematics/angular 14.1.0-rc.3 → 14.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -367,7 +367,7 @@
367
367
  </a>
368
368
 
369
369
  <a class="card" target="_blank" rel="noopener" href="https://material.angular.io">
370
- <svg xmlns="http://www.w3.org/2000/svg" style="margin-right: 8px" width="21.813" height="23.453" viewBox="0 0 21.813 23.453"><path d="M4099.584,972.736h0l-10.882,3.9,1.637,14.4,9.245,5.153,9.245-5.153,1.686-14.4Z" transform="translate(-4088.702 -972.736)" fill="#808080"/><path d="M4181.516,972.736v23.453l9.245-5.153,1.686-14.4Z" transform="translate(-4170.633 -972.736)" fill="#808080"/><path d="M4137.529,1076.127l-7.7-3.723,4.417-2.721,7.753,3.723Z" transform="translate(-4125.003 -1058.315)" fill="#ffe0b2"/><path d="M4137.529,1051.705l-7.7-3.723,4.417-2.721,7.753,3.723Z" transform="translate(-4125.003 -1036.757)" fill="#fff3e0"/><path d="M4137.529,1027.283l-7.7-3.723,4.417-2.721,7.753,3.723Z" transform="translate(-4125.003 -1015.199)" fill="#fff"/></svg>
370
+ <svg xmlns="http://www.w3.org/2000/svg" style="margin-right: 8px" width="21.813" height="23.453" viewBox="0 0 179.2 192.7"><path fill="#ffa726" d="M89.4 0 0 32l13.5 118.4 75.9 42.3 76-42.3L179.2 32 89.4 0z"/><path fill="#fb8c00" d="M89.4 0v192.7l76-42.3L179.2 32 89.4 0z"/><path fill="#ffe0b2" d="m102.9 146.3-63.3-30.5 36.3-22.4 63.7 30.6-36.7 22.3z"/><path fill="#fff3e0" d="M102.9 122.8 39.6 92.2l36.3-22.3 63.7 30.6-36.7 22.3z"/><path fill="#fff" d="M102.9 99.3 39.6 68.7l36.3-22.4 63.7 30.6-36.7 22.4z"/></svg>
371
371
  <span>Angular Material</span>
372
372
  <svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
373
373
  </a>
package/e2e/index.js CHANGED
@@ -65,7 +65,10 @@ function default_1(options) {
65
65
  }),
66
66
  (0, schematics_1.move)(e2eRootPath),
67
67
  ])),
68
- ...E2E_DEV_DEPENDENCIES.map((name) => (0, utility_1.addDependency)(name, latest_versions_1.latestVersions[name], { type: utility_1.DependencyType.Dev })),
68
+ ...E2E_DEV_DEPENDENCIES.map((name) => (0, utility_1.addDependency)(name, latest_versions_1.latestVersions[name], {
69
+ type: utility_1.DependencyType.Dev,
70
+ existing: utility_1.ExistingBehavior.Skip,
71
+ })),
69
72
  addScriptsToPackageJson(),
70
73
  ]);
71
74
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "14.1.0-rc.3",
3
+ "version": "14.1.0",
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.1.0-rc.3",
27
- "@angular-devkit/schematics": "14.1.0-rc.3",
28
- "jsonc-parser": "3.0.0"
26
+ "@angular-devkit/core": "14.1.0",
27
+ "@angular-devkit/schematics": "14.1.0",
28
+ "jsonc-parser": "3.1.0"
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
@@ -38,6 +38,23 @@ export declare enum InstallBehavior {
38
38
  */
39
39
  Always = 2
40
40
  }
41
+ /**
42
+ * An enum used to specify the existing dependency behavior for the {@link addDependency}
43
+ * schematics rule. The existing behavior affects whether the named dependency will be added
44
+ * to the `package.json` when the dependency is already present with a differing specifier.
45
+ */
46
+ export declare enum ExistingBehavior {
47
+ /**
48
+ * The dependency will not be added or otherwise changed if it already exists.
49
+ */
50
+ Skip = 0,
51
+ /**
52
+ * The dependency's existing specifier will be replaced with the specifier provided in the
53
+ * {@link addDependency} call. A warning will also be shown during schematic execution to
54
+ * notify the user of the replacement.
55
+ */
56
+ Replace = 1
57
+ }
41
58
  /**
42
59
  * Adds a package as a dependency to a `package.json`. By default the `package.json` located
43
60
  * at the schematic's root will be used. The `manifestPath` option can be used to explicitly specify
@@ -71,4 +88,9 @@ export declare function addDependency(name: string, specifier: string, options?:
71
88
  * Defaults to {@link InstallBehavior.Auto}.
72
89
  */
73
90
  install?: InstallBehavior;
91
+ /**
92
+ * The behavior to use when the dependency already exists within the `package.json`.
93
+ * Defaults to {@link ExistingBehavior.Replace}.
94
+ */
95
+ existing?: ExistingBehavior;
74
96
  }): Rule;
@@ -30,7 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
30
30
  return result;
31
31
  };
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.addDependency = exports.InstallBehavior = exports.DependencyType = void 0;
33
+ exports.addDependency = exports.ExistingBehavior = exports.InstallBehavior = exports.DependencyType = void 0;
34
34
  const tasks_1 = require("@angular-devkit/schematics/tasks");
35
35
  const path = __importStar(require("path"));
36
36
  const installTasks = new WeakMap();
@@ -68,6 +68,24 @@ var InstallBehavior;
68
68
  */
69
69
  InstallBehavior[InstallBehavior["Always"] = 2] = "Always";
70
70
  })(InstallBehavior = exports.InstallBehavior || (exports.InstallBehavior = {}));
71
+ /**
72
+ * An enum used to specify the existing dependency behavior for the {@link addDependency}
73
+ * schematics rule. The existing behavior affects whether the named dependency will be added
74
+ * to the `package.json` when the dependency is already present with a differing specifier.
75
+ */
76
+ var ExistingBehavior;
77
+ (function (ExistingBehavior) {
78
+ /**
79
+ * The dependency will not be added or otherwise changed if it already exists.
80
+ */
81
+ ExistingBehavior[ExistingBehavior["Skip"] = 0] = "Skip";
82
+ /**
83
+ * The dependency's existing specifier will be replaced with the specifier provided in the
84
+ * {@link addDependency} call. A warning will also be shown during schematic execution to
85
+ * notify the user of the replacement.
86
+ */
87
+ ExistingBehavior[ExistingBehavior["Replace"] = 1] = "Replace";
88
+ })(ExistingBehavior = exports.ExistingBehavior || (exports.ExistingBehavior = {}));
71
89
  /**
72
90
  * Adds a package as a dependency to a `package.json`. By default the `package.json` located
73
91
  * at the schematic's root will be used. The `manifestPath` option can be used to explicitly specify
@@ -85,7 +103,7 @@ var InstallBehavior;
85
103
  * @returns A Schematics {@link Rule}
86
104
  */
87
105
  function addDependency(name, specifier, options = {}) {
88
- const { type = DependencyType.Default, packageJsonPath = '/package.json', install = InstallBehavior.Auto, } = options;
106
+ const { type = DependencyType.Default, packageJsonPath = '/package.json', install = InstallBehavior.Auto, existing = ExistingBehavior.Replace, } = options;
89
107
  return (tree, context) => {
90
108
  var _a;
91
109
  const manifest = tree.readJson(packageJsonPath);
@@ -102,7 +120,10 @@ function addDependency(name, specifier, options = {}) {
102
120
  }
103
121
  if (existingSpecifier) {
104
122
  // Already present but different specifier
105
- // This warning may become an error in the future
123
+ if (existing === ExistingBehavior.Skip) {
124
+ return;
125
+ }
126
+ // ExistingBehavior.Replace is the only other behavior currently
106
127
  context.logger.warn(`Package dependency "${name}" already exists with a different specifier. ` +
107
128
  `"${existingSpecifier}" will be replaced with "${specifier}".`);
108
129
  }
@@ -7,4 +7,4 @@
7
7
  */
8
8
  export { ProjectDefinition, TargetDefinition, WorkspaceDefinition, getWorkspace as readWorkspace, updateWorkspace, writeWorkspace, } from './workspace';
9
9
  export { Builders as AngularBuilder } from './workspace-models';
10
- export { DependencyType, InstallBehavior, addDependency } from './dependency';
10
+ export { DependencyType, ExistingBehavior, InstallBehavior, addDependency } from './dependency';
package/utility/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.addDependency = exports.InstallBehavior = exports.DependencyType = exports.AngularBuilder = exports.writeWorkspace = exports.updateWorkspace = exports.readWorkspace = void 0;
10
+ exports.addDependency = exports.InstallBehavior = exports.ExistingBehavior = exports.DependencyType = exports.AngularBuilder = exports.writeWorkspace = exports.updateWorkspace = exports.readWorkspace = void 0;
11
11
  // Workspace related rules and types
12
12
  var workspace_1 = require("./workspace");
13
13
  Object.defineProperty(exports, "readWorkspace", { enumerable: true, get: function () { return workspace_1.getWorkspace; } });
@@ -18,5 +18,6 @@ Object.defineProperty(exports, "AngularBuilder", { enumerable: true, get: functi
18
18
  // Package dependency related rules and types
19
19
  var dependency_1 = require("./dependency");
20
20
  Object.defineProperty(exports, "DependencyType", { enumerable: true, get: function () { return dependency_1.DependencyType; } });
21
+ Object.defineProperty(exports, "ExistingBehavior", { enumerable: true, get: function () { return dependency_1.ExistingBehavior; } });
21
22
  Object.defineProperty(exports, "InstallBehavior", { enumerable: true, get: function () { return dependency_1.InstallBehavior; } });
22
23
  Object.defineProperty(exports, "addDependency", { enumerable: true, get: function () { return dependency_1.addDependency; } });
@@ -12,11 +12,11 @@
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.0.0-next.8",
15
+ "ng-packagr": "^14.1.0",
16
16
  "protractor": "~7.0.0",
17
17
  "rxjs": "~7.5.0",
18
18
  "tslib": "^2.3.0",
19
- "ts-node": "~10.8.0",
19
+ "ts-node": "~10.9.0",
20
20
  "typescript": "~4.7.2",
21
21
  "zone.js": "~0.11.4"
22
22
  }
@@ -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.0.0-next.0',
16
+ Angular: '^14.1.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.