@angular/cli 14.0.0-rc.1 → 14.0.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/lib/config/schema.json +33 -1
- package/package.json +11 -11
- package/src/command-builder/command-module.js +1 -6
- package/src/command-builder/schematics-command-module.js +28 -4
- package/src/commands/completion/long-description.md +3 -6
- package/src/commands/update/cli.js +18 -5
- package/src/utilities/package-manager.js +8 -13
package/lib/config/schema.json
CHANGED
|
@@ -742,6 +742,9 @@
|
|
|
742
742
|
"path": {
|
|
743
743
|
"type": "string",
|
|
744
744
|
"format": "path",
|
|
745
|
+
"$default": {
|
|
746
|
+
"$source": "workingDirectory"
|
|
747
|
+
},
|
|
745
748
|
"description": "The path at which to create the class, relative to the workspace root.",
|
|
746
749
|
"visible": false
|
|
747
750
|
},
|
|
@@ -773,6 +776,9 @@
|
|
|
773
776
|
"path": {
|
|
774
777
|
"type": "string",
|
|
775
778
|
"format": "path",
|
|
779
|
+
"$default": {
|
|
780
|
+
"$source": "workingDirectory"
|
|
781
|
+
},
|
|
776
782
|
"description": "The path at which to create the component file, relative to the current workspace. Default is a folder with the same name as the component in the project root.",
|
|
777
783
|
"visible": false
|
|
778
784
|
},
|
|
@@ -929,6 +935,9 @@
|
|
|
929
935
|
"path": {
|
|
930
936
|
"type": "string",
|
|
931
937
|
"format": "path",
|
|
938
|
+
"$default": {
|
|
939
|
+
"$source": "workingDirectory"
|
|
940
|
+
},
|
|
932
941
|
"description": "The path at which to create the interface that defines the directive, relative to the workspace root.",
|
|
933
942
|
"visible": false
|
|
934
943
|
},
|
|
@@ -1012,6 +1021,9 @@
|
|
|
1012
1021
|
"path": {
|
|
1013
1022
|
"type": "string",
|
|
1014
1023
|
"format": "path",
|
|
1024
|
+
"$default": {
|
|
1025
|
+
"$source": "workingDirectory"
|
|
1026
|
+
},
|
|
1015
1027
|
"description": "The path at which to create the enum definition, relative to the current workspace.",
|
|
1016
1028
|
"visible": false
|
|
1017
1029
|
},
|
|
@@ -1057,6 +1069,9 @@
|
|
|
1057
1069
|
"path": {
|
|
1058
1070
|
"type": "string",
|
|
1059
1071
|
"format": "path",
|
|
1072
|
+
"$default": {
|
|
1073
|
+
"$source": "workingDirectory"
|
|
1074
|
+
},
|
|
1060
1075
|
"description": "The path at which to create the interface that defines the guard, relative to the current workspace.",
|
|
1061
1076
|
"visible": false
|
|
1062
1077
|
},
|
|
@@ -1106,6 +1121,9 @@
|
|
|
1106
1121
|
"path": {
|
|
1107
1122
|
"type": "string",
|
|
1108
1123
|
"format": "path",
|
|
1124
|
+
"$default": {
|
|
1125
|
+
"$source": "workingDirectory"
|
|
1126
|
+
},
|
|
1109
1127
|
"description": "The path at which to create the interceptor, relative to the workspace root.",
|
|
1110
1128
|
"visible": false
|
|
1111
1129
|
},
|
|
@@ -1147,6 +1165,9 @@
|
|
|
1147
1165
|
"path": {
|
|
1148
1166
|
"type": "string",
|
|
1149
1167
|
"format": "path",
|
|
1168
|
+
"$default": {
|
|
1169
|
+
"$source": "workingDirectory"
|
|
1170
|
+
},
|
|
1150
1171
|
"description": "The path at which to create the interface, relative to the workspace root.",
|
|
1151
1172
|
"visible": false
|
|
1152
1173
|
},
|
|
@@ -1236,6 +1257,9 @@
|
|
|
1236
1257
|
"path": {
|
|
1237
1258
|
"type": "string",
|
|
1238
1259
|
"format": "path",
|
|
1260
|
+
"$default": {
|
|
1261
|
+
"$source": "workingDirectory"
|
|
1262
|
+
},
|
|
1239
1263
|
"description": "The path at which to create the pipe, relative to the workspace root.",
|
|
1240
1264
|
"visible": false
|
|
1241
1265
|
},
|
|
@@ -1466,6 +1490,9 @@
|
|
|
1466
1490
|
"path": {
|
|
1467
1491
|
"type": "string",
|
|
1468
1492
|
"format": "path",
|
|
1493
|
+
"$default": {
|
|
1494
|
+
"$source": "workingDirectory"
|
|
1495
|
+
},
|
|
1469
1496
|
"description": "The path at which to create the interface that defines the resolver, relative to the current workspace.",
|
|
1470
1497
|
"visible": false
|
|
1471
1498
|
},
|
|
@@ -1495,7 +1522,9 @@
|
|
|
1495
1522
|
},
|
|
1496
1523
|
"path": {
|
|
1497
1524
|
"type": "string",
|
|
1498
|
-
"
|
|
1525
|
+
"$default": {
|
|
1526
|
+
"$source": "workingDirectory"
|
|
1527
|
+
},
|
|
1499
1528
|
"description": "The path at which to create the service, relative to the workspace root.",
|
|
1500
1529
|
"visible": false
|
|
1501
1530
|
},
|
|
@@ -1528,6 +1557,9 @@
|
|
|
1528
1557
|
"path": {
|
|
1529
1558
|
"type": "string",
|
|
1530
1559
|
"format": "path",
|
|
1560
|
+
"$default": {
|
|
1561
|
+
"$source": "workingDirectory"
|
|
1562
|
+
},
|
|
1531
1563
|
"description": "The path at which to create the worker file, relative to the current workspace.",
|
|
1532
1564
|
"visible": false
|
|
1533
1565
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "14.0.0
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/angular/angular-cli",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@angular-devkit/architect": "0.1400.0
|
|
29
|
-
"@angular-devkit/core": "14.0.0
|
|
30
|
-
"@angular-devkit/schematics": "14.0.0
|
|
31
|
-
"@schematics/angular": "14.0.0
|
|
28
|
+
"@angular-devkit/architect": "0.1400.0",
|
|
29
|
+
"@angular-devkit/core": "14.0.0",
|
|
30
|
+
"@angular-devkit/schematics": "14.0.0",
|
|
31
|
+
"@schematics/angular": "14.0.0",
|
|
32
32
|
"@yarnpkg/lockfile": "1.1.0",
|
|
33
33
|
"ansi-colors": "4.1.1",
|
|
34
34
|
"debug": "4.3.4",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"ng-update": {
|
|
50
50
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
51
51
|
"packageGroup": {
|
|
52
|
-
"@angular/cli": "14.0.0
|
|
53
|
-
"@angular-devkit/architect": "0.1400.0
|
|
54
|
-
"@angular-devkit/build-angular": "14.0.0
|
|
55
|
-
"@angular-devkit/build-webpack": "0.1400.0
|
|
56
|
-
"@angular-devkit/core": "14.0.0
|
|
57
|
-
"@angular-devkit/schematics": "14.0.0
|
|
52
|
+
"@angular/cli": "14.0.0",
|
|
53
|
+
"@angular-devkit/architect": "0.1400.0",
|
|
54
|
+
"@angular-devkit/build-angular": "14.0.0",
|
|
55
|
+
"@angular-devkit/build-webpack": "0.1400.0",
|
|
56
|
+
"@angular-devkit/core": "14.0.0",
|
|
57
|
+
"@angular-devkit/schematics": "14.0.0"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
@@ -148,9 +148,8 @@ class CommandModule {
|
|
|
148
148
|
* **Note:** This method should be called from the command bundler method.
|
|
149
149
|
*/
|
|
150
150
|
addSchemaOptionsToCommand(localYargs, options) {
|
|
151
|
-
const workingDir = (0, core_1.normalize)(path.relative(this.context.root, process.cwd()));
|
|
152
151
|
for (const option of options) {
|
|
153
|
-
const { default: defaultVal, positional, deprecated, description, alias, userAnalytics, type, hidden, name, choices,
|
|
152
|
+
const { default: defaultVal, positional, deprecated, description, alias, userAnalytics, type, hidden, name, choices, } = option;
|
|
154
153
|
const sharedOptions = {
|
|
155
154
|
alias,
|
|
156
155
|
hidden,
|
|
@@ -160,10 +159,6 @@ class CommandModule {
|
|
|
160
159
|
// This should only be done when `--help` is used otherwise default will override options set in angular.json.
|
|
161
160
|
...(this.context.args.options.help ? { default: defaultVal } : {}),
|
|
162
161
|
};
|
|
163
|
-
// Special case for schematics
|
|
164
|
-
if (workingDir && format === 'path' && name === 'path' && hidden) {
|
|
165
|
-
sharedOptions.default = workingDir;
|
|
166
|
-
}
|
|
167
162
|
if (positional === undefined) {
|
|
168
163
|
localYargs = localYargs.option(core_1.strings.dasherize(name), {
|
|
169
164
|
type,
|
|
@@ -120,8 +120,10 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
120
120
|
engineHostCreator: (options) => new schematic_engine_host_1.SchematicEngineHost(options.resolvePaths),
|
|
121
121
|
});
|
|
122
122
|
workflow.registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
|
|
123
|
-
workflow.registry.addSmartDefaultProvider('projectName', () => this.getProjectName());
|
|
124
123
|
workflow.registry.useXDeprecatedProvider((msg) => logger.warn(msg));
|
|
124
|
+
workflow.registry.addSmartDefaultProvider('projectName', () => this.getProjectName());
|
|
125
|
+
const workingDir = (0, core_1.normalize)((0, path_1.relative)(this.context.root, process.cwd()));
|
|
126
|
+
workflow.registry.addSmartDefaultProvider('workingDirectory', () => workingDir === '' ? undefined : workingDir);
|
|
125
127
|
let shouldReportAnalytics = true;
|
|
126
128
|
workflow.engineHost.registerOptionsTransform(async (schematic, options) => {
|
|
127
129
|
var _a;
|
|
@@ -135,6 +137,28 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
135
137
|
schematic.name.replace(/\//g, '_'),
|
|
136
138
|
]);
|
|
137
139
|
}
|
|
140
|
+
// TODO: The below should be removed in version 15 when we change 1P schematics to use the `workingDirectory smart default`.
|
|
141
|
+
// Handle `"format": "path"` options.
|
|
142
|
+
const schema = schematic === null || schematic === void 0 ? void 0 : schematic.schemaJson;
|
|
143
|
+
if (!options || !schema || !(0, core_1.isJsonObject)(schema)) {
|
|
144
|
+
return options;
|
|
145
|
+
}
|
|
146
|
+
if (!('path' in options && options['path'] === undefined)) {
|
|
147
|
+
return options;
|
|
148
|
+
}
|
|
149
|
+
const properties = schema === null || schema === void 0 ? void 0 : schema['properties'];
|
|
150
|
+
if (!properties || !(0, core_1.isJsonObject)(properties)) {
|
|
151
|
+
return options;
|
|
152
|
+
}
|
|
153
|
+
const property = properties['path'];
|
|
154
|
+
if (!property || !(0, core_1.isJsonObject)(property)) {
|
|
155
|
+
return options;
|
|
156
|
+
}
|
|
157
|
+
if (property['format'] === 'path' && !property['$default']) {
|
|
158
|
+
options['path'] = workingDir || undefined;
|
|
159
|
+
this.context.logger.warn(`The 'path' option in '${schematic === null || schematic === void 0 ? void 0 : schematic.schema}' is using deprecated behaviour.` +
|
|
160
|
+
`'workingDirectory' smart default provider should be used instead.`);
|
|
161
|
+
}
|
|
138
162
|
return options;
|
|
139
163
|
});
|
|
140
164
|
if (options.interactive !== false && (0, tty_1.isTTY)()) {
|
|
@@ -304,9 +328,9 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
304
328
|
if (typeof defaultProjectName === 'string' && defaultProjectName) {
|
|
305
329
|
if (!this.defaultProjectDeprecationWarningShown) {
|
|
306
330
|
logger.warn(core_1.tags.oneLine `
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
331
|
+
DEPRECATED: The 'defaultProject' workspace option has been deprecated.
|
|
332
|
+
The project to use will be determined from the current working directory.
|
|
333
|
+
`);
|
|
310
334
|
this.defaultProjectDeprecationWarningShown = true;
|
|
311
335
|
}
|
|
312
336
|
return defaultProjectName;
|
|
@@ -4,7 +4,7 @@ discover and use CLI commands without lots of memorization.
|
|
|
4
4
|
|
|
5
5
|

|
|
8
8
|
|
|
9
9
|
## Automated setup
|
|
10
10
|
|
|
@@ -13,11 +13,8 @@ Simply answer "Yes" and the CLI will take care of the rest.
|
|
|
13
13
|
|
|
14
14
|
```
|
|
15
15
|
$ ng serve
|
|
16
|
-
? Would you like to enable autocompletion? This will set up your terminal so pressing TAB while
|
|
17
|
-
|
|
18
|
-
autocompletion will modify configuration files in your home directory.) Yes
|
|
19
|
-
Appended `source <(ng completion script)` to `/home/my-username/.bashrc`. Restart your terminal or
|
|
20
|
-
run:
|
|
16
|
+
? Would you like to enable autocompletion? This will set up your terminal so pressing TAB while typing Angular CLI commands will show possible options and autocomplete arguments. (Enabling autocompletion will modify configuration files in your home directory.) Yes
|
|
17
|
+
Appended `source <(ng completion script)` to `/home/my-username/.bashrc`. Restart your terminal or run:
|
|
21
18
|
|
|
22
19
|
source <(ng completion script)
|
|
23
20
|
|
|
@@ -122,7 +122,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
122
122
|
alias: ['C'],
|
|
123
123
|
default: false,
|
|
124
124
|
})
|
|
125
|
-
.check(({ packages,
|
|
125
|
+
.check(({ packages, 'allow-dirty': allowDirty, 'migrate-only': migrateOnly }) => {
|
|
126
126
|
const { logger } = this.context;
|
|
127
127
|
// This allows the user to easily reset any changes from the update.
|
|
128
128
|
if ((packages === null || packages === void 0 ? void 0 : packages.length) && !this.checkCleanGit()) {
|
|
@@ -137,9 +137,6 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
137
137
|
if ((packages === null || packages === void 0 ? void 0 : packages.length) !== 1) {
|
|
138
138
|
throw new command_module_1.CommandModuleError(`A single package must be specified when using the 'migrate-only' option.`);
|
|
139
139
|
}
|
|
140
|
-
if (next) {
|
|
141
|
-
logger.warn(`'next' option has no effect when using 'migrate-only' option.`);
|
|
142
|
-
}
|
|
143
140
|
}
|
|
144
141
|
return true;
|
|
145
142
|
})
|
|
@@ -513,7 +510,23 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
513
510
|
});
|
|
514
511
|
}
|
|
515
512
|
catch { }
|
|
516
|
-
|
|
513
|
+
let forceInstall = options.force;
|
|
514
|
+
// npm 7+ can fail due to it incorrectly resolving peer dependencies that have valid SemVer
|
|
515
|
+
// ranges during an update. Update will set correct versions of dependencies within the
|
|
516
|
+
// package.json file. The force option is set to workaround these errors.
|
|
517
|
+
// Example error:
|
|
518
|
+
// npm ERR! Conflicting peer dependency: @angular/compiler-cli@14.0.0-rc.0
|
|
519
|
+
// npm ERR! node_modules/@angular/compiler-cli
|
|
520
|
+
// npm ERR! peer @angular/compiler-cli@"^14.0.0 || ^14.0.0-rc" from @angular-devkit/build-angular@14.0.0-rc.0
|
|
521
|
+
// npm ERR! node_modules/@angular-devkit/build-angular
|
|
522
|
+
// npm ERR! dev @angular-devkit/build-angular@"~14.0.0-rc.0" from the root project
|
|
523
|
+
if (this.context.packageManager.name === workspace_schema_1.PackageManager.Npm &&
|
|
524
|
+
this.context.packageManager.version &&
|
|
525
|
+
semver.gte(this.context.packageManager.version, '7.0.0', { includePrerelease: true })) {
|
|
526
|
+
logVerbose('NPM 7+ detected -- enabling force option for package installation');
|
|
527
|
+
forceInstall = true;
|
|
528
|
+
}
|
|
529
|
+
const installationSuccess = await this.context.packageManager.installAll(forceInstall ? ['--force'] : [], this.context.root);
|
|
517
530
|
if (!installationSuccess) {
|
|
518
531
|
return 1;
|
|
519
532
|
}
|
|
@@ -61,24 +61,20 @@ class PackageManagerUtils {
|
|
|
61
61
|
/** Install a single package. */
|
|
62
62
|
async install(packageName, save = true, extraArgs = [], cwd) {
|
|
63
63
|
const packageManagerArgs = this.getArguments();
|
|
64
|
-
const installArgs = [
|
|
65
|
-
packageManagerArgs.install,
|
|
66
|
-
packageName,
|
|
67
|
-
packageManagerArgs.silent,
|
|
68
|
-
];
|
|
64
|
+
const installArgs = [packageManagerArgs.install, packageName];
|
|
69
65
|
if (save === 'devDependencies') {
|
|
70
66
|
installArgs.push(packageManagerArgs.saveDev);
|
|
71
67
|
}
|
|
72
|
-
return this.run([...installArgs, ...extraArgs], cwd);
|
|
68
|
+
return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
|
|
73
69
|
}
|
|
74
70
|
/** Install all packages. */
|
|
75
71
|
async installAll(extraArgs = [], cwd) {
|
|
76
72
|
const packageManagerArgs = this.getArguments();
|
|
77
|
-
const installArgs = [
|
|
73
|
+
const installArgs = [];
|
|
78
74
|
if (packageManagerArgs.installAll) {
|
|
79
75
|
installArgs.push(packageManagerArgs.installAll);
|
|
80
76
|
}
|
|
81
|
-
return this.run([...installArgs, ...extraArgs], cwd);
|
|
77
|
+
return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
|
|
82
78
|
}
|
|
83
79
|
/** Install a single package temporary. */
|
|
84
80
|
async installTemp(packageName, extraArgs) {
|
|
@@ -123,7 +119,6 @@ class PackageManagerUtils {
|
|
|
123
119
|
switch (this.name) {
|
|
124
120
|
case workspace_schema_1.PackageManager.Yarn:
|
|
125
121
|
return {
|
|
126
|
-
silent: '--silent',
|
|
127
122
|
saveDev: '--dev',
|
|
128
123
|
install: 'add',
|
|
129
124
|
prefix: '--modules-folder',
|
|
@@ -131,7 +126,6 @@ class PackageManagerUtils {
|
|
|
131
126
|
};
|
|
132
127
|
case workspace_schema_1.PackageManager.Pnpm:
|
|
133
128
|
return {
|
|
134
|
-
silent: '--silent',
|
|
135
129
|
saveDev: '--save-dev',
|
|
136
130
|
install: 'add',
|
|
137
131
|
installAll: 'install',
|
|
@@ -140,7 +134,6 @@ class PackageManagerUtils {
|
|
|
140
134
|
};
|
|
141
135
|
default:
|
|
142
136
|
return {
|
|
143
|
-
silent: '--quiet',
|
|
144
137
|
saveDev: '--save-dev',
|
|
145
138
|
install: 'install',
|
|
146
139
|
installAll: 'install',
|
|
@@ -149,14 +142,16 @@ class PackageManagerUtils {
|
|
|
149
142
|
};
|
|
150
143
|
}
|
|
151
144
|
}
|
|
152
|
-
async run(args,
|
|
145
|
+
async run(args, options = {}) {
|
|
146
|
+
const { cwd = process.cwd(), silent = false } = options;
|
|
153
147
|
const spinner = new spinner_1.Spinner();
|
|
154
148
|
spinner.start('Installing packages...');
|
|
155
149
|
return new Promise((resolve) => {
|
|
156
150
|
var _a, _b;
|
|
157
151
|
const bufferedOutput = [];
|
|
158
152
|
const childProcess = (0, child_process_1.spawn)(this.name, args, {
|
|
159
|
-
|
|
153
|
+
// Always pipe stderr to allow for failures to be reported
|
|
154
|
+
stdio: silent ? ['ignore', 'ignore', 'pipe'] : 'pipe',
|
|
160
155
|
shell: true,
|
|
161
156
|
cwd,
|
|
162
157
|
}).on('close', (code) => {
|