@angular/cli 18.1.0-next.3 → 18.1.0-rc.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/package.json +16 -16
- package/src/command-builder/architect-base-command-module.js +1 -1
- package/src/command-builder/architect-command-module.js +158 -124
- package/src/command-builder/command-module.js +225 -196
- package/src/command-builder/schematics-command-module.js +308 -284
- package/src/commands/new/cli.js +1 -1
- package/src/utilities/color.d.ts +1 -1
- package/src/utilities/color.js +9 -21
- package/src/utilities/memoize.d.ts +1 -1
- package/src/utilities/memoize.js +14 -19
- package/src/utilities/package-manager.js +265 -239
- package/src/utilities/tty.d.ts +1 -1
- package/src/utilities/tty.js +2 -2
- package/src/utilities/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "18.1.0-
|
|
3
|
+
"version": "18.1.0-rc.0",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/angular/angular-cli",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@angular-devkit/architect": "0.1801.0-
|
|
29
|
-
"@angular-devkit/core": "18.1.0-
|
|
30
|
-
"@angular-devkit/schematics": "18.1.0-
|
|
28
|
+
"@angular-devkit/architect": "0.1801.0-rc.0",
|
|
29
|
+
"@angular-devkit/core": "18.1.0-rc.0",
|
|
30
|
+
"@angular-devkit/schematics": "18.1.0-rc.0",
|
|
31
31
|
"@inquirer/prompts": "5.0.6",
|
|
32
|
-
"@listr2/prompt-adapter-inquirer": "2.0.
|
|
33
|
-
"@schematics/angular": "18.1.0-
|
|
32
|
+
"@listr2/prompt-adapter-inquirer": "2.0.13",
|
|
33
|
+
"@schematics/angular": "18.1.0-rc.0",
|
|
34
34
|
"@yarnpkg/lockfile": "1.1.0",
|
|
35
35
|
"ini": "4.1.3",
|
|
36
|
-
"jsonc-parser": "3.
|
|
37
|
-
"listr2": "8.2.
|
|
36
|
+
"jsonc-parser": "3.3.1",
|
|
37
|
+
"listr2": "8.2.3",
|
|
38
38
|
"npm-package-arg": "11.0.2",
|
|
39
39
|
"npm-pick-manifest": "9.0.1",
|
|
40
40
|
"pacote": "18.0.6",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"ng-update": {
|
|
47
47
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
48
48
|
"packageGroup": {
|
|
49
|
-
"@angular/cli": "18.1.0-
|
|
50
|
-
"@angular/build": "18.1.0-
|
|
51
|
-
"@angular/ssr": "18.1.0-
|
|
52
|
-
"@angular-devkit/architect": "0.1801.0-
|
|
53
|
-
"@angular-devkit/build-angular": "18.1.0-
|
|
54
|
-
"@angular-devkit/build-webpack": "0.1801.0-
|
|
55
|
-
"@angular-devkit/core": "18.1.0-
|
|
56
|
-
"@angular-devkit/schematics": "18.1.0-
|
|
49
|
+
"@angular/cli": "18.1.0-rc.0",
|
|
50
|
+
"@angular/build": "18.1.0-rc.0",
|
|
51
|
+
"@angular/ssr": "18.1.0-rc.0",
|
|
52
|
+
"@angular-devkit/architect": "0.1801.0-rc.0",
|
|
53
|
+
"@angular-devkit/build-angular": "18.1.0-rc.0",
|
|
54
|
+
"@angular-devkit/build-webpack": "0.1801.0-rc.0",
|
|
55
|
+
"@angular-devkit/core": "18.1.0-rc.0",
|
|
56
|
+
"@angular-devkit/schematics": "18.1.0-rc.0"
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"packageManager": "yarn@4.3.0",
|
|
@@ -47,7 +47,7 @@ class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
|
47
47
|
scope = command_module_1.CommandScope.In;
|
|
48
48
|
missingTargetChoices;
|
|
49
49
|
async runSingleTarget(target, options) {
|
|
50
|
-
const architectHost =
|
|
50
|
+
const architectHost = this.getArchitectHost();
|
|
51
51
|
let builderName;
|
|
52
52
|
try {
|
|
53
53
|
builderName = await architectHost.getBuilderNameForTarget(target);
|
|
@@ -6,14 +6,39 @@
|
|
|
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.dev/license
|
|
8
8
|
*/
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
10
|
+
var useValue = arguments.length > 2;
|
|
11
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
12
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
13
|
+
}
|
|
14
|
+
return useValue ? value : void 0;
|
|
14
15
|
};
|
|
15
|
-
var
|
|
16
|
-
if (
|
|
16
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
17
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
18
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
19
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
20
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
21
|
+
var _, done = false;
|
|
22
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
23
|
+
var context = {};
|
|
24
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
25
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
26
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
27
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
28
|
+
if (kind === "accessor") {
|
|
29
|
+
if (result === void 0) continue;
|
|
30
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
31
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
32
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
33
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
34
|
+
}
|
|
35
|
+
else if (_ = accept(result)) {
|
|
36
|
+
if (kind === "field") initializers.unshift(_);
|
|
37
|
+
else descriptor[key] = _;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
41
|
+
done = true;
|
|
17
42
|
};
|
|
18
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
44
|
exports.ArchitectCommandModule = void 0;
|
|
@@ -21,133 +46,142 @@ const config_1 = require("../utilities/config");
|
|
|
21
46
|
const memoize_1 = require("../utilities/memoize");
|
|
22
47
|
const architect_base_command_module_1 = require("./architect-base-command-module");
|
|
23
48
|
const command_module_1 = require("./command-module");
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
.option('configuration', {
|
|
36
|
-
describe: `One or more named builder configurations as a comma-separated ` +
|
|
37
|
-
`list as specified in the "configurations" section in angular.json.\n` +
|
|
38
|
-
`The builder uses the named configurations to run the given target.\n` +
|
|
39
|
-
`For more information, see https://angular.dev/reference/configs/workspace-config#alternate-build-configurations.`,
|
|
40
|
-
alias: 'c',
|
|
41
|
-
type: 'string',
|
|
42
|
-
// Show only in when using --help and auto completion because otherwise comma seperated configuration values will be invalid.
|
|
43
|
-
// Also, hide choices from JSON help so that we don't display them in AIO.
|
|
44
|
-
choices: (getYargsCompletions || help) && !jsonHelp && project
|
|
45
|
-
? this.getConfigurationChoices(project)
|
|
46
|
-
: undefined,
|
|
47
|
-
})
|
|
48
|
-
.strict();
|
|
49
|
-
if (!project) {
|
|
50
|
-
return localYargs;
|
|
49
|
+
let ArchitectCommandModule = (() => {
|
|
50
|
+
let _classSuper = architect_base_command_module_1.ArchitectBaseCommandModule;
|
|
51
|
+
let _instanceExtraInitializers = [];
|
|
52
|
+
let _getProjectNamesByTarget_decorators;
|
|
53
|
+
return class ArchitectCommandModule extends _classSuper {
|
|
54
|
+
static {
|
|
55
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
56
|
+
_getProjectNamesByTarget_decorators = [memoize_1.memoize];
|
|
57
|
+
__esDecorate(this, null, _getProjectNamesByTarget_decorators, { kind: "method", name: "getProjectNamesByTarget", static: false, private: false, access: { has: obj => "getProjectNamesByTarget" in obj, get: obj => obj.getProjectNamesByTarget }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
58
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
51
59
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
async builder(argv) {
|
|
61
|
+
const project = this.getArchitectProject();
|
|
62
|
+
const { jsonHelp, getYargsCompletions, help } = this.context.args.options;
|
|
63
|
+
const localYargs = argv
|
|
64
|
+
.positional('project', {
|
|
65
|
+
describe: 'The name of the project to build. Can be an application or a library.',
|
|
66
|
+
type: 'string',
|
|
67
|
+
// Hide choices from JSON help so that we don't display them in AIO.
|
|
68
|
+
choices: jsonHelp ? undefined : this.getProjectChoices(),
|
|
69
|
+
})
|
|
70
|
+
.option('configuration', {
|
|
71
|
+
describe: `One or more named builder configurations as a comma-separated ` +
|
|
72
|
+
`list as specified in the "configurations" section in angular.json.\n` +
|
|
73
|
+
`The builder uses the named configurations to run the given target.\n` +
|
|
74
|
+
`For more information, see https://angular.dev/reference/configs/workspace-config#alternate-build-configurations.`,
|
|
75
|
+
alias: 'c',
|
|
76
|
+
type: 'string',
|
|
77
|
+
// Show only in when using --help and auto completion because otherwise comma seperated configuration values will be invalid.
|
|
78
|
+
// Also, hide choices from JSON help so that we don't display them in AIO.
|
|
79
|
+
choices: (getYargsCompletions || help) && !jsonHelp && project
|
|
80
|
+
? this.getConfigurationChoices(project)
|
|
81
|
+
: undefined,
|
|
82
|
+
})
|
|
83
|
+
.strict();
|
|
84
|
+
if (!project) {
|
|
85
|
+
return localYargs;
|
|
72
86
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
const target = this.getArchitectTarget();
|
|
88
|
+
const schemaOptions = await this.getArchitectTargetOptions({
|
|
89
|
+
project,
|
|
90
|
+
target,
|
|
91
|
+
});
|
|
92
|
+
return this.addSchemaOptionsToCommand(localYargs, schemaOptions);
|
|
77
93
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
for (const [name, project] of workspace.projects) {
|
|
97
|
-
if (project.targets.has(target)) {
|
|
98
|
-
allProjectsForTargetName.push(name);
|
|
94
|
+
async run(options) {
|
|
95
|
+
const target = this.getArchitectTarget();
|
|
96
|
+
const { configuration = '', project, ...architectOptions } = options;
|
|
97
|
+
if (!project) {
|
|
98
|
+
// This runs each target sequentially.
|
|
99
|
+
// Running them in parallel would jumble the log messages.
|
|
100
|
+
let result = 0;
|
|
101
|
+
const projectNames = this.getProjectNamesByTarget(target);
|
|
102
|
+
if (!projectNames) {
|
|
103
|
+
return this.onMissingTarget('Cannot determine project or target for command.');
|
|
104
|
+
}
|
|
105
|
+
for (const project of projectNames) {
|
|
106
|
+
result |= await this.runSingleTarget({ configuration, target, project }, architectOptions);
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
return await this.runSingleTarget({ configuration, target, project }, architectOptions);
|
|
99
112
|
}
|
|
100
113
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
getArchitectProject() {
|
|
115
|
+
const { options, positional } = this.context.args;
|
|
116
|
+
const [, projectName] = positional;
|
|
117
|
+
if (projectName) {
|
|
118
|
+
return projectName;
|
|
119
|
+
}
|
|
120
|
+
// Yargs allows positional args to be used as flags.
|
|
121
|
+
if (typeof options['project'] === 'string') {
|
|
122
|
+
return options['project'];
|
|
123
|
+
}
|
|
124
|
+
const target = this.getArchitectTarget();
|
|
125
|
+
const projectFromTarget = this.getProjectNamesByTarget(target);
|
|
126
|
+
return projectFromTarget?.length ? projectFromTarget[0] : undefined;
|
|
107
127
|
}
|
|
108
|
-
|
|
109
|
-
|
|
128
|
+
getProjectNamesByTarget(target) {
|
|
129
|
+
const workspace = this.getWorkspaceOrThrow();
|
|
130
|
+
const allProjectsForTargetName = [];
|
|
131
|
+
for (const [name, project] of workspace.projects) {
|
|
132
|
+
if (project.targets.has(target)) {
|
|
133
|
+
allProjectsForTargetName.push(name);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (allProjectsForTargetName.length === 0) {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
if (this.multiTarget) {
|
|
140
|
+
// For multi target commands, we always list all projects that have the target.
|
|
110
141
|
return allProjectsForTargetName;
|
|
111
142
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
143
|
+
else {
|
|
144
|
+
if (allProjectsForTargetName.length === 1) {
|
|
145
|
+
return allProjectsForTargetName;
|
|
146
|
+
}
|
|
147
|
+
const maybeProject = (0, config_1.getProjectByCwd)(workspace);
|
|
148
|
+
if (maybeProject) {
|
|
149
|
+
return allProjectsForTargetName.includes(maybeProject) ? [maybeProject] : undefined;
|
|
150
|
+
}
|
|
151
|
+
const { getYargsCompletions, help } = this.context.args.options;
|
|
152
|
+
if (!getYargsCompletions && !help) {
|
|
153
|
+
// Only issue the below error when not in help / completion mode.
|
|
154
|
+
throw new command_module_1.CommandModuleError('Cannot determine project for command.\n' +
|
|
155
|
+
'This is a multi-project workspace and more than one project supports this command. ' +
|
|
156
|
+
`Run "ng ${this.command}" to execute the command for a specific project or change the current ` +
|
|
157
|
+
'working directory to a project directory.\n\n' +
|
|
158
|
+
`Available projects are:\n${allProjectsForTargetName
|
|
159
|
+
.sort()
|
|
160
|
+
.map((p) => `- ${p}`)
|
|
161
|
+
.join('\n')}`);
|
|
162
|
+
}
|
|
115
163
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
/** @returns a sorted list of project names to be used for auto completion. */
|
|
167
|
+
getProjectChoices() {
|
|
168
|
+
const { workspace } = this.context;
|
|
169
|
+
return workspace ? [...workspace.projects.keys()].sort() : undefined;
|
|
170
|
+
}
|
|
171
|
+
/** @returns a sorted list of configuration names to be used for auto completion. */
|
|
172
|
+
getConfigurationChoices(project) {
|
|
173
|
+
const projectDefinition = this.context.workspace?.projects.get(project);
|
|
174
|
+
if (!projectDefinition) {
|
|
175
|
+
return undefined;
|
|
127
176
|
}
|
|
177
|
+
const target = this.getArchitectTarget();
|
|
178
|
+
const configurations = projectDefinition.targets.get(target)?.configurations;
|
|
179
|
+
return configurations ? Object.keys(configurations).sort() : undefined;
|
|
128
180
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
getProjectChoices() {
|
|
133
|
-
const { workspace } = this.context;
|
|
134
|
-
return workspace ? [...workspace.projects.keys()].sort() : undefined;
|
|
135
|
-
}
|
|
136
|
-
/** @returns a sorted list of configuration names to be used for auto completion. */
|
|
137
|
-
getConfigurationChoices(project) {
|
|
138
|
-
const projectDefinition = this.context.workspace?.projects.get(project);
|
|
139
|
-
if (!projectDefinition) {
|
|
140
|
-
return undefined;
|
|
181
|
+
constructor() {
|
|
182
|
+
super(...arguments);
|
|
183
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
141
184
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return configurations ? Object.keys(configurations).sort() : undefined;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
185
|
+
};
|
|
186
|
+
})();
|
|
147
187
|
exports.ArchitectCommandModule = ArchitectCommandModule;
|
|
148
|
-
__decorate([
|
|
149
|
-
memoize_1.memoize,
|
|
150
|
-
__metadata("design:type", Function),
|
|
151
|
-
__metadata("design:paramtypes", [String]),
|
|
152
|
-
__metadata("design:returntype", Object)
|
|
153
|
-
], ArchitectCommandModule.prototype, "getProjectNamesByTarget", null);
|