@angular/cli 13.0.0-rc.1 → 13.1.0-next.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.
- package/commands/add-impl.js +33 -7
- package/commands/update-impl.js +23 -21
- package/lib/config/schema.json +1 -1
- package/package.json +12 -12
- package/src/commands/update/schematic/index.js +32 -7
- package/utilities/spinner.js +1 -1
package/commands/add-impl.js
CHANGED
|
@@ -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
|
|
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(
|
|
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
|
}
|
package/commands/update-impl.js
CHANGED
|
@@ -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
|
|
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.
|
|
467
|
-
|
|
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 = +
|
|
470
|
-
if (
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
6
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
`
|
|
481
|
-
|
|
482
|
-
|
|
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) {
|
package/lib/config/schema.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.1.0-next.0",
|
|
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.
|
|
32
|
-
"@angular-devkit/core": "13.
|
|
33
|
-
"@angular-devkit/schematics": "13.
|
|
34
|
-
"@schematics/angular": "13.
|
|
31
|
+
"@angular-devkit/architect": "0.1301.0-next.0",
|
|
32
|
+
"@angular-devkit/core": "13.1.0-next.0",
|
|
33
|
+
"@angular-devkit/schematics": "13.1.0-next.0",
|
|
34
|
+
"@schematics/angular": "13.1.0-next.0",
|
|
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.
|
|
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.
|
|
55
|
-
"@angular-devkit/architect": "0.
|
|
56
|
-
"@angular-devkit/build-angular": "13.
|
|
57
|
-
"@angular-devkit/build-webpack": "0.
|
|
58
|
-
"@angular-devkit/core": "13.
|
|
59
|
-
"@angular-devkit/schematics": "13.
|
|
54
|
+
"@angular/cli": "13.1.0-next.0",
|
|
55
|
+
"@angular-devkit/architect": "0.1301.0-next.0",
|
|
56
|
+
"@angular-devkit/build-angular": "13.1.0-next.0",
|
|
57
|
+
"@angular-devkit/build-webpack": "0.1301.0-next.0",
|
|
58
|
+
"@angular-devkit/core": "13.1.0-next.0",
|
|
59
|
+
"@angular-devkit/schematics": "13.1.0-next.0"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
@@ -320,13 +320,34 @@ function _usageMessage(options, infoMap, logger) {
|
|
|
320
320
|
const packageGroups = new Map();
|
|
321
321
|
const packagesToUpdate = [...infoMap.entries()]
|
|
322
322
|
.map(([name, info]) => {
|
|
323
|
-
|
|
323
|
+
var _a, _b;
|
|
324
|
+
let tag = options.next
|
|
324
325
|
? info.npmPackageJson['dist-tags']['next']
|
|
325
326
|
? 'next'
|
|
326
327
|
: 'latest'
|
|
327
328
|
: 'latest';
|
|
328
|
-
|
|
329
|
-
|
|
329
|
+
let version = info.npmPackageJson['dist-tags'][tag];
|
|
330
|
+
let target = info.npmPackageJson.versions[version];
|
|
331
|
+
const versionDiff = semver.diff(info.installed.version, version);
|
|
332
|
+
if (versionDiff !== 'patch' &&
|
|
333
|
+
versionDiff !== 'minor' &&
|
|
334
|
+
/^@(?:angular|nguniversal)\//.test(name)) {
|
|
335
|
+
const installedMajorVersion = (_a = semver.parse(info.installed.version)) === null || _a === void 0 ? void 0 : _a.major;
|
|
336
|
+
const toInstallMajorVersion = (_b = semver.parse(version)) === null || _b === void 0 ? void 0 : _b.major;
|
|
337
|
+
if (installedMajorVersion !== undefined &&
|
|
338
|
+
toInstallMajorVersion !== undefined &&
|
|
339
|
+
installedMajorVersion < toInstallMajorVersion - 1) {
|
|
340
|
+
const nextMajorVersion = `${installedMajorVersion + 1}.`;
|
|
341
|
+
const nextMajorVersions = Object.keys(info.npmPackageJson.versions)
|
|
342
|
+
.filter((v) => v.startsWith(nextMajorVersion))
|
|
343
|
+
.sort((a, b) => (a > b ? -1 : 1));
|
|
344
|
+
if (nextMajorVersions.length) {
|
|
345
|
+
version = nextMajorVersions[0];
|
|
346
|
+
target = info.npmPackageJson.versions[version];
|
|
347
|
+
tag = '';
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
330
351
|
return {
|
|
331
352
|
name,
|
|
332
353
|
info,
|
|
@@ -342,10 +363,11 @@ function _usageMessage(options, infoMap, logger) {
|
|
|
342
363
|
return target['ng-update'];
|
|
343
364
|
})
|
|
344
365
|
.map(({ name, info, version, tag, target }) => {
|
|
366
|
+
var _a, _b;
|
|
345
367
|
// Look for packageGroup.
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
const packageGroupName =
|
|
368
|
+
const packageGroup = (_a = target['ng-update']) === null || _a === void 0 ? void 0 : _a['packageGroup'];
|
|
369
|
+
if (packageGroup) {
|
|
370
|
+
const packageGroupName = packageGroup === null || packageGroup === void 0 ? void 0 : packageGroup[0];
|
|
349
371
|
if (packageGroupName) {
|
|
350
372
|
if (packageGroups.has(name)) {
|
|
351
373
|
return null;
|
|
@@ -356,7 +378,10 @@ function _usageMessage(options, infoMap, logger) {
|
|
|
356
378
|
}
|
|
357
379
|
}
|
|
358
380
|
let command = `ng update ${name}`;
|
|
359
|
-
if (tag
|
|
381
|
+
if (!tag) {
|
|
382
|
+
command += `@${((_b = semver.parse(version)) === null || _b === void 0 ? void 0 : _b.major) || version}`;
|
|
383
|
+
}
|
|
384
|
+
else if (tag == 'next') {
|
|
360
385
|
command += ' --next';
|
|
361
386
|
}
|
|
362
387
|
return [name, `${info.installed.version} -> ${version} `, command];
|
package/utilities/spinner.js
CHANGED
|
@@ -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.
|
|
43
|
+
this.spinner.warn(text && color_1.colors.yellowBright(text));
|
|
44
44
|
}
|
|
45
45
|
stop() {
|
|
46
46
|
this.spinner.stop();
|