@angular/cli 12.0.0-rc.3 → 12.0.3

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.
@@ -173,9 +173,9 @@ class AddCommand extends schematic_command_1.SchematicCommand {
173
173
  if (savePackage === false) {
174
174
  // Temporary packages are located in a different directory
175
175
  // Hence we need to resolve them using the temp path
176
- const { status, tempPath } = await install_package_1.installTempPackage(packageIdentifier.raw, packageManager, options.registry ? [`--registry="${options.registry}"`] : undefined);
176
+ const { status, tempNodeModules } = await install_package_1.installTempPackage(packageIdentifier.raw, packageManager, options.registry ? [`--registry="${options.registry}"`] : undefined);
177
177
  const resolvedCollectionPath = require.resolve(path_1.join(collectionName, 'package.json'), {
178
- paths: [tempPath],
178
+ paths: [tempNodeModules],
179
179
  });
180
180
  if (status !== 0) {
181
181
  return status;
@@ -11,6 +11,6 @@ import { Schema as E2eCommandSchema } from './e2e';
11
11
  export declare class E2eCommand extends ArchitectCommand<E2eCommandSchema> {
12
12
  readonly target = "e2e";
13
13
  readonly multiTarget = true;
14
- readonly missingTargetError = "\nCannot find \"e2e\" target for the specified project.\n\nYou should add a package that implements end-to-end testing capabilities.\n\nFor example:\n WebdriverIO: ng add @wdio/schematics\n\nMore options will be added to the list as they become available.\n";
14
+ readonly missingTargetError = "\nCannot find \"e2e\" target for the specified project.\n\nYou should add a package that implements end-to-end testing capabilities.\n\nFor example:\n Cypress: ng add @cypress/schematic\n WebdriverIO: ng add @wdio/schematics\n\nMore options will be added to the list as they become available.\n";
15
15
  initialize(options: E2eCommandSchema & Arguments): Promise<number | void>;
16
16
  }
@@ -20,6 +20,7 @@ Cannot find "e2e" target for the specified project.
20
20
  You should add a package that implements end-to-end testing capabilities.
21
21
 
22
22
  For example:
23
+ Cypress: ng add @cypress/schematic
23
24
  WebdriverIO: ng add @wdio/schematics
24
25
 
25
26
  More options will be added to the list as they become available.
@@ -475,6 +475,21 @@ class UpdateCommand extends command_1.Command {
475
475
  packageManager: this.packageManager,
476
476
  packages: packagesToUpdate,
477
477
  });
478
+ if (success) {
479
+ try {
480
+ // Remove existing node modules directory to provide a stronger guarantee that packages
481
+ // will be hoisted into the correct locations.
482
+ await fs.promises.rmdir(path.join(this.context.root, 'node_modules'), {
483
+ recursive: true,
484
+ maxRetries: 3,
485
+ });
486
+ }
487
+ catch { }
488
+ const result = await install_package_1.installAllPackages(this.packageManager, options.force ? ['--force'] : [], this.context.root);
489
+ if (result !== 0) {
490
+ return result;
491
+ }
492
+ }
478
493
  if (success && options.createCommits) {
479
494
  const committed = this.commit(`Angular CLI update for packages - ${packagesToUpdate.join(', ')}`);
480
495
  if (!committed) {
@@ -1690,7 +1690,7 @@
1690
1690
  "type": "object",
1691
1691
  "properties": {
1692
1692
  "includePaths": {
1693
- "description": "Paths to include. Paths will be resolved to project root.",
1693
+ "description": "Paths to include. Paths will be resolved to workspace root.",
1694
1694
  "type": "array",
1695
1695
  "items": {
1696
1696
  "type": "string"
@@ -2186,7 +2186,7 @@
2186
2186
  },
2187
2187
  "proxyConfig": {
2188
2188
  "type": "string",
2189
- "description": "Proxy configuration file."
2189
+ "description": "Proxy configuration file. For more information, see https://angular.io/guide/build#proxying-to-a-backend-server."
2190
2190
  },
2191
2191
  "ssl": {
2192
2192
  "type": "boolean",
@@ -2471,7 +2471,7 @@
2471
2471
  "type": "object",
2472
2472
  "properties": {
2473
2473
  "includePaths": {
2474
- "description": "Paths to include. Paths will be resolved to project root.",
2474
+ "description": "Paths to include. Paths will be resolved to workspace root.",
2475
2475
  "type": "array",
2476
2476
  "items": {
2477
2477
  "type": "string"
@@ -2746,7 +2746,7 @@
2746
2746
  "type": "object",
2747
2747
  "properties": {
2748
2748
  "includePaths": {
2749
- "description": "Paths to include. Paths will be resolved to project root.",
2749
+ "description": "Paths to include. Paths will be resolved to workspace root.",
2750
2750
  "type": "array",
2751
2751
  "items": {
2752
2752
  "type": "string"
@@ -185,6 +185,7 @@ class ArchitectCommand extends command_1.Command {
185
185
  return success ? 0 : 1;
186
186
  }
187
187
  async runArchitectTarget(options) {
188
+ var _a;
188
189
  const extra = options['--'] || [];
189
190
  try {
190
191
  const targetSpec = this._makeTargetSpecifier(options);
@@ -206,7 +207,7 @@ class ArchitectCommand extends command_1.Command {
206
207
  const newErrors = [];
207
208
  for (const schemaError of e.errors) {
208
209
  if (schemaError.keyword === 'additionalProperties') {
209
- const unknownProperty = schemaError.params.additionalProperty;
210
+ const unknownProperty = (_a = schemaError.params) === null || _a === void 0 ? void 0 : _a.additionalProperty;
210
211
  if (unknownProperty in options) {
211
212
  const dashes = unknownProperty.length === 1 ? '-' : '--';
212
213
  this.logger.fatal(`Unknown option: '${dashes}${unknownProperty}'`);
@@ -252,6 +253,7 @@ class ArchitectCommand extends command_1.Command {
252
253
  }
253
254
  }
254
255
  _makeTargetSpecifier(commandOptions) {
256
+ var _a, _b, _c;
255
257
  let project, target, configuration;
256
258
  if (commandOptions.target) {
257
259
  [project, target, configuration] = commandOptions.target.split(':');
@@ -263,9 +265,14 @@ class ArchitectCommand extends command_1.Command {
263
265
  project = commandOptions.project;
264
266
  target = this.target;
265
267
  if (commandOptions.prod) {
268
+ const defaultConfig = project &&
269
+ target &&
270
+ ((_c = (_b = (_a = this.workspace) === null || _a === void 0 ? void 0 : _a.projects.get(project)) === null || _b === void 0 ? void 0 : _b.targets.get(target)) === null || _c === void 0 ? void 0 : _c.defaultConfiguration);
271
+ this.logger.warn(defaultConfig === 'production'
272
+ ? 'Option "--prod" is deprecated: No need to use this option as this builder defaults to configuration "production".'
273
+ : 'Option "--prod" is deprecated: Use "--configuration production" instead.');
266
274
  // The --prod flag will always be the first configuration, available to be overwritten
267
275
  // by following configurations.
268
- this.logger.warn('Option "--prod" is deprecated: Use "--configuration production" instead.');
269
276
  configuration = 'production';
270
277
  }
271
278
  if (commandOptions.configuration) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "12.0.0-rc.3",
3
+ "version": "12.0.3",
4
4
  "description": "CLI tool for Angular",
5
5
  "main": "lib/cli/index.js",
6
6
  "bin": {
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://github.com/angular/angular-cli",
30
30
  "dependencies": {
31
- "@angular-devkit/architect": "0.1200.0-rc.3",
32
- "@angular-devkit/core": "12.0.0-rc.3",
33
- "@angular-devkit/schematics": "12.0.0-rc.3",
34
- "@schematics/angular": "12.0.0-rc.3",
31
+ "@angular-devkit/architect": "0.1200.3",
32
+ "@angular-devkit/core": "12.0.3",
33
+ "@angular-devkit/schematics": "12.0.3",
34
+ "@schematics/angular": "12.0.3",
35
35
  "@yarnpkg/lockfile": "1.1.0",
36
36
  "ansi-colors": "4.1.1",
37
37
  "debug": "4.3.1",
@@ -40,7 +40,7 @@
40
40
  "jsonc-parser": "3.0.0",
41
41
  "npm-package-arg": "8.1.2",
42
42
  "npm-pick-manifest": "6.1.1",
43
- "open": "8.0.7",
43
+ "open": "8.0.2",
44
44
  "ora": "5.4.0",
45
45
  "pacote": "11.3.2",
46
46
  "resolve": "1.20.0",
@@ -52,16 +52,16 @@
52
52
  "ng-update": {
53
53
  "migrations": "@schematics/angular/migrations/migration-collection.json",
54
54
  "packageGroup": {
55
- "@angular/cli": "12.0.0-rc.3",
56
- "@angular-devkit/architect": "0.1200.0-rc.3",
57
- "@angular-devkit/build-angular": "12.0.0-rc.3",
58
- "@angular-devkit/build-webpack": "0.1200.0-rc.3",
59
- "@angular-devkit/core": "12.0.0-rc.3",
60
- "@angular-devkit/schematics": "12.0.0-rc.3"
55
+ "@angular/cli": "12.0.3",
56
+ "@angular-devkit/architect": "0.1200.3",
57
+ "@angular-devkit/build-angular": "12.0.3",
58
+ "@angular-devkit/build-webpack": "0.1200.3",
59
+ "@angular-devkit/core": "12.0.3",
60
+ "@angular-devkit/schematics": "12.0.3"
61
61
  }
62
62
  },
63
63
  "engines": {
64
- "node": "^12.14.1 || ^14.0.0",
64
+ "node": "^12.14.1 || >=14.0.0",
65
65
  "npm": "^6.11.0 || ^7.5.6",
66
66
  "yarn": ">= 1.13.0"
67
67
  }
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.angularMajorCompatGuarantee = void 0;
11
11
  const core_1 = require("@angular-devkit/core");
12
12
  const schematics_1 = require("@angular-devkit/schematics");
13
- const tasks_1 = require("@angular-devkit/schematics/tasks");
14
13
  const npa = require("npm-package-arg");
15
14
  const semver = require("semver");
16
15
  const npm_1 = require("./npm");
@@ -218,9 +217,7 @@ function _performUpdate(tree, context, infoMap, logger, migrateOnly) {
218
217
  const newContent = JSON.stringify(packageJson, null, 2);
219
218
  if (packageJsonContent.toString() != newContent || migrateOnly) {
220
219
  if (!migrateOnly) {
221
- // If something changed, also hook up the task.
222
220
  tree.overwrite('/package.json', JSON.stringify(packageJson, null, 2));
223
- context.addTask(new tasks_1.NodePackageInstallTask());
224
221
  }
225
222
  const externalMigrations = [];
226
223
  // Run the migrate schematics with the list of packages to use. The collection contains
@@ -7,9 +7,10 @@
7
7
  */
8
8
  import { PackageManager } from '../lib/config/workspace-schema';
9
9
  import { NgAddSaveDepedency } from '../utilities/package-metadata';
10
+ export declare function installAllPackages(packageManager?: PackageManager, extraArgs?: string[], cwd?: string): Promise<1 | 0>;
10
11
  export declare function installPackage(packageName: string, packageManager?: PackageManager, save?: Exclude<NgAddSaveDepedency, false>, extraArgs?: string[], cwd?: string): Promise<1 | 0>;
11
12
  export declare function installTempPackage(packageName: string, packageManager?: PackageManager, extraArgs?: string[]): Promise<{
12
13
  status: 1 | 0;
13
- tempPath: string;
14
+ tempNodeModules: string;
14
15
  }>;
15
16
  export declare function runTempPackageBin(packageName: string, packageManager?: PackageManager, args?: string[]): Promise<number>;
@@ -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.runTempPackageBin = exports.installTempPackage = exports.installPackage = void 0;
10
+ exports.runTempPackageBin = exports.installTempPackage = exports.installPackage = exports.installAllPackages = void 0;
11
11
  const child_process_1 = require("child_process");
12
12
  const fs_1 = require("fs");
13
13
  const os_1 = require("os");
@@ -15,6 +15,39 @@ const path_1 = require("path");
15
15
  const rimraf = require("rimraf");
16
16
  const workspace_schema_1 = require("../lib/config/workspace-schema");
17
17
  const spinner_1 = require("./spinner");
18
+ async function installAllPackages(packageManager = workspace_schema_1.PackageManager.Npm, extraArgs = [], cwd = process.cwd()) {
19
+ const packageManagerArgs = getPackageManagerArguments(packageManager);
20
+ const installArgs = [];
21
+ if (packageManagerArgs.installAll) {
22
+ installArgs.push(packageManagerArgs.installAll);
23
+ }
24
+ installArgs.push(packageManagerArgs.silent);
25
+ const spinner = new spinner_1.Spinner();
26
+ spinner.start('Installing packages...');
27
+ const bufferedOutput = [];
28
+ return new Promise((resolve, reject) => {
29
+ var _a, _b;
30
+ const childProcess = child_process_1.spawn(packageManager, [...installArgs, ...extraArgs], {
31
+ stdio: 'pipe',
32
+ shell: true,
33
+ cwd,
34
+ }).on('close', (code) => {
35
+ if (code === 0) {
36
+ spinner.succeed('Packages successfully installed.');
37
+ resolve(0);
38
+ }
39
+ else {
40
+ spinner.stop();
41
+ bufferedOutput.forEach(({ stream, data }) => stream.write(data));
42
+ spinner.fail('Package install failed, see above.');
43
+ reject(1);
44
+ }
45
+ });
46
+ (_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => bufferedOutput.push({ stream: process.stdout, data: data }));
47
+ (_b = childProcess.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => bufferedOutput.push({ stream: process.stderr, data: data }));
48
+ });
49
+ }
50
+ exports.installAllPackages = installAllPackages;
18
51
  async function installPackage(packageName, packageManager = workspace_schema_1.PackageManager.Npm, save = true, extraArgs = [], cwd = process.cwd()) {
19
52
  const packageManagerArgs = getPackageManagerArguments(packageManager);
20
53
  const installArgs = [
@@ -86,19 +119,19 @@ async function installTempPackage(packageName, packageManager = workspace_schema
86
119
  ];
87
120
  return {
88
121
  status: await installPackage(packageName, packageManager, true, installArgs, tempPath),
89
- tempPath,
122
+ tempNodeModules,
90
123
  };
91
124
  }
92
125
  exports.installTempPackage = installTempPackage;
93
126
  async function runTempPackageBin(packageName, packageManager = workspace_schema_1.PackageManager.Npm, args = []) {
94
- const { status: code, tempPath } = await installTempPackage(packageName, packageManager);
127
+ const { status: code, tempNodeModules } = await installTempPackage(packageName, packageManager);
95
128
  if (code !== 0) {
96
129
  return code;
97
130
  }
98
131
  // Remove version/tag etc... from package name
99
132
  // Ex: @angular/cli@latest -> @angular/cli
100
133
  const packageNameNoVersion = packageName.substring(0, packageName.lastIndexOf('@'));
101
- const pkgLocation = path_1.join(tempPath, packageNameNoVersion);
134
+ const pkgLocation = path_1.join(tempNodeModules, packageNameNoVersion);
102
135
  const packageJsonPath = path_1.join(pkgLocation, 'package.json');
103
136
  // Get a binary location for this package
104
137
  let binPath;
@@ -115,7 +148,7 @@ async function runTempPackageBin(packageName, packageManager = workspace_schema_
115
148
  if (!binPath) {
116
149
  throw new Error(`Cannot locate bin for temporary package: ${packageNameNoVersion}.`);
117
150
  }
118
- const argv = [binPath, ...args];
151
+ const argv = [`'${binPath}'`, ...args];
119
152
  const { status, error } = child_process_1.spawnSync('node', argv, {
120
153
  stdio: 'inherit',
121
154
  shell: true,
@@ -146,6 +179,7 @@ function getPackageManagerArguments(packageManager) {
146
179
  silent: '--silent',
147
180
  saveDev: '--save-dev',
148
181
  install: 'add',
182
+ installAll: 'install',
149
183
  prefix: '--prefix',
150
184
  noLockfile: '--no-lockfile',
151
185
  };
@@ -154,6 +188,7 @@ function getPackageManagerArguments(packageManager) {
154
188
  silent: '--quiet',
155
189
  saveDev: '--save-dev',
156
190
  install: 'install',
191
+ installAll: 'install',
157
192
  prefix: '--prefix',
158
193
  noLockfile: '--no-package-lock',
159
194
  };