@angular/cli 12.0.0-rc.2 → 12.0.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.
@@ -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;
@@ -54,17 +54,22 @@ function parseJsonPath(path) {
54
54
  return result.filter((fragment) => fragment != null);
55
55
  }
56
56
  function normalizeValue(value) {
57
+ var _a, _b;
57
58
  const valueString = `${value}`.trim();
58
- if (valueString === 'true') {
59
- return true;
59
+ switch (valueString) {
60
+ case 'true':
61
+ return true;
62
+ case 'false':
63
+ return false;
64
+ case 'null':
65
+ return null;
66
+ case 'undefined':
67
+ return undefined;
60
68
  }
61
- else if (valueString === 'false') {
62
- return false;
63
- }
64
- else if (isFinite(+valueString)) {
69
+ if (isFinite(+valueString)) {
65
70
  return +valueString;
66
71
  }
67
- return value || undefined;
72
+ return (_b = (_a = json_file_1.parseJson(valueString)) !== null && _a !== void 0 ? _a : value) !== null && _b !== void 0 ? _b : undefined;
68
73
  }
69
74
  class ConfigCommand extends command_1.Command {
70
75
  async run(options) {
@@ -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.
@@ -12,7 +12,7 @@ export declare class UpdateCommand extends Command<UpdateCommandSchema> {
12
12
  readonly allowMissingWorkspace = true;
13
13
  private workflow;
14
14
  private packageManager;
15
- initialize(): Promise<void>;
15
+ initialize(options: UpdateCommandSchema & Arguments): Promise<void>;
16
16
  private executeSchematic;
17
17
  /**
18
18
  * @return Whether or not the migration was performed successfully.
@@ -42,10 +42,11 @@ class UpdateCommand extends command_1.Command {
42
42
  this.allowMissingWorkspace = true;
43
43
  this.packageManager = workspace_schema_1.PackageManager.Npm;
44
44
  }
45
- async initialize() {
45
+ async initialize(options) {
46
46
  this.packageManager = await package_manager_1.getPackageManager(this.context.root);
47
47
  this.workflow = new tools_1.NodeWorkflow(this.context.root, {
48
48
  packageManager: this.packageManager,
49
+ packageManagerForce: options.force,
49
50
  // __dirname -> favor @schematics/update from this package
50
51
  // Otherwise, use packages from the active workspace (migrations)
51
52
  resolvePaths: [__dirname, this.context.root],
@@ -474,6 +475,21 @@ class UpdateCommand extends command_1.Command {
474
475
  packageManager: this.packageManager,
475
476
  packages: packagesToUpdate,
476
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
+ }
477
493
  if (success && options.createCommits) {
478
494
  const committed = this.commit(`Angular CLI update for packages - ${packagesToUpdate.join(', ')}`);
479
495
  if (!committed) {
@@ -15,7 +15,8 @@ export interface Schema {
15
15
  */
16
16
  createCommits?: boolean;
17
17
  /**
18
- * If false, will error out if installed packages are incompatible with the update.
18
+ * Ignore peer dependency version mismatches. Passes the `--force` flag to the package
19
+ * manager when installing packages.
19
20
  */
20
21
  force?: boolean;
21
22
  /**
@@ -28,7 +28,7 @@
28
28
  }
29
29
  },
30
30
  "force": {
31
- "description": "If false, will error out if installed packages are incompatible with the update.",
31
+ "description": "Ignore peer dependency version mismatches. Passes the `--force` flag to the package manager when installing packages.",
32
32
  "default": false,
33
33
  "type": "boolean"
34
34
  },
@@ -351,12 +351,14 @@
351
351
  }
352
352
  }
353
353
  },
354
+ "additionalProperties": false,
354
355
  "required": [
355
356
  "builder"
356
357
  ]
357
358
  },
358
359
  {
359
360
  "type": "object",
361
+ "additionalProperties": false,
360
362
  "properties": {
361
363
  "builder": {
362
364
  "const": "@angular-devkit/build-angular:app-shell"
@@ -378,6 +380,7 @@
378
380
  },
379
381
  {
380
382
  "type": "object",
383
+ "additionalProperties": false,
381
384
  "properties": {
382
385
  "builder": {
383
386
  "const": "@angular-devkit/build-angular:browser"
@@ -399,6 +402,7 @@
399
402
  },
400
403
  {
401
404
  "type": "object",
405
+ "additionalProperties": false,
402
406
  "properties": {
403
407
  "builder": {
404
408
  "const": "@angular-devkit/build-angular:dev-server"
@@ -420,6 +424,7 @@
420
424
  },
421
425
  {
422
426
  "type": "object",
427
+ "additionalProperties": false,
423
428
  "properties": {
424
429
  "builder": {
425
430
  "const": "@angular-devkit/build-angular:extract-i18n"
@@ -441,6 +446,7 @@
441
446
  },
442
447
  {
443
448
  "type": "object",
449
+ "additionalProperties": false,
444
450
  "properties": {
445
451
  "builder": {
446
452
  "const": "@angular-devkit/build-angular:karma"
@@ -462,6 +468,7 @@
462
468
  },
463
469
  {
464
470
  "type": "object",
471
+ "additionalProperties": false,
465
472
  "properties": {
466
473
  "builder": {
467
474
  "const": "@angular-devkit/build-angular:protractor"
@@ -483,6 +490,7 @@
483
490
  },
484
491
  {
485
492
  "type": "object",
493
+ "additionalProperties": false,
486
494
  "properties": {
487
495
  "builder": {
488
496
  "const": "@angular-devkit/build-angular:server"
@@ -504,6 +512,7 @@
504
512
  },
505
513
  {
506
514
  "type": "object",
515
+ "additionalProperties": false,
507
516
  "properties": {
508
517
  "builder": {
509
518
  "const": "@angular-devkit/build-angular:tslint"
@@ -525,10 +534,15 @@
525
534
  },
526
535
  {
527
536
  "type": "object",
537
+ "additionalProperties": false,
528
538
  "properties": {
529
539
  "builder": {
530
540
  "const": "@angular-devkit/build-angular:ng-packagr"
531
541
  },
542
+ "defaultConfiguration": {
543
+ "type": "string",
544
+ "description": "A default named configuration to use when a target configuration is not provided."
545
+ },
532
546
  "options": {
533
547
  "$ref": "#/definitions/AngularDevkitBuildAngularNgPackagrSchema"
534
548
  },
@@ -2172,7 +2186,7 @@
2172
2186
  },
2173
2187
  "proxyConfig": {
2174
2188
  "type": "string",
2175
- "description": "Proxy configuration file."
2189
+ "description": "Proxy configuration file. For more information, see https://angular.io/guide/build#proxying-to-a-backend-server."
2176
2190
  },
2177
2191
  "ssl": {
2178
2192
  "type": "boolean",
@@ -252,6 +252,7 @@ class ArchitectCommand extends command_1.Command {
252
252
  }
253
253
  }
254
254
  _makeTargetSpecifier(commandOptions) {
255
+ var _a, _b, _c;
255
256
  let project, target, configuration;
256
257
  if (commandOptions.target) {
257
258
  [project, target, configuration] = commandOptions.target.split(':');
@@ -263,9 +264,14 @@ class ArchitectCommand extends command_1.Command {
263
264
  project = commandOptions.project;
264
265
  target = this.target;
265
266
  if (commandOptions.prod) {
267
+ const defaultConfig = project &&
268
+ target &&
269
+ ((_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);
270
+ this.logger.warn(defaultConfig === 'production'
271
+ ? 'Option "--prod" is deprecated: No need to use this option as this builder defaults to configuration "production".'
272
+ : 'Option "--prod" is deprecated: Use "--configuration production" instead.');
266
273
  // The --prod flag will always be the first configuration, available to be overwritten
267
274
  // by following configurations.
268
- this.logger.warn('Option "--prod" is deprecated: Use "--configuration production" instead.');
269
275
  configuration = 'production';
270
276
  }
271
277
  if (commandOptions.configuration) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "12.0.0-rc.2",
3
+ "version": "12.0.2",
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.2",
32
- "@angular-devkit/core": "12.0.0-rc.2",
33
- "@angular-devkit/schematics": "12.0.0-rc.2",
34
- "@schematics/angular": "12.0.0-rc.2",
31
+ "@angular-devkit/architect": "0.1200.2",
32
+ "@angular-devkit/core": "12.0.2",
33
+ "@angular-devkit/schematics": "12.0.2",
34
+ "@schematics/angular": "12.0.2",
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,12 +52,12 @@
52
52
  "ng-update": {
53
53
  "migrations": "@schematics/angular/migrations/migration-collection.json",
54
54
  "packageGroup": {
55
- "@angular/cli": "12.0.0-rc.2",
56
- "@angular-devkit/architect": "0.1200.0-rc.2",
57
- "@angular-devkit/build-angular": "12.0.0-rc.2",
58
- "@angular-devkit/build-webpack": "0.1200.0-rc.2",
59
- "@angular-devkit/core": "12.0.0-rc.2",
60
- "@angular-devkit/schematics": "12.0.0-rc.2"
55
+ "@angular/cli": "12.0.2",
56
+ "@angular-devkit/architect": "0.1200.2",
57
+ "@angular-devkit/build-angular": "12.0.2",
58
+ "@angular-devkit/build-webpack": "0.1200.2",
59
+ "@angular-devkit/core": "12.0.2",
60
+ "@angular-devkit/schematics": "12.0.2"
61
61
  }
62
62
  },
63
63
  "engines": {
@@ -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
  };