@angular/cli 13.0.0-rc.1 → 13.0.0-rc.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.
@@ -26,6 +26,15 @@ const package_metadata_1 = require("../utilities/package-metadata");
26
26
  const prompt_1 = require("../utilities/prompt");
27
27
  const spinner_1 = require("../utilities/spinner");
28
28
  const tty_1 = require("../utilities/tty");
29
+ /**
30
+ * The set of packages that should have certain versions excluded from consideration
31
+ * when attempting to find a compatible version for a package.
32
+ * The key is a package name and the value is a SemVer range of versions to exclude.
33
+ */
34
+ const packageVersionExclusions = {
35
+ // @angular/localize@9.x versions do not have peer dependencies setup
36
+ '@angular/localize': '9.x',
37
+ };
29
38
  class AddCommand extends schematic_command_1.SchematicCommand {
30
39
  constructor() {
31
40
  super(...arguments);
@@ -39,6 +48,7 @@ class AddCommand extends schematic_command_1.SchematicCommand {
39
48
  return super.initialize(options);
40
49
  }
41
50
  }
51
+ // eslint-disable-next-line max-lines-per-function
42
52
  async run(options) {
43
53
  var _a;
44
54
  await (0, package_manager_1.ensureCompatibleNpm)(this.context.root);
@@ -86,7 +96,12 @@ class AddCommand extends schematic_command_1.SchematicCommand {
86
96
  spinner.fail('Unable to load package information from registry: ' + e.message);
87
97
  return 1;
88
98
  }
99
+ // Start with the version tagged as `latest` if it exists
89
100
  const latestManifest = packageMetadata.tags['latest'];
101
+ if (latestManifest) {
102
+ packageIdentifier = npm_package_arg_1.default.resolve(latestManifest.name, latestManifest.version);
103
+ }
104
+ // Adjust the version based on name and peer dependencies
90
105
  if (latestManifest && Object.keys(latestManifest.peerDependencies).length === 0) {
91
106
  if (latestManifest.name === '@angular/pwa') {
92
107
  const version = await this.findProjectVersion('@angular/cli');
@@ -97,24 +112,36 @@ class AddCommand extends schematic_command_1.SchematicCommand {
97
112
  packageIdentifier = npm_package_arg_1.default.resolve('@angular/pwa', '0.12');
98
113
  }
99
114
  }
100
- else {
101
- packageIdentifier = npm_package_arg_1.default.resolve(latestManifest.name, latestManifest.version);
102
- }
103
115
  spinner.succeed(`Found compatible package version: ${color_1.colors.grey(packageIdentifier.toString())}.`);
104
116
  }
105
117
  else if (!latestManifest || (await this.hasMismatchedPeer(latestManifest))) {
106
118
  // 'latest' is invalid so search for most recent matching package
107
- const versionManifests = Object.values(packageMetadata.versions).filter((value) => !(0, semver_1.prerelease)(value.version) && !value.deprecated);
119
+ const versionExclusions = packageVersionExclusions[packageMetadata.name];
120
+ const versionManifests = Object.values(packageMetadata.versions).filter((value) => {
121
+ // Prerelease versions are not stable and should not be considered by default
122
+ if ((0, semver_1.prerelease)(value.version)) {
123
+ return false;
124
+ }
125
+ // Deprecated versions should not be used or considered
126
+ if (value.deprecated) {
127
+ return false;
128
+ }
129
+ // Excluded package versions should not be considered
130
+ if (versionExclusions && (0, semver_1.satisfies)(value.version, versionExclusions)) {
131
+ return false;
132
+ }
133
+ return true;
134
+ });
108
135
  versionManifests.sort((a, b) => (0, semver_1.rcompare)(a.version, b.version, true));
109
136
  let newIdentifier;
110
137
  for (const versionManifest of versionManifests) {
111
138
  if (!(await this.hasMismatchedPeer(versionManifest))) {
112
- newIdentifier = npm_package_arg_1.default.resolve(packageIdentifier.name, versionManifest.version);
139
+ newIdentifier = npm_package_arg_1.default.resolve(versionManifest.name, versionManifest.version);
113
140
  break;
114
141
  }
115
142
  }
116
143
  if (!newIdentifier) {
117
- spinner.warn("Unable to find compatible package. Using 'latest'.");
144
+ spinner.warn("Unable to find compatible package. Using 'latest' tag.");
118
145
  }
119
146
  else {
120
147
  packageIdentifier = newIdentifier;
@@ -122,7 +149,6 @@ class AddCommand extends schematic_command_1.SchematicCommand {
122
149
  }
123
150
  }
124
151
  else {
125
- packageIdentifier = npm_package_arg_1.default.resolve(latestManifest.name, latestManifest.version);
126
152
  spinner.succeed(`Found compatible package version: ${color_1.colors.grey(packageIdentifier.toString())}.`);
127
153
  }
128
154
  }
@@ -215,7 +215,7 @@ class UpdateCommand extends command_1.Command {
215
215
  }
216
216
  // eslint-disable-next-line max-lines-per-function
217
217
  async run(options) {
218
- var _a, _b;
218
+ var _a;
219
219
  await (0, package_manager_1.ensureCompatibleNpm)(this.context.root);
220
220
  // Check if the current installed CLI version is older than the latest version.
221
221
  if (!disableVersionCheck && (await this.checkCLILatestVersion(options.verbose, options.next))) {
@@ -463,30 +463,32 @@ class UpdateCommand extends command_1.Command {
463
463
  this.logger.error(`Package specified by '${requestIdentifier.raw}' does not exist within the registry.`);
464
464
  return 1;
465
465
  }
466
- if (((_a = node.package) === null || _a === void 0 ? void 0 : _a.name) === '@angular/cli') {
467
- // Migrations for non LTS versions of Angular CLI are no longer included in @schematics/angular v12.
466
+ if (manifest.version === ((_a = node.package) === null || _a === void 0 ? void 0 : _a.version)) {
467
+ this.logger.info(`Package '${packageName}' is already up to date.`);
468
+ continue;
469
+ }
470
+ if (node.package && /^@(?:angular|nguniversal)\//.test(node.package.name)) {
471
+ const { name, version } = node.package;
468
472
  const toBeInstalledMajorVersion = +manifest.version.split('.')[0];
469
- const currentMajorVersion = +node.package.version.split('.')[0];
470
- if (currentMajorVersion < 10 && toBeInstalledMajorVersion >= 12) {
471
- const updateVersions = {
472
- 1: 6,
473
- 6: 7,
474
- 7: 8,
475
- 8: 9,
476
- 9: 10,
477
- };
478
- const updateTo = updateVersions[currentMajorVersion];
479
- this.logger.error('Updating multiple major versions at once is not recommended. ' +
480
- `Run 'ng update @angular/cli@${updateTo}' in your workspace directory ` +
481
- `to update to latest '${updateTo}.x' version of '@angular/cli'.\n\n` +
482
- 'For more information about the update process, see https://update.angular.io/.');
473
+ const currentMajorVersion = +version.split('.')[0];
474
+ if (toBeInstalledMajorVersion - currentMajorVersion > 1) {
475
+ // Only allow updating a single version at a time.
476
+ if (currentMajorVersion < 6) {
477
+ // Before version 6, the major versions were not always sequential.
478
+ // Example @angular/core skipped version 3, @angular/cli skipped versions 2-5.
479
+ this.logger.error(`Updating multiple major versions of '${name}' at once is not supported. Please migrate each major version individually.\n` +
480
+ `For more information about the update process, see https://update.angular.io/.`);
481
+ }
482
+ else {
483
+ const nextMajorVersionFromCurrent = currentMajorVersion + 1;
484
+ this.logger.error(`Updating multiple major versions of '${name}' at once is not supported. Please migrate each major version individually.\n` +
485
+ `Run 'ng update ${name}@${nextMajorVersionFromCurrent}' in your workspace directory ` +
486
+ `to update to latest '${nextMajorVersionFromCurrent}.x' version of '${name}'.\n\n` +
487
+ `For more information about the update process, see https://update.angular.io/?v=${currentMajorVersion}.0-${nextMajorVersionFromCurrent}.0`);
488
+ }
483
489
  return 1;
484
490
  }
485
491
  }
486
- if (manifest.version === ((_b = node.package) === null || _b === void 0 ? void 0 : _b.version)) {
487
- this.logger.info(`Package '${packageName}' is already up to date.`);
488
- continue;
489
- }
490
492
  packagesToUpdate.push(requestIdentifier.toString());
491
493
  }
492
494
  if (packagesToUpdate.length === 0) {
@@ -1648,7 +1648,7 @@
1648
1648
  "inlineCritical": {
1649
1649
  "type": "boolean",
1650
1650
  "description": "Extract and inline critical CSS definitions to improve first paint time.",
1651
- "default": false
1651
+ "default": true
1652
1652
  }
1653
1653
  },
1654
1654
  "additionalProperties": false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "13.0.0-rc.1",
3
+ "version": "13.0.0-rc.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.1300.0-rc.1",
32
- "@angular-devkit/core": "13.0.0-rc.1",
33
- "@angular-devkit/schematics": "13.0.0-rc.1",
34
- "@schematics/angular": "13.0.0-rc.1",
31
+ "@angular-devkit/architect": "0.1300.0-rc.2",
32
+ "@angular-devkit/core": "13.0.0-rc.2",
33
+ "@angular-devkit/schematics": "13.0.0-rc.2",
34
+ "@schematics/angular": "13.0.0-rc.2",
35
35
  "@yarnpkg/lockfile": "1.1.0",
36
36
  "ansi-colors": "4.1.1",
37
37
  "debug": "4.3.2",
@@ -40,7 +40,7 @@
40
40
  "jsonc-parser": "3.0.0",
41
41
  "npm-package-arg": "8.1.5",
42
42
  "npm-pick-manifest": "6.1.1",
43
- "open": "8.3.0",
43
+ "open": "8.4.0",
44
44
  "ora": "5.4.1",
45
45
  "pacote": "12.0.2",
46
46
  "resolve": "1.20.0",
@@ -51,12 +51,12 @@
51
51
  "ng-update": {
52
52
  "migrations": "@schematics/angular/migrations/migration-collection.json",
53
53
  "packageGroup": {
54
- "@angular/cli": "13.0.0-rc.1",
55
- "@angular-devkit/architect": "0.1300.0-rc.1",
56
- "@angular-devkit/build-angular": "13.0.0-rc.1",
57
- "@angular-devkit/build-webpack": "0.1300.0-rc.1",
58
- "@angular-devkit/core": "13.0.0-rc.1",
59
- "@angular-devkit/schematics": "13.0.0-rc.1"
54
+ "@angular/cli": "13.0.0-rc.2",
55
+ "@angular-devkit/architect": "0.1300.0-rc.2",
56
+ "@angular-devkit/build-angular": "13.0.0-rc.2",
57
+ "@angular-devkit/build-webpack": "0.1300.0-rc.2",
58
+ "@angular-devkit/core": "13.0.0-rc.2",
59
+ "@angular-devkit/schematics": "13.0.0-rc.2"
60
60
  }
61
61
  },
62
62
  "engines": {
@@ -40,7 +40,7 @@ class Spinner {
40
40
  this.spinner.fail(text && color_1.colors.redBright(text));
41
41
  }
42
42
  warn(text) {
43
- this.spinner.fail(text && color_1.colors.yellowBright(text));
43
+ this.spinner.warn(text && color_1.colors.yellowBright(text));
44
44
  }
45
45
  stop() {
46
46
  this.spinner.stop();