@angular/cli 13.0.0-next.8 → 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.
package/bin/ng.js CHANGED
@@ -24,8 +24,8 @@ try {
24
24
  // These may not support ES2015 features such as const/let/async/await/etc.
25
25
  // These would then crash with a hard to diagnose error message.
26
26
  var version = process.versions.node.split('.').map((part) => Number(part));
27
- if (version[0] % 2 === 1 && version[0] > 14) {
28
- // Allow new odd numbered releases with a warning (currently v15+)
27
+ if (version[0] % 2 === 1 && version[0] > 16) {
28
+ // Allow new odd numbered releases with a warning (currently v17+)
29
29
  console.warn(
30
30
  'Node.js version ' +
31
31
  process.version +
@@ -38,15 +38,17 @@ if (version[0] % 2 === 1 && version[0] > 14) {
38
38
  } else if (
39
39
  version[0] < 12 ||
40
40
  version[0] === 13 ||
41
+ version[0] === 15 ||
41
42
  (version[0] === 12 && version[1] < 20) ||
42
- (version[0] === 14 && version[1] < 15)
43
+ (version[0] === 14 && version[1] < 15) ||
44
+ (version[0] === 16 && version[1] < 10)
43
45
  ) {
44
- // Error and exit if less than 12.20 or 13.x or less than 14.15
46
+ // Error and exit if less than 12.20 or 13.x or less than 14.15 or 15.x or less than 16.10
45
47
  console.error(
46
48
  'Node.js version ' +
47
49
  process.version +
48
50
  ' detected.\n' +
49
- 'The Angular CLI requires a minimum Node.js version of either v12.20 or v14.15.\n\n' +
51
+ 'The Angular CLI requires a minimum Node.js version of either v12.20, v14.15, or v16.10.\n\n' +
50
52
  'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
51
53
  );
52
54
 
@@ -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
  }
@@ -20,7 +20,10 @@ const validCliPaths = new Map([
20
20
  ['cli.packageManager', undefined],
21
21
  ['cli.analytics', undefined],
22
22
  ['cli.analyticsSharing.tracking', undefined],
23
- ['cli.analyticsSharing.uuid', (v) => (v ? `${v}` : (0, uuid_1.v4)())],
23
+ ['cli.analyticsSharing.uuid', (v) => (v === '' ? (0, uuid_1.v4)() : `${v}`)],
24
+ ['cli.cache.enabled', undefined],
25
+ ['cli.cache.environment', undefined],
26
+ ['cli.cache.path', undefined],
24
27
  ]);
25
28
  /**
26
29
  * Splits a JSON path string into fragments. Fragments can be used to get the value referenced
@@ -54,7 +57,6 @@ function parseJsonPath(path) {
54
57
  return result.filter((fragment) => fragment != null);
55
58
  }
56
59
  function normalizeValue(value) {
57
- var _a, _b;
58
60
  const valueString = `${value}`.trim();
59
61
  switch (valueString) {
60
62
  case 'true':
@@ -69,7 +71,16 @@ function normalizeValue(value) {
69
71
  if (isFinite(+valueString)) {
70
72
  return +valueString;
71
73
  }
72
- return (_b = (_a = (0, json_file_1.parseJson)(valueString)) !== null && _a !== void 0 ? _a : value) !== null && _b !== void 0 ? _b : undefined;
74
+ try {
75
+ // We use `JSON.parse` instead of `parseJson` because the latter will parse UUIDs
76
+ // and convert them into a numberic entities.
77
+ // Example: 73b61974-182c-48e4-b4c6-30ddf08c5c98 -> 73.
78
+ // These values should never contain comments, therefore using `JSON.parse` is safe.
79
+ return JSON.parse(valueString);
80
+ }
81
+ catch {
82
+ return value;
83
+ }
73
84
  }
74
85
  class ConfigCommand extends command_1.Command {
75
86
  async run(options) {
@@ -163,7 +163,7 @@ class UpdateCommand extends command_1.Command {
163
163
  */
164
164
  async executeMigrations(packageName, collectionPath, from, to, commit) {
165
165
  const collection = this.workflow.engine.createCollection(collectionPath);
166
- const migrationRange = new semver.Range('>' + (semver.prerelease(from) ? from.split('-')[0] + '-0' : from) + ' <=' + to);
166
+ const migrationRange = new semver.Range('>' + (semver.prerelease(from) ? from.split('-')[0] + '-0' : from) + ' <=' + to.split('-')[0]);
167
167
  const migrations = [];
168
168
  for (const name of collection.listSchematicNames()) {
169
169
  const schematic = this.workflow.engine.createSchematic(name, collection);
@@ -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) {
@@ -503,10 +505,21 @@ class UpdateCommand extends command_1.Command {
503
505
  try {
504
506
  // Remove existing node modules directory to provide a stronger guarantee that packages
505
507
  // will be hoisted into the correct locations.
506
- await fs.promises.rmdir(path.join(this.context.root, 'node_modules'), {
507
- recursive: true,
508
- maxRetries: 3,
509
- });
508
+ // The below should be removed and replaced with just `rm` when support for Node.Js 12 is removed.
509
+ const { rm, rmdir } = fs.promises;
510
+ if (rm) {
511
+ await rm(path.join(this.context.root, 'node_modules'), {
512
+ force: true,
513
+ recursive: true,
514
+ maxRetries: 3,
515
+ });
516
+ }
517
+ else {
518
+ await rmdir(path.join(this.context.root, 'node_modules'), {
519
+ recursive: true,
520
+ maxRetries: 3,
521
+ });
522
+ }
510
523
  }
511
524
  catch { }
512
525
  const result = await (0, install_package_1.installAllPackages)(this.packageManager, options.force ? ['--force'] : [], this.context.root);
@@ -19,7 +19,7 @@ const package_manager_1 = require("../utilities/package-manager");
19
19
  /**
20
20
  * Major versions of Node.js that are officially supported by Angular.
21
21
  */
22
- const SUPPORTED_NODE_MAJORS = [12, 14];
22
+ const SUPPORTED_NODE_MAJORS = [12, 14, 16];
23
23
  class VersionCommand extends command_1.Command {
24
24
  constructor() {
25
25
  super(...arguments);
package/lib/cli/index.js CHANGED
@@ -24,9 +24,9 @@ const isDebug = debugEnv !== undefined && debugEnv !== '0' && debugEnv.toLowerCa
24
24
  async function default_1(options) {
25
25
  // This node version check ensures that the requirements of the project instance of the CLI are met
26
26
  const version = process.versions.node.split('.').map((part) => Number(part));
27
- if (version[0] < 12 || (version[0] === 12 && version[1] < 14)) {
27
+ if (version[0] < 12 || (version[0] === 12 && version[1] < 20)) {
28
28
  process.stderr.write(`Node.js version ${process.version} detected.\n` +
29
- 'The Angular CLI requires a minimum v12.14.\n\n' +
29
+ 'The Angular CLI requires a minimum v12.20.\n\n' +
30
30
  'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n');
31
31
  return 3;
32
32
  }
@@ -79,10 +79,34 @@
79
79
  "tracking": {
80
80
  "description": "Analytics sharing info tracking ID.",
81
81
  "type": "string",
82
- "pattern": "^GA-\\d+-\\d+$"
82
+ "pattern": "^(GA|UA)?-\\d+-\\d+$"
83
83
  },
84
84
  "uuid": {
85
85
  "description": "Analytics sharing info universally unique identifier.",
86
+ "type": "string",
87
+ "format": "uuid"
88
+ }
89
+ }
90
+ },
91
+ "cache": {
92
+ "description": "Control disk cache.",
93
+ "type": "object",
94
+ "properties": {
95
+ "environment": {
96
+ "description": "Configure in which environment disk cache is enabled.",
97
+ "type": "string",
98
+ "enum": [
99
+ "local",
100
+ "ci",
101
+ "all"
102
+ ]
103
+ },
104
+ "enabled": {
105
+ "description": "Configure whether disk caching is enabled.",
106
+ "type": "boolean"
107
+ },
108
+ "path": {
109
+ "description": "Cache base path.",
86
110
  "type": "string"
87
111
  }
88
112
  }
@@ -19,6 +19,10 @@ export interface CliOptions {
19
19
  */
20
20
  analytics?: Analytics;
21
21
  analyticsSharing?: AnalyticsSharing;
22
+ /**
23
+ * Control disk cache.
24
+ */
25
+ cache?: Cache;
22
26
  /**
23
27
  * The default schematics collection to use.
24
28
  */
@@ -46,6 +50,31 @@ export interface AnalyticsSharing {
46
50
  */
47
51
  uuid?: string;
48
52
  }
53
+ /**
54
+ * Control disk cache.
55
+ */
56
+ export interface Cache {
57
+ /**
58
+ * Configure whether disk caching is enabled.
59
+ */
60
+ enabled?: boolean;
61
+ /**
62
+ * Configure in which environment disk cache is enabled.
63
+ */
64
+ environment?: Environment;
65
+ /**
66
+ * Cache base path.
67
+ */
68
+ path?: string;
69
+ }
70
+ /**
71
+ * Configure in which environment disk cache is enabled.
72
+ */
73
+ export declare enum Environment {
74
+ All = "all",
75
+ Ci = "ci",
76
+ Local = "local"
77
+ }
49
78
  /**
50
79
  * Specify which package manager tool to use.
51
80
  *
@@ -2,7 +2,16 @@
2
2
  // THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
3
3
  // CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.Implement = exports.SchematicsAngularComponentStyle = exports.ChangeDetection = exports.ViewEncapsulation = exports.SchematicsAngularApplicationStyle = exports.PackageManager = void 0;
5
+ exports.Implement = exports.SchematicsAngularComponentStyle = exports.ChangeDetection = exports.ViewEncapsulation = exports.SchematicsAngularApplicationStyle = exports.PackageManager = exports.Environment = void 0;
6
+ /**
7
+ * Configure in which environment disk cache is enabled.
8
+ */
9
+ var Environment;
10
+ (function (Environment) {
11
+ Environment["All"] = "all";
12
+ Environment["Ci"] = "ci";
13
+ Environment["Local"] = "local";
14
+ })(Environment = exports.Environment || (exports.Environment = {}));
6
15
  /**
7
16
  * Specify which package manager tool to use.
8
17
  *
@@ -182,7 +182,7 @@ async function promptProjectAnalytics(force = false) {
182
182
  if (answers.analytics) {
183
183
  console.log('');
184
184
  console.log(core_1.tags.stripIndent `
185
- Thank you for sharing anonymous usage data. Would you change your mind, the following
185
+ Thank you for sharing anonymous usage data. Should you change your mind, the following
186
186
  command will disable this feature entirely:
187
187
 
188
188
  ${color_1.colors.yellow('ng analytics project off')}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "13.0.0-next.8",
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,21 +28,21 @@
28
28
  },
29
29
  "homepage": "https://github.com/angular/angular-cli",
30
30
  "dependencies": {
31
- "@angular-devkit/architect": "0.1300.0-next.8",
32
- "@angular-devkit/core": "13.0.0-next.8",
33
- "@angular-devkit/schematics": "13.0.0-next.8",
34
- "@schematics/angular": "13.0.0-next.8",
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",
38
38
  "ini": "2.0.0",
39
- "inquirer": "8.1.5",
39
+ "inquirer": "8.2.0",
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.2.1",
43
+ "open": "8.4.0",
44
44
  "ora": "5.4.1",
45
- "pacote": "11.3.5",
45
+ "pacote": "12.0.2",
46
46
  "resolve": "1.20.0",
47
47
  "semver": "7.3.5",
48
48
  "symbol-observable": "4.0.0",
@@ -51,17 +51,17 @@
51
51
  "ng-update": {
52
52
  "migrations": "@schematics/angular/migrations/migration-collection.json",
53
53
  "packageGroup": {
54
- "@angular/cli": "13.0.0-next.8",
55
- "@angular-devkit/architect": "0.1300.0-next.8",
56
- "@angular-devkit/build-angular": "13.0.0-next.8",
57
- "@angular-devkit/build-webpack": "0.1300.0-next.8",
58
- "@angular-devkit/core": "13.0.0-next.8",
59
- "@angular-devkit/schematics": "13.0.0-next.8"
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": {
63
- "node": "^12.20.0 || >=14.0.0",
64
- "npm": "^6.11.0 || ^7.5.6",
63
+ "node": "^12.20.0 || ^14.15.0 || >=16.10.0",
64
+ "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
65
65
  "yarn": ">= 1.13.0"
66
66
  }
67
67
  }
@@ -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();