@angular/cli 18.1.0-next.1 → 18.1.0-next.3
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/bootstrap.js +1 -1
- package/bin/ng.js +1 -1
- package/lib/cli/index.d.ts +1 -1
- package/lib/cli/index.js +10 -9
- package/lib/config/schema.json +1 -1
- package/lib/config/workspace-schema.d.ts +1 -1
- package/lib/init.d.ts +1 -1
- package/lib/init.js +1 -1
- package/package.json +25 -16
- package/src/analytics/analytics-collector.d.ts +1 -1
- package/src/analytics/analytics-collector.js +1 -1
- package/src/analytics/analytics-parameters.d.ts +1 -1
- package/src/analytics/analytics-parameters.js +1 -1
- package/src/analytics/analytics.d.ts +1 -1
- package/src/analytics/analytics.js +1 -1
- package/src/command-builder/architect-base-command-module.d.ts +1 -1
- package/src/command-builder/architect-base-command-module.js +1 -1
- package/src/command-builder/architect-command-module.d.ts +1 -1
- package/src/command-builder/architect-command-module.js +1 -1
- package/src/command-builder/command-module.d.ts +1 -1
- package/src/command-builder/command-module.js +1 -1
- package/src/command-builder/command-runner.d.ts +1 -1
- package/src/command-builder/command-runner.js +1 -1
- package/src/command-builder/schematics-command-module.d.ts +1 -1
- package/src/command-builder/schematics-command-module.js +88 -51
- package/src/command-builder/utilities/command.d.ts +1 -1
- package/src/command-builder/utilities/command.js +1 -1
- package/src/command-builder/utilities/json-help.d.ts +1 -1
- package/src/command-builder/utilities/json-help.js +1 -1
- package/src/command-builder/utilities/json-schema.d.ts +1 -1
- package/src/command-builder/utilities/json-schema.js +1 -1
- package/src/command-builder/utilities/normalize-options-middleware.d.ts +1 -1
- package/src/command-builder/utilities/normalize-options-middleware.js +1 -1
- package/src/command-builder/utilities/schematic-engine-host.d.ts +1 -1
- package/src/command-builder/utilities/schematic-engine-host.js +1 -1
- package/src/command-builder/utilities/schematic-workflow.d.ts +1 -1
- package/src/command-builder/utilities/schematic-workflow.js +1 -1
- package/src/commands/add/cli.d.ts +1 -1
- package/src/commands/add/cli.js +194 -124
- package/src/commands/analytics/cli.d.ts +1 -1
- package/src/commands/analytics/cli.js +1 -1
- package/src/commands/analytics/info/cli.d.ts +1 -1
- package/src/commands/analytics/info/cli.js +1 -1
- package/src/commands/analytics/settings/cli.d.ts +1 -1
- package/src/commands/analytics/settings/cli.js +1 -1
- package/src/commands/build/cli.d.ts +1 -1
- package/src/commands/build/cli.js +1 -1
- package/src/commands/cache/clean/cli.d.ts +1 -1
- package/src/commands/cache/clean/cli.js +1 -1
- package/src/commands/cache/cli.d.ts +1 -1
- package/src/commands/cache/cli.js +1 -1
- package/src/commands/cache/info/cli.d.ts +1 -1
- package/src/commands/cache/info/cli.js +1 -1
- package/src/commands/cache/settings/cli.d.ts +1 -1
- package/src/commands/cache/settings/cli.js +1 -1
- package/src/commands/cache/utilities.d.ts +1 -1
- package/src/commands/cache/utilities.js +1 -1
- package/src/commands/command-config.d.ts +1 -1
- package/src/commands/command-config.js +1 -1
- package/src/commands/completion/cli.d.ts +1 -1
- package/src/commands/completion/cli.js +1 -1
- package/src/commands/config/cli.d.ts +1 -1
- package/src/commands/config/cli.js +1 -1
- package/src/commands/deploy/cli.d.ts +1 -1
- package/src/commands/deploy/cli.js +1 -1
- package/src/commands/e2e/cli.d.ts +1 -1
- package/src/commands/e2e/cli.js +1 -1
- package/src/commands/extract-i18n/cli.d.ts +1 -1
- package/src/commands/extract-i18n/cli.js +1 -1
- package/src/commands/generate/cli.d.ts +1 -1
- package/src/commands/generate/cli.js +1 -1
- package/src/commands/lint/cli.d.ts +1 -1
- package/src/commands/lint/cli.js +1 -1
- package/src/commands/make-this-awesome/cli.d.ts +1 -1
- package/src/commands/make-this-awesome/cli.js +1 -1
- package/src/commands/new/cli.d.ts +1 -1
- package/src/commands/new/cli.js +1 -1
- package/src/commands/run/cli.d.ts +1 -1
- package/src/commands/run/cli.js +1 -1
- package/src/commands/serve/cli.d.ts +1 -1
- package/src/commands/serve/cli.js +1 -1
- package/src/commands/test/cli.d.ts +1 -1
- package/src/commands/test/cli.js +1 -1
- package/src/commands/update/cli.d.ts +2 -1
- package/src/commands/update/cli.js +66 -34
- package/src/commands/update/schematic/index.d.ts +1 -1
- package/src/commands/update/schematic/index.js +1 -1
- package/src/commands/version/cli.d.ts +1 -1
- package/src/commands/version/cli.js +1 -1
- package/src/typings-bazel.d.ts +1 -1
- package/src/typings.d.ts +1 -1
- package/src/typings.js +1 -1
- package/src/utilities/color.d.ts +3 -5
- package/src/utilities/color.js +8 -38
- package/src/utilities/completion.d.ts +1 -1
- package/src/utilities/completion.js +1 -1
- package/src/utilities/config.d.ts +1 -1
- package/src/utilities/config.js +1 -1
- package/src/utilities/environment-options.d.ts +1 -1
- package/src/utilities/environment-options.js +1 -1
- package/src/utilities/eol.d.ts +1 -1
- package/src/utilities/eol.js +1 -1
- package/src/utilities/error.d.ts +1 -1
- package/src/utilities/error.js +1 -1
- package/src/utilities/find-up.d.ts +1 -1
- package/src/utilities/find-up.js +1 -1
- package/src/utilities/json-file.d.ts +1 -1
- package/src/utilities/json-file.js +1 -1
- package/src/utilities/load-esm.d.ts +1 -1
- package/src/utilities/load-esm.js +1 -1
- package/src/utilities/log-file.d.ts +1 -1
- package/src/utilities/log-file.js +1 -1
- package/src/utilities/memoize.d.ts +1 -1
- package/src/utilities/memoize.js +1 -1
- package/src/utilities/package-manager.d.ts +1 -1
- package/src/utilities/package-manager.js +1 -7
- package/src/utilities/package-metadata.d.ts +1 -1
- package/src/utilities/package-metadata.js +1 -1
- package/src/utilities/package-tree.d.ts +1 -1
- package/src/utilities/package-tree.js +1 -1
- package/src/utilities/project.d.ts +1 -1
- package/src/utilities/project.js +1 -1
- package/src/utilities/prompt.d.ts +9 -4
- package/src/utilities/prompt.js +45 -26
- package/src/utilities/tty.d.ts +1 -1
- package/src/utilities/tty.js +1 -1
- package/src/utilities/version.d.ts +1 -1
- package/src/utilities/version.js +2 -2
- package/src/utilities/spinner.d.ts +0 -20
- package/src/utilities/spinner.js +0 -55
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { logging } from '@angular-devkit/core';
|
|
9
9
|
import { NodeWorkflow } from '@angular-devkit/schematics/tools';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.subscribeToWorkflow = subscribeToWorkflow;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Argv } from 'yargs';
|
|
9
9
|
import { CommandModuleImplementation, Options, OtherOptions } from '../../command-builder/command-module';
|
package/src/commands/add/cli.js
CHANGED
|
@@ -4,26 +4,50 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
9
32
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
33
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
34
|
};
|
|
12
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
36
|
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
37
|
+
const listr2_1 = require("listr2");
|
|
14
38
|
const module_1 = require("module");
|
|
39
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
15
40
|
const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
|
|
16
41
|
const path_1 = require("path");
|
|
17
42
|
const semver_1 = require("semver");
|
|
18
43
|
const workspace_schema_1 = require("../../../lib/config/workspace-schema");
|
|
19
44
|
const schematics_command_module_1 = require("../../command-builder/schematics-command-module");
|
|
20
|
-
const color_1 = require("../../utilities/color");
|
|
21
45
|
const error_1 = require("../../utilities/error");
|
|
22
46
|
const package_metadata_1 = require("../../utilities/package-metadata");
|
|
23
|
-
const prompt_1 = require("../../utilities/prompt");
|
|
24
|
-
const spinner_1 = require("../../utilities/spinner");
|
|
25
47
|
const tty_1 = require("../../utilities/tty");
|
|
26
48
|
const version_1 = require("../../utilities/version");
|
|
49
|
+
class CommandError extends Error {
|
|
50
|
+
}
|
|
27
51
|
/**
|
|
28
52
|
* The set of packages that should have certain versions excluded from consideration
|
|
29
53
|
* when attempting to find a compatible version for a package.
|
|
@@ -66,7 +90,7 @@ class AddCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
66
90
|
// `ng add @angular/localize -- --package-options`.
|
|
67
91
|
.strict(false);
|
|
68
92
|
const collectionName = await this.getCollectionName();
|
|
69
|
-
const workflow =
|
|
93
|
+
const workflow = this.getOrCreateWorkflowForBuilder(collectionName);
|
|
70
94
|
try {
|
|
71
95
|
const collection = workflow.engine.createCollection(collectionName);
|
|
72
96
|
const options = await this.getSchematicOptions(collection, this.schematicName, workflow);
|
|
@@ -102,135 +126,181 @@ class AddCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
102
126
|
return this.executeSchematic({ ...options, collection: packageIdentifier.name });
|
|
103
127
|
}
|
|
104
128
|
}
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// Adjust the version based on name and peer dependencies
|
|
134
|
-
if (latestManifest?.peerDependencies &&
|
|
135
|
-
Object.keys(latestManifest.peerDependencies).length === 0) {
|
|
136
|
-
spinner.succeed(`Found compatible package version: ${color_1.colors.grey(packageIdentifier.toString())}.`);
|
|
137
|
-
}
|
|
138
|
-
else if (!latestManifest || (await this.hasMismatchedPeer(latestManifest))) {
|
|
139
|
-
// 'latest' is invalid so search for most recent matching package
|
|
140
|
-
// Allow prelease versions if the CLI itself is a prerelease
|
|
141
|
-
const allowPrereleases = (0, semver_1.prerelease)(version_1.VERSION.full);
|
|
142
|
-
const versionExclusions = packageVersionExclusions[packageMetadata.name];
|
|
143
|
-
const versionManifests = Object.values(packageMetadata.versions).filter((value) => {
|
|
144
|
-
// Prerelease versions are not stable and should not be considered by default
|
|
145
|
-
if (!allowPrereleases && (0, semver_1.prerelease)(value.version)) {
|
|
146
|
-
return false;
|
|
129
|
+
const taskContext = {
|
|
130
|
+
packageIdentifier,
|
|
131
|
+
executeSchematic: this.executeSchematic.bind(this),
|
|
132
|
+
hasMismatchedPeer: this.hasMismatchedPeer.bind(this),
|
|
133
|
+
};
|
|
134
|
+
const tasks = new listr2_1.Listr([
|
|
135
|
+
{
|
|
136
|
+
title: 'Determining Package Manager',
|
|
137
|
+
task(context, task) {
|
|
138
|
+
context.usingYarn = packageManager.name === workspace_schema_1.PackageManager.Yarn;
|
|
139
|
+
task.output = `Using package manager: ${listr2_1.color.dim(packageManager.name)}`;
|
|
140
|
+
},
|
|
141
|
+
rendererOptions: { persistentOutput: true },
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
title: 'Searching for compatible package version',
|
|
145
|
+
enabled: packageIdentifier.type === 'range' && packageIdentifier.rawSpec === '*',
|
|
146
|
+
async task(context, task) {
|
|
147
|
+
(0, node_assert_1.default)(context.packageIdentifier.name, 'Registry package identifiers should always have a name.');
|
|
148
|
+
// only package name provided; search for viable version
|
|
149
|
+
// plus special cases for packages that did not have peer deps setup
|
|
150
|
+
let packageMetadata;
|
|
151
|
+
try {
|
|
152
|
+
packageMetadata = await (0, package_metadata_1.fetchPackageMetadata)(context.packageIdentifier.name, logger, {
|
|
153
|
+
registry,
|
|
154
|
+
usingYarn: context.usingYarn,
|
|
155
|
+
verbose,
|
|
156
|
+
});
|
|
147
157
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
158
|
+
catch (e) {
|
|
159
|
+
(0, error_1.assertIsError)(e);
|
|
160
|
+
throw new CommandError(`Unable to load package information from registry: ${e.message}`);
|
|
151
161
|
}
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
// Start with the version tagged as `latest` if it exists
|
|
163
|
+
const latestManifest = packageMetadata.tags['latest'];
|
|
164
|
+
if (latestManifest) {
|
|
165
|
+
context.packageIdentifier = npm_package_arg_1.default.resolve(latestManifest.name, latestManifest.version);
|
|
156
166
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
let newIdentifier;
|
|
162
|
-
for (const versionManifest of versionManifests) {
|
|
163
|
-
if (!(await this.hasMismatchedPeer(versionManifest))) {
|
|
164
|
-
newIdentifier = npm_package_arg_1.default.resolve(versionManifest.name, versionManifest.version);
|
|
165
|
-
break;
|
|
167
|
+
// Adjust the version based on name and peer dependencies
|
|
168
|
+
if (latestManifest?.peerDependencies &&
|
|
169
|
+
Object.keys(latestManifest.peerDependencies).length === 0) {
|
|
170
|
+
task.output = `Found compatible package version: ${listr2_1.color.blue(latestManifest.version)}.`;
|
|
166
171
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
172
|
+
else if (!latestManifest || (await context.hasMismatchedPeer(latestManifest))) {
|
|
173
|
+
// 'latest' is invalid so search for most recent matching package
|
|
174
|
+
// Allow prelease versions if the CLI itself is a prerelease
|
|
175
|
+
const allowPrereleases = (0, semver_1.prerelease)(version_1.VERSION.full);
|
|
176
|
+
const versionExclusions = packageVersionExclusions[packageMetadata.name];
|
|
177
|
+
const versionManifests = Object.values(packageMetadata.versions).filter((value) => {
|
|
178
|
+
// Prerelease versions are not stable and should not be considered by default
|
|
179
|
+
if (!allowPrereleases && (0, semver_1.prerelease)(value.version)) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
// Deprecated versions should not be used or considered
|
|
183
|
+
if (value.deprecated) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
// Excluded package versions should not be considered
|
|
187
|
+
if (versionExclusions &&
|
|
188
|
+
(0, semver_1.satisfies)(value.version, versionExclusions, { includePrerelease: true })) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
return true;
|
|
192
|
+
});
|
|
193
|
+
// Sort in reverse SemVer order so that the newest compatible version is chosen
|
|
194
|
+
versionManifests.sort((a, b) => (0, semver_1.compare)(b.version, a.version, true));
|
|
195
|
+
let found = false;
|
|
196
|
+
for (const versionManifest of versionManifests) {
|
|
197
|
+
const mismatch = await context.hasMismatchedPeer(versionManifest);
|
|
198
|
+
if (mismatch) {
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
context.packageIdentifier = npm_package_arg_1.default.resolve(versionManifest.name, versionManifest.version);
|
|
202
|
+
found = true;
|
|
203
|
+
}
|
|
204
|
+
if (!found) {
|
|
205
|
+
task.output = "Unable to find compatible package. Using 'latest' tag.";
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
task.output = `Found compatible package version: ${listr2_1.color.blue(context.packageIdentifier.toString())}.`;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
task.output = `Found compatible package version: ${listr2_1.color.blue(context.packageIdentifier.toString())}.`;
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
rendererOptions: { persistentOutput: true },
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
title: 'Loading package information from registry',
|
|
219
|
+
async task(context, task) {
|
|
220
|
+
let manifest;
|
|
221
|
+
try {
|
|
222
|
+
manifest = await (0, package_metadata_1.fetchPackageManifest)(context.packageIdentifier.toString(), logger, {
|
|
223
|
+
registry,
|
|
224
|
+
verbose,
|
|
225
|
+
usingYarn: context.usingYarn,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
catch (e) {
|
|
229
|
+
(0, error_1.assertIsError)(e);
|
|
230
|
+
throw new CommandError(`Unable to fetch package information for '${context.packageIdentifier}': ${e.message}`);
|
|
231
|
+
}
|
|
232
|
+
context.savePackage = manifest['ng-add']?.save;
|
|
233
|
+
context.collectionName = manifest.name;
|
|
234
|
+
if (await context.hasMismatchedPeer(manifest)) {
|
|
235
|
+
task.output = listr2_1.color.yellow(listr2_1.figures.warning +
|
|
236
|
+
' Package has unmet peer dependencies. Adding the package may not succeed.');
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
rendererOptions: { persistentOutput: true },
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
title: 'Confirming installation',
|
|
243
|
+
enabled: !skipConfirmation,
|
|
244
|
+
async task(context, task) {
|
|
245
|
+
if (!(0, tty_1.isTTY)()) {
|
|
246
|
+
task.output =
|
|
247
|
+
`'--skip-confirmation' can be used to bypass installation confirmation. ` +
|
|
248
|
+
`Ensure package name is correct prior to '--skip-confirmation' option usage.`;
|
|
249
|
+
throw new CommandError('No terminal detected');
|
|
250
|
+
}
|
|
251
|
+
const { ListrInquirerPromptAdapter } = await Promise.resolve().then(() => __importStar(require('@listr2/prompt-adapter-inquirer')));
|
|
252
|
+
const { confirm } = await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
|
|
253
|
+
const shouldProceed = await task.prompt(ListrInquirerPromptAdapter).run(confirm, {
|
|
254
|
+
message: `The package ${listr2_1.color.blue(context.packageIdentifier.toString())} will be installed and executed.\n` +
|
|
255
|
+
'Would you like to proceed?',
|
|
256
|
+
default: true,
|
|
257
|
+
theme: { prefix: '' },
|
|
258
|
+
});
|
|
259
|
+
if (!shouldProceed) {
|
|
260
|
+
throw new CommandError('Command aborted');
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
rendererOptions: { persistentOutput: true },
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
async task(context, task) {
|
|
267
|
+
// Only show if installation will actually occur
|
|
268
|
+
task.title = 'Installing package';
|
|
269
|
+
if (context.savePackage === false) {
|
|
270
|
+
task.title += ' in temporary location';
|
|
271
|
+
// Temporary packages are located in a different directory
|
|
272
|
+
// Hence we need to resolve them using the temp path
|
|
273
|
+
const { success, tempNodeModules } = await packageManager.installTemp(context.packageIdentifier.toString(), registry ? [`--registry="${registry}"`] : undefined);
|
|
274
|
+
const tempRequire = (0, module_1.createRequire)(tempNodeModules + '/');
|
|
275
|
+
(0, node_assert_1.default)(context.collectionName, 'Collection name should always be available');
|
|
276
|
+
const resolvedCollectionPath = tempRequire.resolve((0, path_1.join)(context.collectionName, 'package.json'));
|
|
277
|
+
if (!success) {
|
|
278
|
+
throw new CommandError('Unable to install package');
|
|
279
|
+
}
|
|
280
|
+
context.collectionName = (0, path_1.dirname)(resolvedCollectionPath);
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
const success = await packageManager.install(context.packageIdentifier.toString(), context.savePackage, registry ? [`--registry="${registry}"`] : undefined, undefined);
|
|
284
|
+
if (!success) {
|
|
285
|
+
throw new CommandError('Unable to install package');
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
rendererOptions: { bottomBar: Infinity },
|
|
290
|
+
},
|
|
291
|
+
// TODO: Rework schematic execution as a task and insert here
|
|
292
|
+
]);
|
|
182
293
|
try {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
verbose,
|
|
187
|
-
usingYarn,
|
|
188
|
-
});
|
|
189
|
-
savePackage = manifest['ng-add']?.save;
|
|
190
|
-
collectionName = manifest.name;
|
|
191
|
-
if (await this.hasMismatchedPeer(manifest)) {
|
|
192
|
-
spinner.warn('Package has unmet peer dependencies. Adding the package may not succeed.');
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
spinner.succeed(`Package information loaded.`);
|
|
196
|
-
}
|
|
294
|
+
const result = await tasks.run(taskContext);
|
|
295
|
+
(0, node_assert_1.default)(result.collectionName, 'Collection name should always be available');
|
|
296
|
+
return this.executeSchematic({ ...options, collection: result.collectionName });
|
|
197
297
|
}
|
|
198
298
|
catch (e) {
|
|
199
|
-
|
|
200
|
-
spinner.fail(`Unable to fetch package information for '${packageIdentifier}': ${e.message}`);
|
|
201
|
-
return 1;
|
|
202
|
-
}
|
|
203
|
-
if (!skipConfirmation) {
|
|
204
|
-
const confirmationResponse = await (0, prompt_1.askConfirmation)(`\nThe package ${color_1.colors.blue(packageIdentifier.raw)} will be installed and executed.\n` +
|
|
205
|
-
'Would you like to proceed?', true, false);
|
|
206
|
-
if (!confirmationResponse) {
|
|
207
|
-
if (!(0, tty_1.isTTY)()) {
|
|
208
|
-
logger.error('No terminal detected. ' +
|
|
209
|
-
`'--skip-confirmation' can be used to bypass installation confirmation. ` +
|
|
210
|
-
`Ensure package name is correct prior to '--skip-confirmation' option usage.`);
|
|
211
|
-
}
|
|
212
|
-
logger.error('Command aborted.');
|
|
213
|
-
return 1;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
if (savePackage === false) {
|
|
217
|
-
// Temporary packages are located in a different directory
|
|
218
|
-
// Hence we need to resolve them using the temp path
|
|
219
|
-
const { success, tempNodeModules } = await packageManager.installTemp(packageIdentifier.raw, registry ? [`--registry="${registry}"`] : undefined);
|
|
220
|
-
const tempRequire = (0, module_1.createRequire)(tempNodeModules + '/');
|
|
221
|
-
const resolvedCollectionPath = tempRequire.resolve((0, path_1.join)(collectionName, 'package.json'));
|
|
222
|
-
if (!success) {
|
|
223
|
-
return 1;
|
|
224
|
-
}
|
|
225
|
-
collectionName = (0, path_1.dirname)(resolvedCollectionPath);
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
const success = await packageManager.install(packageIdentifier.raw, savePackage, registry ? [`--registry="${registry}"`] : undefined);
|
|
229
|
-
if (!success) {
|
|
299
|
+
if (e instanceof CommandError) {
|
|
230
300
|
return 1;
|
|
231
301
|
}
|
|
302
|
+
throw e;
|
|
232
303
|
}
|
|
233
|
-
return this.executeSchematic({ ...options, collection: collectionName });
|
|
234
304
|
}
|
|
235
305
|
async isProjectVersionValid(packageIdentifier) {
|
|
236
306
|
if (!packageIdentifier.name) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Argv } from 'yargs';
|
|
9
9
|
import { CommandModule, CommandModuleImplementation, Options } from '../../command-builder/command-module';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const node_path_1 = require("node:path");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Argv } from 'yargs';
|
|
9
9
|
import { CommandModule, CommandModuleImplementation, Options } from '../../../command-builder/command-module';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.AnalyticsInfoCommandModule = void 0;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Argv } from 'yargs';
|
|
9
9
|
import { CommandModule, CommandModuleImplementation, Options } from '../../../command-builder/command-module';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.AnalyticsPromptModule = exports.AnalyticsEnableModule = exports.AnalyticsDisableModule = void 0;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
|
9
9
|
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const path_1 = require("path");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Argv } from 'yargs';
|
|
9
9
|
import { CommandModule, CommandModuleImplementation, CommandScope } from '../../../command-builder/command-module';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.CacheCleanModule = void 0;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Argv } from 'yargs';
|
|
9
9
|
import { CommandModule, CommandModuleImplementation, CommandScope, Options } from '../../command-builder/command-module';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const path_1 = require("path");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Argv } from 'yargs';
|
|
9
9
|
import { CommandModule, CommandModuleImplementation, CommandScope } from '../../../command-builder/command-module';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.CacheInfoCommandModule = void 0;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Argv } from 'yargs';
|
|
9
9
|
import { CommandModule, CommandModuleImplementation, CommandScope } from '../../../command-builder/command-module';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.CacheEnableModule = exports.CacheDisableModule = void 0;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Cache } from '../../../lib/config/workspace-schema';
|
|
9
9
|
import { AngularWorkspace } from '../../utilities/config';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.updateCacheConfig = updateCacheConfig;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { CommandModuleConstructor } from '../command-builder/utilities/command';
|
|
9
9
|
export type CommandNames = 'add' | 'analytics' | 'build' | 'cache' | 'completion' | 'config' | 'deploy' | 'e2e' | 'extract-i18n' | 'generate' | 'lint' | 'make-this-awesome' | 'new' | 'run' | 'serve' | 'test' | 'update' | 'version';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Argv } from 'yargs';
|
|
9
9
|
import { CommandModule, CommandModuleImplementation } from '../../command-builder/command-module';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
10
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Argv } from 'yargs';
|
|
9
9
|
import { CommandModule, CommandModuleImplementation, Options } from '../../command-builder/command-module';
|