@angular/cli 12.2.0-next.3 → 12.2.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/commands/add-impl.d.ts +1 -0
- package/commands/add-impl.js +41 -29
- package/commands/e2e-long.md +4 -2
- package/commands/update-impl.js +5 -2
- package/lib/config/schema.json +1 -1
- package/lib/config/workspace-schema.d.ts +2 -2
- package/lib/config/workspace-schema.js +1 -1
- package/package.json +11 -11
- package/utilities/package-metadata.js +4 -7
package/commands/add-impl.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class AddCommand extends SchematicCommand<AddCommandSchema> {
|
|
|
12
12
|
readonly allowPrivateSchematics = true;
|
|
13
13
|
initialize(options: AddCommandSchema & Arguments): Promise<void>;
|
|
14
14
|
run(options: AddCommandSchema & Arguments): Promise<number | void>;
|
|
15
|
+
private isProjectVersionValid;
|
|
15
16
|
reportAnalytics(paths: string[], options: AddCommandSchema & Arguments, dimensions?: (boolean | number | string)[], metrics?: (boolean | number | string)[]): Promise<void>;
|
|
16
17
|
private isPackageInstalled;
|
|
17
18
|
private executeSchematic;
|
package/commands/add-impl.js
CHANGED
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.AddCommand = void 0;
|
|
11
14
|
const core_1 = require("@angular-devkit/core");
|
|
12
15
|
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
16
|
+
const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
|
|
13
17
|
const path_1 = require("path");
|
|
14
18
|
const semver_1 = require("semver");
|
|
15
19
|
const workspace_schema_1 = require("../lib/config/workspace-schema");
|
|
@@ -22,7 +26,6 @@ const package_metadata_1 = require("../utilities/package-metadata");
|
|
|
22
26
|
const prompt_1 = require("../utilities/prompt");
|
|
23
27
|
const spinner_1 = require("../utilities/spinner");
|
|
24
28
|
const tty_1 = require("../utilities/tty");
|
|
25
|
-
const npa = require('npm-package-arg');
|
|
26
29
|
class AddCommand extends schematic_command_1.SchematicCommand {
|
|
27
30
|
constructor() {
|
|
28
31
|
super(...arguments);
|
|
@@ -46,28 +49,16 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
46
49
|
}
|
|
47
50
|
let packageIdentifier;
|
|
48
51
|
try {
|
|
49
|
-
packageIdentifier =
|
|
52
|
+
packageIdentifier = npm_package_arg_1.default(options.collection);
|
|
50
53
|
}
|
|
51
54
|
catch (e) {
|
|
52
55
|
this.logger.error(e.message);
|
|
53
56
|
return 1;
|
|
54
57
|
}
|
|
55
|
-
if (packageIdentifier.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (packageIdentifier.type === 'range') {
|
|
60
|
-
validVersion = semver_1.satisfies(installedVersion, packageIdentifier.fetchSpec);
|
|
61
|
-
}
|
|
62
|
-
else if (packageIdentifier.type === 'version') {
|
|
63
|
-
const v1 = semver_1.valid(packageIdentifier.fetchSpec);
|
|
64
|
-
const v2 = semver_1.valid(installedVersion);
|
|
65
|
-
validVersion = v1 !== null && v1 === v2;
|
|
66
|
-
}
|
|
67
|
-
else if (!packageIdentifier.rawSpec) {
|
|
68
|
-
validVersion = true;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
58
|
+
if (packageIdentifier.name &&
|
|
59
|
+
packageIdentifier.registry &&
|
|
60
|
+
this.isPackageInstalled(packageIdentifier.name)) {
|
|
61
|
+
const validVersion = await this.isProjectVersionValid(packageIdentifier);
|
|
71
62
|
if (validVersion) {
|
|
72
63
|
// Already installed so just run schematic
|
|
73
64
|
this.logger.info('Skipping installation: Package already installed');
|
|
@@ -79,7 +70,7 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
79
70
|
const packageManager = await package_manager_1.getPackageManager(this.context.root);
|
|
80
71
|
const usingYarn = packageManager === workspace_schema_1.PackageManager.Yarn;
|
|
81
72
|
spinner.info(`Using package manager: ${color_1.colors.grey(packageManager)}`);
|
|
82
|
-
if (packageIdentifier.type === 'tag' && !packageIdentifier.rawSpec) {
|
|
73
|
+
if (packageIdentifier.name && packageIdentifier.type === 'tag' && !packageIdentifier.rawSpec) {
|
|
83
74
|
// only package name provided; search for viable version
|
|
84
75
|
// plus special cases for packages that did not have peer deps setup
|
|
85
76
|
spinner.start('Searching for compatible package version...');
|
|
@@ -103,13 +94,13 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
103
94
|
if (version &&
|
|
104
95
|
((semver_1.validRange(version) && semver_1.intersects(version, '7', semverOptions)) ||
|
|
105
96
|
(semver_1.valid(version) && semver_1.satisfies(version, '7', semverOptions)))) {
|
|
106
|
-
packageIdentifier =
|
|
97
|
+
packageIdentifier = npm_package_arg_1.default.resolve('@angular/pwa', '0.12');
|
|
107
98
|
}
|
|
108
99
|
}
|
|
109
100
|
else {
|
|
110
|
-
packageIdentifier =
|
|
101
|
+
packageIdentifier = npm_package_arg_1.default.resolve(latestManifest.name, latestManifest.version);
|
|
111
102
|
}
|
|
112
|
-
spinner.succeed(`Found compatible package version: ${color_1.colors.grey(packageIdentifier)}.`);
|
|
103
|
+
spinner.succeed(`Found compatible package version: ${color_1.colors.grey(packageIdentifier.toString())}.`);
|
|
113
104
|
}
|
|
114
105
|
else if (!latestManifest || (await this.hasMismatchedPeer(latestManifest))) {
|
|
115
106
|
// 'latest' is invalid so search for most recent matching package
|
|
@@ -118,7 +109,7 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
118
109
|
let newIdentifier;
|
|
119
110
|
for (const versionManifest of versionManifests) {
|
|
120
111
|
if (!(await this.hasMismatchedPeer(versionManifest))) {
|
|
121
|
-
newIdentifier =
|
|
112
|
+
newIdentifier = npm_package_arg_1.default.resolve(packageIdentifier.name, versionManifest.version);
|
|
122
113
|
break;
|
|
123
114
|
}
|
|
124
115
|
}
|
|
@@ -127,19 +118,19 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
127
118
|
}
|
|
128
119
|
else {
|
|
129
120
|
packageIdentifier = newIdentifier;
|
|
130
|
-
spinner.succeed(`Found compatible package version: ${color_1.colors.grey(packageIdentifier)}.`);
|
|
121
|
+
spinner.succeed(`Found compatible package version: ${color_1.colors.grey(packageIdentifier.toString())}.`);
|
|
131
122
|
}
|
|
132
123
|
}
|
|
133
124
|
else {
|
|
134
|
-
packageIdentifier =
|
|
135
|
-
spinner.succeed(`Found compatible package version: ${color_1.colors.grey(packageIdentifier)}.`);
|
|
125
|
+
packageIdentifier = npm_package_arg_1.default.resolve(latestManifest.name, latestManifest.version);
|
|
126
|
+
spinner.succeed(`Found compatible package version: ${color_1.colors.grey(packageIdentifier.toString())}.`);
|
|
136
127
|
}
|
|
137
128
|
}
|
|
138
129
|
let collectionName = packageIdentifier.name;
|
|
139
130
|
let savePackage;
|
|
140
131
|
try {
|
|
141
132
|
spinner.start('Loading package information from registry...');
|
|
142
|
-
const manifest = await package_metadata_1.fetchPackageManifest(packageIdentifier, this.logger, {
|
|
133
|
+
const manifest = await package_metadata_1.fetchPackageManifest(packageIdentifier.toString(), this.logger, {
|
|
143
134
|
registry: options.registry,
|
|
144
135
|
verbose: options.verbose,
|
|
145
136
|
usingYarn,
|
|
@@ -161,7 +152,7 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
161
152
|
const confirmationResponse = await prompt_1.askConfirmation(`\nThe package ${color_1.colors.blue(packageIdentifier.raw)} will be installed and executed.\n` +
|
|
162
153
|
'Would you like to proceed?', true, false);
|
|
163
154
|
if (!confirmationResponse) {
|
|
164
|
-
if (!tty_1.isTTY) {
|
|
155
|
+
if (!tty_1.isTTY()) {
|
|
165
156
|
this.logger.error('No terminal detected. ' +
|
|
166
157
|
`'--skip-confirmation' can be used to bypass installation confirmation. ` +
|
|
167
158
|
`Ensure package name is correct prior to '--skip-confirmation' option usage.`);
|
|
@@ -190,6 +181,27 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
190
181
|
}
|
|
191
182
|
return this.executeSchematic(collectionName, options['--']);
|
|
192
183
|
}
|
|
184
|
+
async isProjectVersionValid(packageIdentifier) {
|
|
185
|
+
if (!packageIdentifier.name) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
let validVersion = false;
|
|
189
|
+
const installedVersion = await this.findProjectVersion(packageIdentifier.name);
|
|
190
|
+
if (installedVersion) {
|
|
191
|
+
if (packageIdentifier.type === 'range' && packageIdentifier.fetchSpec) {
|
|
192
|
+
validVersion = semver_1.satisfies(installedVersion, packageIdentifier.fetchSpec);
|
|
193
|
+
}
|
|
194
|
+
else if (packageIdentifier.type === 'version') {
|
|
195
|
+
const v1 = semver_1.valid(packageIdentifier.fetchSpec);
|
|
196
|
+
const v2 = semver_1.valid(installedVersion);
|
|
197
|
+
validVersion = v1 !== null && v1 === v2;
|
|
198
|
+
}
|
|
199
|
+
else if (!packageIdentifier.rawSpec) {
|
|
200
|
+
validVersion = true;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return validVersion;
|
|
204
|
+
}
|
|
193
205
|
async reportAnalytics(paths, options, dimensions = [], metrics = []) {
|
|
194
206
|
const collection = options.collection;
|
|
195
207
|
// Add the collection if it's safe listed.
|
|
@@ -267,7 +279,7 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
267
279
|
for (const peer in manifest.peerDependencies) {
|
|
268
280
|
let peerIdentifier;
|
|
269
281
|
try {
|
|
270
|
-
peerIdentifier =
|
|
282
|
+
peerIdentifier = npm_package_arg_1.default.resolve(peer, manifest.peerDependencies[peer]);
|
|
271
283
|
}
|
|
272
284
|
catch {
|
|
273
285
|
this.logger.warn(`Invalid peer dependency ${peer} found in package.`);
|
package/commands/e2e-long.md
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
When a project name is not supplied,
|
|
1
|
+
The command takes an optional project name, as specified in the `projects` section of the `angular.json` workspace configuration file.
|
|
2
|
+
When a project name is not supplied, executes the `e2e` builder for the default project.
|
|
3
|
+
|
|
4
|
+
To use the `ng e2e` command, use `ng add` to add a package that implements end-to-end testing capabilities. Adding the package automatically updates your workspace configuration, adding an `e2e` [CLI builder](guide/cli-builder).
|
package/commands/update-impl.js
CHANGED
|
@@ -25,12 +25,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
__setModuleDefault(result, mod);
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
28
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
32
|
exports.UpdateCommand = void 0;
|
|
30
33
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
31
34
|
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
32
35
|
const child_process_1 = require("child_process");
|
|
33
36
|
const fs = __importStar(require("fs"));
|
|
37
|
+
const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
|
|
34
38
|
const path = __importStar(require("path"));
|
|
35
39
|
const semver = __importStar(require("semver"));
|
|
36
40
|
const workspace_schema_1 = require("../lib/config/workspace-schema");
|
|
@@ -43,7 +47,6 @@ const log_file_1 = require("../utilities/log-file");
|
|
|
43
47
|
const package_manager_1 = require("../utilities/package-manager");
|
|
44
48
|
const package_metadata_1 = require("../utilities/package-metadata");
|
|
45
49
|
const package_tree_1 = require("../utilities/package-tree");
|
|
46
|
-
const npa = require('npm-package-arg');
|
|
47
50
|
const pickManifest = require('npm-pick-manifest');
|
|
48
51
|
const NG_VERSION_9_POST_MSG = color_1.colors.cyan('\nYour project has been updated to Angular version 9!\n' +
|
|
49
52
|
'For more info, please see: https://v9.angular.io/guide/updating-to-version-9');
|
|
@@ -238,7 +241,7 @@ class UpdateCommand extends command_1.Command {
|
|
|
238
241
|
const packages = [];
|
|
239
242
|
for (const request of options['--'] || []) {
|
|
240
243
|
try {
|
|
241
|
-
const packageIdentifier =
|
|
244
|
+
const packageIdentifier = npm_package_arg_1.default(request);
|
|
242
245
|
// only registry identifiers are supported
|
|
243
246
|
if (!packageIdentifier.registry) {
|
|
244
247
|
this.logger.error(`Package '${request}' is not a registry package identifer.`);
|
package/lib/config/schema.json
CHANGED
|
@@ -612,7 +612,7 @@
|
|
|
612
612
|
"x-user-analytics": 10
|
|
613
613
|
},
|
|
614
614
|
"viewEncapsulation": {
|
|
615
|
-
"description": "The view encapsulation strategy to use in the new
|
|
615
|
+
"description": "The view encapsulation strategy to use in the new application.",
|
|
616
616
|
"enum": [
|
|
617
617
|
"Emulated",
|
|
618
618
|
"None",
|
|
@@ -152,7 +152,7 @@ export interface AngularApplicationOptionsSchema {
|
|
|
152
152
|
*/
|
|
153
153
|
style?: SchematicsAngularApplicationStyle;
|
|
154
154
|
/**
|
|
155
|
-
* The view encapsulation strategy to use in the new
|
|
155
|
+
* The view encapsulation strategy to use in the new application.
|
|
156
156
|
*/
|
|
157
157
|
viewEncapsulation?: ViewEncapsulation;
|
|
158
158
|
}
|
|
@@ -166,7 +166,7 @@ export declare enum SchematicsAngularApplicationStyle {
|
|
|
166
166
|
Scss = "scss"
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
|
-
* The view encapsulation strategy to use in the new
|
|
169
|
+
* The view encapsulation strategy to use in the new application.
|
|
170
170
|
*
|
|
171
171
|
* The view encapsulation strategy to use in the new component.
|
|
172
172
|
*
|
|
@@ -26,7 +26,7 @@ var SchematicsAngularApplicationStyle;
|
|
|
26
26
|
SchematicsAngularApplicationStyle["Scss"] = "scss";
|
|
27
27
|
})(SchematicsAngularApplicationStyle = exports.SchematicsAngularApplicationStyle || (exports.SchematicsAngularApplicationStyle = {}));
|
|
28
28
|
/**
|
|
29
|
-
* The view encapsulation strategy to use in the new
|
|
29
|
+
* The view encapsulation strategy to use in the new application.
|
|
30
30
|
*
|
|
31
31
|
* The view encapsulation strategy to use in the new component.
|
|
32
32
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "12.2.
|
|
3
|
+
"version": "12.2.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.1202.
|
|
32
|
-
"@angular-devkit/core": "12.2.
|
|
33
|
-
"@angular-devkit/schematics": "12.2.
|
|
34
|
-
"@schematics/angular": "12.2.
|
|
31
|
+
"@angular-devkit/architect": "0.1202.2",
|
|
32
|
+
"@angular-devkit/core": "12.2.2",
|
|
33
|
+
"@angular-devkit/schematics": "12.2.2",
|
|
34
|
+
"@schematics/angular": "12.2.2",
|
|
35
35
|
"@yarnpkg/lockfile": "1.1.0",
|
|
36
36
|
"ansi-colors": "4.1.1",
|
|
37
37
|
"debug": "4.3.2",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"ng-update": {
|
|
52
52
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
53
53
|
"packageGroup": {
|
|
54
|
-
"@angular/cli": "12.2.
|
|
55
|
-
"@angular-devkit/architect": "0.1202.
|
|
56
|
-
"@angular-devkit/build-angular": "12.2.
|
|
57
|
-
"@angular-devkit/build-webpack": "0.1202.
|
|
58
|
-
"@angular-devkit/core": "12.2.
|
|
59
|
-
"@angular-devkit/schematics": "12.2.
|
|
54
|
+
"@angular/cli": "12.2.2",
|
|
55
|
+
"@angular-devkit/architect": "0.1202.2",
|
|
56
|
+
"@angular-devkit/build-angular": "12.2.2",
|
|
57
|
+
"@angular-devkit/build-webpack": "0.1202.2",
|
|
58
|
+
"@angular-devkit/core": "12.2.2",
|
|
59
|
+
"@angular-devkit/schematics": "12.2.2"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
@@ -87,7 +87,7 @@ function readOptions(logger, yarn = false, showPotentials = false) {
|
|
|
87
87
|
// Normalize RC options that are needed by 'npm-registry-fetch'.
|
|
88
88
|
// See: https://github.com/npm/npm-registry-fetch/blob/ebddbe78a5f67118c1f7af2e02c8a22bcaf9e850/index.js#L99-L126
|
|
89
89
|
const rcConfig = yarn ? lockfile.parse(data) : ini.parse(data);
|
|
90
|
-
rcOptions = normalizeOptions(rcConfig, location);
|
|
90
|
+
rcOptions = normalizeOptions(rcConfig, location, rcOptions);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
const envVariablesOptions = {};
|
|
@@ -108,14 +108,11 @@ function readOptions(logger, yarn = false, showPotentials = false) {
|
|
|
108
108
|
normalizedName = normalizedName.replace(/(?!^)_/g, '-'); // don't replace _ at the start of the key.s
|
|
109
109
|
envVariablesOptions[normalizedName] = value;
|
|
110
110
|
}
|
|
111
|
-
return
|
|
112
|
-
...rcOptions,
|
|
113
|
-
...normalizeOptions(envVariablesOptions),
|
|
114
|
-
};
|
|
111
|
+
return normalizeOptions(envVariablesOptions, undefined, rcOptions);
|
|
115
112
|
}
|
|
116
|
-
function normalizeOptions(rawOptions, location = process.cwd()) {
|
|
113
|
+
function normalizeOptions(rawOptions, location = process.cwd(), existingNormalizedOptions = {}) {
|
|
117
114
|
var _a;
|
|
118
|
-
const options = {};
|
|
115
|
+
const options = { ...existingNormalizedOptions };
|
|
119
116
|
for (const [key, value] of Object.entries(rawOptions)) {
|
|
120
117
|
let substitutedValue = value;
|
|
121
118
|
// Substitute any environment variable references.
|