@angular/cli 14.1.0-next.1 → 14.1.0-next.4
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/lib/config/schema.json +722 -140
- package/lib/init.js +4 -2
- package/package.json +14 -14
- package/src/command-builder/architect-command-module.js +8 -2
- package/src/command-builder/command-module.js +25 -2
- package/src/command-builder/command-runner.js +1 -1
- package/src/commands/config/cli.js +2 -17
- package/src/commands/new/cli.js +1 -1
- package/src/commands/run/cli.js +10 -0
- package/src/commands/update/cli.d.ts +1 -0
- package/src/commands/update/cli.js +23 -20
- package/src/utilities/color.js +0 -1
- package/src/utilities/config.d.ts +1 -1
- package/src/utilities/config.js +9 -2
package/lib/init.js
CHANGED
|
@@ -93,10 +93,12 @@ let forceExit = false;
|
|
|
93
93
|
// eslint-disable-next-line no-console
|
|
94
94
|
console.error('Version mismatch check skipped. Unable to compare local version: ' + error);
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
const rawCommandName = process.argv[2];
|
|
97
|
+
// When using the completion command, don't show the warning as otherwise this will break completion.
|
|
98
|
+
if (isGlobalGreater && rawCommandName !== 'completion') {
|
|
97
99
|
// If using the update command and the global version is greater, use the newer update command
|
|
98
100
|
// This allows improvements in update to be used in older versions that do not have bootstrapping
|
|
99
|
-
if (
|
|
101
|
+
if (rawCommandName === 'update' &&
|
|
100
102
|
cli.VERSION &&
|
|
101
103
|
cli.VERSION.major - globalVersion.major <= 1) {
|
|
102
104
|
cli = await Promise.resolve().then(() => __importStar(require('./cli')));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "14.1.0-next.
|
|
3
|
+
"version": "14.1.0-next.4",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -25,22 +25,22 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/angular/angular-cli",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@angular-devkit/architect": "0.1401.0-next.
|
|
29
|
-
"@angular-devkit/core": "14.1.0-next.
|
|
30
|
-
"@angular-devkit/schematics": "14.1.0-next.
|
|
31
|
-
"@schematics/angular": "14.1.0-next.
|
|
28
|
+
"@angular-devkit/architect": "0.1401.0-next.4",
|
|
29
|
+
"@angular-devkit/core": "14.1.0-next.4",
|
|
30
|
+
"@angular-devkit/schematics": "14.1.0-next.4",
|
|
31
|
+
"@schematics/angular": "14.1.0-next.4",
|
|
32
32
|
"@yarnpkg/lockfile": "1.1.0",
|
|
33
33
|
"ansi-colors": "4.1.3",
|
|
34
34
|
"debug": "4.3.4",
|
|
35
35
|
"ini": "3.0.0",
|
|
36
36
|
"inquirer": "8.2.4",
|
|
37
37
|
"jsonc-parser": "3.0.0",
|
|
38
|
-
"npm-package-arg": "9.0
|
|
38
|
+
"npm-package-arg": "9.1.0",
|
|
39
39
|
"npm-pick-manifest": "7.0.1",
|
|
40
40
|
"open": "8.4.0",
|
|
41
41
|
"ora": "5.4.1",
|
|
42
|
-
"pacote": "13.6.
|
|
43
|
-
"resolve": "1.22.
|
|
42
|
+
"pacote": "13.6.1",
|
|
43
|
+
"resolve": "1.22.1",
|
|
44
44
|
"semver": "7.3.7",
|
|
45
45
|
"symbol-observable": "4.0.0",
|
|
46
46
|
"uuid": "8.3.2",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"ng-update": {
|
|
50
50
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
51
51
|
"packageGroup": {
|
|
52
|
-
"@angular/cli": "14.1.0-next.
|
|
53
|
-
"@angular-devkit/architect": "0.1401.0-next.
|
|
54
|
-
"@angular-devkit/build-angular": "14.1.0-next.
|
|
55
|
-
"@angular-devkit/build-webpack": "0.1401.0-next.
|
|
56
|
-
"@angular-devkit/core": "14.1.0-next.
|
|
57
|
-
"@angular-devkit/schematics": "14.1.0-next.
|
|
52
|
+
"@angular/cli": "14.1.0-next.4",
|
|
53
|
+
"@angular-devkit/architect": "0.1401.0-next.4",
|
|
54
|
+
"@angular-devkit/build-angular": "14.1.0-next.4",
|
|
55
|
+
"@angular-devkit/build-webpack": "0.1401.0-next.4",
|
|
56
|
+
"@angular-devkit/core": "14.1.0-next.4",
|
|
57
|
+
"@angular-devkit/schematics": "14.1.0-next.4"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
@@ -113,8 +113,14 @@ class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBa
|
|
|
113
113
|
const { getYargsCompletions, help } = this.context.args.options;
|
|
114
114
|
if (!getYargsCompletions && !help) {
|
|
115
115
|
// Only issue the below error when not in help / completion mode.
|
|
116
|
-
throw new command_module_1.CommandModuleError('Cannot determine project for command
|
|
117
|
-
'
|
|
116
|
+
throw new command_module_1.CommandModuleError('Cannot determine project for command.\n' +
|
|
117
|
+
'This is a multi-project workspace and more than one project supports this command. ' +
|
|
118
|
+
`Run "ng ${this.command}" to execute the command for a specific project or change the current ` +
|
|
119
|
+
'working directory to a project directory.\n\n' +
|
|
120
|
+
`Available projects are:\n${allProjectsForTargetName
|
|
121
|
+
.sort()
|
|
122
|
+
.map((p) => `- ${p}`)
|
|
123
|
+
.join('\n')}`);
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
126
|
return undefined;
|
|
@@ -149,6 +149,7 @@ class CommandModule {
|
|
|
149
149
|
* **Note:** This method should be called from the command bundler method.
|
|
150
150
|
*/
|
|
151
151
|
addSchemaOptionsToCommand(localYargs, options) {
|
|
152
|
+
const booleanOptionsWithNoPrefix = new Set();
|
|
152
153
|
for (const option of options) {
|
|
153
154
|
const { default: defaultVal, positional, deprecated, description, alias, userAnalytics, type, hidden, name, choices, } = option;
|
|
154
155
|
const sharedOptions = {
|
|
@@ -160,14 +161,24 @@ class CommandModule {
|
|
|
160
161
|
// This should only be done when `--help` is used otherwise default will override options set in angular.json.
|
|
161
162
|
...(this.context.args.options.help ? { default: defaultVal } : {}),
|
|
162
163
|
};
|
|
164
|
+
// TODO(alanagius4): remove in a major version.
|
|
165
|
+
// the below is an interim workaround to handle options which have been defined in the schema with `no` prefix.
|
|
166
|
+
let dashedName = core_1.strings.dasherize(name);
|
|
167
|
+
if (type === 'boolean' && dashedName.startsWith('no-')) {
|
|
168
|
+
dashedName = dashedName.slice(3);
|
|
169
|
+
booleanOptionsWithNoPrefix.add(dashedName);
|
|
170
|
+
// eslint-disable-next-line no-console
|
|
171
|
+
console.warn(`Warning: '${name}' option has been declared with a 'no' prefix in the schema.` +
|
|
172
|
+
'Please file an issue with the author of this package.');
|
|
173
|
+
}
|
|
163
174
|
if (positional === undefined) {
|
|
164
|
-
localYargs = localYargs.option(
|
|
175
|
+
localYargs = localYargs.option(dashedName, {
|
|
165
176
|
type,
|
|
166
177
|
...sharedOptions,
|
|
167
178
|
});
|
|
168
179
|
}
|
|
169
180
|
else {
|
|
170
|
-
localYargs = localYargs.positional(
|
|
181
|
+
localYargs = localYargs.positional(dashedName, {
|
|
171
182
|
type: type === 'array' || type === 'count' ? 'string' : type,
|
|
172
183
|
...sharedOptions,
|
|
173
184
|
});
|
|
@@ -177,6 +188,18 @@ class CommandModule {
|
|
|
177
188
|
this.optionsWithAnalytics.set(name, userAnalytics);
|
|
178
189
|
}
|
|
179
190
|
}
|
|
191
|
+
// TODO(alanagius4): remove in a major version.
|
|
192
|
+
// the below is an interim workaround to handle options which have been defined in the schema with `no` prefix.
|
|
193
|
+
if (booleanOptionsWithNoPrefix.size) {
|
|
194
|
+
localYargs.middleware((options) => {
|
|
195
|
+
for (const key of booleanOptionsWithNoPrefix) {
|
|
196
|
+
if (key in options) {
|
|
197
|
+
options[`no-${key}`] = !options[key];
|
|
198
|
+
delete options[key];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}, false);
|
|
202
|
+
}
|
|
180
203
|
return localYargs;
|
|
181
204
|
}
|
|
182
205
|
getWorkspaceOrThrow() {
|
|
@@ -138,7 +138,7 @@ async function runCommand(args, logger) {
|
|
|
138
138
|
'deprecated: %s': color_1.colors.yellow('deprecated:') + ' %s',
|
|
139
139
|
'Did you mean %s?': 'Unknown command. Did you mean %s?',
|
|
140
140
|
})
|
|
141
|
-
.epilogue(
|
|
141
|
+
.epilogue('For more information, see https://angular.io/cli/.\n')
|
|
142
142
|
.demandCommand(1, command_1.demandCommandFailureMessage)
|
|
143
143
|
.recommendCommands()
|
|
144
144
|
.middleware(normalize_options_middleware_1.normalizeOptionsMiddleware)
|
|
@@ -71,25 +71,10 @@ class ConfigCommandModule extends command_module_1.CommandModule {
|
|
|
71
71
|
return 0;
|
|
72
72
|
}
|
|
73
73
|
async set(options) {
|
|
74
|
-
var _a;
|
|
74
|
+
var _a, _b;
|
|
75
75
|
if (!((_a = options.jsonPath) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
76
76
|
throw new command_module_1.CommandModuleError('Invalid Path.');
|
|
77
77
|
}
|
|
78
|
-
const validGlobalCliPaths = new Set([
|
|
79
|
-
'cli.warnings.versionMismatch',
|
|
80
|
-
'cli.defaultCollection',
|
|
81
|
-
'cli.schematicCollections',
|
|
82
|
-
'cli.packageManager',
|
|
83
|
-
'cli.analytics',
|
|
84
|
-
'cli.analyticsSharing.tracking',
|
|
85
|
-
'cli.analyticsSharing.uuid',
|
|
86
|
-
'cli.completion.prompted',
|
|
87
|
-
]);
|
|
88
|
-
if (options.global &&
|
|
89
|
-
!options.jsonPath.startsWith('schematics.') &&
|
|
90
|
-
!validGlobalCliPaths.has(options.jsonPath)) {
|
|
91
|
-
throw new command_module_1.CommandModuleError('Invalid Path.');
|
|
92
|
-
}
|
|
93
78
|
const [config, configPath] = await (0, config_1.getWorkspaceRaw)(options.global ? 'global' : 'local');
|
|
94
79
|
const { logger } = this.context;
|
|
95
80
|
if (!config || !configPath) {
|
|
@@ -104,7 +89,7 @@ class ConfigCommandModule extends command_module_1.CommandModule {
|
|
|
104
89
|
logger.error('Value cannot be found.');
|
|
105
90
|
return 1;
|
|
106
91
|
}
|
|
107
|
-
await (0, config_1.validateWorkspace)((0, json_file_1.parseJson)(config.content));
|
|
92
|
+
await (0, config_1.validateWorkspace)((0, json_file_1.parseJson)(config.content), (_b = options.global) !== null && _b !== void 0 ? _b : false);
|
|
108
93
|
config.save();
|
|
109
94
|
return 0;
|
|
110
95
|
}
|
package/src/commands/new/cli.js
CHANGED
|
@@ -27,7 +27,7 @@ class NewCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
27
27
|
describe: 'A collection of schematics to use in generating the initial application.',
|
|
28
28
|
type: 'string',
|
|
29
29
|
});
|
|
30
|
-
const { options: { collectionNameFromArgs }, } = this.context.args;
|
|
30
|
+
const { options: { collection: collectionNameFromArgs }, } = this.context.args;
|
|
31
31
|
const collectionName = typeof collectionNameFromArgs === 'string'
|
|
32
32
|
? collectionNameFromArgs
|
|
33
33
|
: await this.getCollectionFromConfig();
|
package/src/commands/run/cli.js
CHANGED
|
@@ -30,6 +30,16 @@ class RunCommandModule extends architect_base_command_module_1.ArchitectBaseComm
|
|
|
30
30
|
// Also, hide choices from JSON help so that we don't display them in AIO.
|
|
31
31
|
choices: (getYargsCompletions || help) && !jsonHelp ? this.getTargetChoices() : undefined,
|
|
32
32
|
})
|
|
33
|
+
.middleware((args) => {
|
|
34
|
+
// TODO: remove in version 15.
|
|
35
|
+
const { configuration, target } = args;
|
|
36
|
+
if (typeof configuration === 'string' && target) {
|
|
37
|
+
const targetWithConfig = target.split(':', 2);
|
|
38
|
+
targetWithConfig.push(configuration);
|
|
39
|
+
throw new command_module_1.CommandModuleError('Unknown argument: configuration.\n' +
|
|
40
|
+
`Provide the configuration as part of the target 'ng run ${targetWithConfig.join(':')}'.`);
|
|
41
|
+
}
|
|
42
|
+
}, true)
|
|
33
43
|
.strict();
|
|
34
44
|
const target = this.makeTargetSpecifier();
|
|
35
45
|
if (!target) {
|
|
@@ -73,8 +73,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
73
73
|
array: true,
|
|
74
74
|
})
|
|
75
75
|
.option('force', {
|
|
76
|
-
description: 'Ignore peer dependency version mismatches.
|
|
77
|
-
`Passes the '--force' flag to the package manager when installing packages.`,
|
|
76
|
+
description: 'Ignore peer dependency version mismatches.',
|
|
78
77
|
type: 'boolean',
|
|
79
78
|
default: false,
|
|
80
79
|
})
|
|
@@ -191,7 +190,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
191
190
|
logger.info(`Found ${rootDependencies.size} dependencies.`);
|
|
192
191
|
const workflow = new tools_1.NodeWorkflow(this.context.root, {
|
|
193
192
|
packageManager: packageManager.name,
|
|
194
|
-
packageManagerForce: options.
|
|
193
|
+
packageManagerForce: this.packageManagerForce(options.verbose),
|
|
195
194
|
// __dirname -> favor @schematics/update from this package
|
|
196
195
|
// Otherwise, use packages from the active workspace (migrations)
|
|
197
196
|
resolvePaths: [__dirname, this.context.root],
|
|
@@ -518,23 +517,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
518
517
|
});
|
|
519
518
|
}
|
|
520
519
|
catch { }
|
|
521
|
-
|
|
522
|
-
// npm 7+ can fail due to it incorrectly resolving peer dependencies that have valid SemVer
|
|
523
|
-
// ranges during an update. Update will set correct versions of dependencies within the
|
|
524
|
-
// package.json file. The force option is set to workaround these errors.
|
|
525
|
-
// Example error:
|
|
526
|
-
// npm ERR! Conflicting peer dependency: @angular/compiler-cli@14.0.0-rc.0
|
|
527
|
-
// npm ERR! node_modules/@angular/compiler-cli
|
|
528
|
-
// npm ERR! peer @angular/compiler-cli@"^14.0.0 || ^14.0.0-rc" from @angular-devkit/build-angular@14.0.0-rc.0
|
|
529
|
-
// npm ERR! node_modules/@angular-devkit/build-angular
|
|
530
|
-
// npm ERR! dev @angular-devkit/build-angular@"~14.0.0-rc.0" from the root project
|
|
531
|
-
if (this.context.packageManager.name === workspace_schema_1.PackageManager.Npm &&
|
|
532
|
-
this.context.packageManager.version &&
|
|
533
|
-
semver.gte(this.context.packageManager.version, '7.0.0', { includePrerelease: true })) {
|
|
534
|
-
logVerbose('NPM 7+ detected -- enabling force option for package installation');
|
|
535
|
-
forceInstall = true;
|
|
536
|
-
}
|
|
537
|
-
const installationSuccess = await this.context.packageManager.installAll(forceInstall ? ['--force'] : [], this.context.root);
|
|
520
|
+
const installationSuccess = await this.context.packageManager.installAll(this.packageManagerForce(options.verbose) ? ['--force'] : [], this.context.root);
|
|
538
521
|
if (!installationSuccess) {
|
|
539
522
|
return 1;
|
|
540
523
|
}
|
|
@@ -749,6 +732,26 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
749
732
|
}
|
|
750
733
|
return status !== null && status !== void 0 ? status : 0;
|
|
751
734
|
}
|
|
735
|
+
packageManagerForce(verbose) {
|
|
736
|
+
// npm 7+ can fail due to it incorrectly resolving peer dependencies that have valid SemVer
|
|
737
|
+
// ranges during an update. Update will set correct versions of dependencies within the
|
|
738
|
+
// package.json file. The force option is set to workaround these errors.
|
|
739
|
+
// Example error:
|
|
740
|
+
// npm ERR! Conflicting peer dependency: @angular/compiler-cli@14.0.0-rc.0
|
|
741
|
+
// npm ERR! node_modules/@angular/compiler-cli
|
|
742
|
+
// npm ERR! peer @angular/compiler-cli@"^14.0.0 || ^14.0.0-rc" from @angular-devkit/build-angular@14.0.0-rc.0
|
|
743
|
+
// npm ERR! node_modules/@angular-devkit/build-angular
|
|
744
|
+
// npm ERR! dev @angular-devkit/build-angular@"~14.0.0-rc.0" from the root project
|
|
745
|
+
if (this.context.packageManager.name === workspace_schema_1.PackageManager.Npm &&
|
|
746
|
+
this.context.packageManager.version &&
|
|
747
|
+
semver.gte(this.context.packageManager.version, '7.0.0', { includePrerelease: true })) {
|
|
748
|
+
if (verbose) {
|
|
749
|
+
this.context.logger.info('NPM 7+ detected -- enabling force option for package installation');
|
|
750
|
+
}
|
|
751
|
+
return true;
|
|
752
|
+
}
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
752
755
|
}
|
|
753
756
|
exports.UpdateCommandModule = UpdateCommandModule;
|
|
754
757
|
/**
|
package/src/utilities/color.js
CHANGED
|
@@ -64,7 +64,6 @@ function removeColor(text) {
|
|
|
64
64
|
}
|
|
65
65
|
exports.removeColor = removeColor;
|
|
66
66
|
// Create a separate instance to prevent unintended global changes to the color configuration
|
|
67
|
-
// Create function is not defined in the typings. See: https://github.com/doowb/ansi-colors/pull/44
|
|
68
67
|
const colors = ansiColors.create();
|
|
69
68
|
exports.colors = colors;
|
|
70
69
|
colors.enabled = supportColor();
|
|
@@ -31,7 +31,7 @@ export declare function getWorkspace(level: 'local' | 'global'): Promise<Angular
|
|
|
31
31
|
* NB: This method is intended to be used only for `ng config`.
|
|
32
32
|
*/
|
|
33
33
|
export declare function getWorkspaceRaw(level?: 'local' | 'global'): Promise<[JSONFile | null, string | null]>;
|
|
34
|
-
export declare function validateWorkspace(data: json.JsonObject): Promise<void>;
|
|
34
|
+
export declare function validateWorkspace(data: json.JsonObject, isGlobal: boolean): Promise<void>;
|
|
35
35
|
export declare function getProjectByCwd(workspace: AngularWorkspace): string | null;
|
|
36
36
|
export declare function getConfiguredPackageManager(): Promise<PackageManager | null>;
|
|
37
37
|
export declare function getSchematicDefaults(collection: string, schematic: string, project?: string | null): Promise<{}>;
|
package/src/utilities/config.js
CHANGED
|
@@ -200,11 +200,18 @@ async function getWorkspaceRaw(level = 'local') {
|
|
|
200
200
|
return [new json_file_1.JSONFile(configPath), configPath];
|
|
201
201
|
}
|
|
202
202
|
exports.getWorkspaceRaw = getWorkspaceRaw;
|
|
203
|
-
async function validateWorkspace(data) {
|
|
203
|
+
async function validateWorkspace(data, isGlobal) {
|
|
204
204
|
const schema = (0, json_file_1.readAndParseJson)(exports.workspaceSchemaPath);
|
|
205
|
+
// We should eventually have a dedicated global config schema and use that to validate.
|
|
206
|
+
const schemaToValidate = isGlobal
|
|
207
|
+
? {
|
|
208
|
+
'$ref': '#/definitions/global',
|
|
209
|
+
definitions: schema['definitions'],
|
|
210
|
+
}
|
|
211
|
+
: schema;
|
|
205
212
|
const { formats } = await Promise.resolve().then(() => __importStar(require('@angular-devkit/schematics')));
|
|
206
213
|
const registry = new core_1.json.schema.CoreSchemaRegistry(formats.standardFormats);
|
|
207
|
-
const validator = await registry.compile(
|
|
214
|
+
const validator = await registry.compile(schemaToValidate).toPromise();
|
|
208
215
|
const { success, errors } = await validator(data).toPromise();
|
|
209
216
|
if (!success) {
|
|
210
217
|
throw new core_1.json.schema.SchemaValidationException(errors);
|