@angular/cli 14.1.0-next.0 → 14.1.0-next.1
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/cli/index.js +2 -2
- package/package.json +11 -11
- package/src/analytics/analytics.js +3 -0
- package/src/command-builder/architect-base-command-module.d.ts +1 -1
- package/src/command-builder/architect-base-command-module.js +4 -1
- package/src/command-builder/command-module.d.ts +3 -1
- package/src/command-builder/command-module.js +1 -1
- package/src/command-builder/command-runner.js +3 -22
- package/src/command-builder/schematics-command-module.d.ts +1 -1
- package/src/command-builder/schematics-command-module.js +3 -1
- package/src/command-builder/utilities/command.js +13 -2
- package/src/command-builder/utilities/schematic-engine-host.js +2 -0
- package/src/commands/add/cli.js +5 -0
- 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 +2 -2
- package/src/commands/cache/settings/cli.js +2 -2
- package/src/commands/completion/cli.js +2 -0
- 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/update/cli.d.ts +1 -1
- package/src/commands/update/cli.js +11 -1
- package/src/commands/update/schematic/index.js +3 -0
- package/src/utilities/completion.js +3 -0
- package/src/utilities/error.d.ts +10 -0
- package/src/utilities/error.js +18 -0
package/lib/cli/index.js
CHANGED
|
@@ -81,7 +81,7 @@ async function default_1(options) {
|
|
|
81
81
|
}
|
|
82
82
|
catch (e) {
|
|
83
83
|
logger.fatal(`An unhandled exception occurred: ${err.message}\n` +
|
|
84
|
-
`Fatal error writing debug log file: ${e
|
|
84
|
+
`Fatal error writing debug log file: ${e}`);
|
|
85
85
|
if (err.stack) {
|
|
86
86
|
logger.fatal(err.stack);
|
|
87
87
|
}
|
|
@@ -95,7 +95,7 @@ async function default_1(options) {
|
|
|
95
95
|
// Log nothing.
|
|
96
96
|
}
|
|
97
97
|
else {
|
|
98
|
-
logger.fatal(`An unexpected error occurred: ${
|
|
98
|
+
logger.fatal(`An unexpected error occurred: ${err}`);
|
|
99
99
|
}
|
|
100
100
|
return 1;
|
|
101
101
|
}
|
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.1",
|
|
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.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.1",
|
|
29
|
+
"@angular-devkit/core": "14.1.0-next.1",
|
|
30
|
+
"@angular-devkit/schematics": "14.1.0-next.1",
|
|
31
|
+
"@schematics/angular": "14.1.0-next.1",
|
|
32
32
|
"@yarnpkg/lockfile": "1.1.0",
|
|
33
33
|
"ansi-colors": "4.1.3",
|
|
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.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.1",
|
|
53
|
+
"@angular-devkit/architect": "0.1401.0-next.1",
|
|
54
|
+
"@angular-devkit/build-angular": "14.1.0-next.1",
|
|
55
|
+
"@angular-devkit/build-webpack": "0.1401.0-next.1",
|
|
56
|
+
"@angular-devkit/core": "14.1.0-next.1",
|
|
57
|
+
"@angular-devkit/schematics": "14.1.0-next.1"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
@@ -40,6 +40,7 @@ const uuid_1 = require("uuid");
|
|
|
40
40
|
const color_1 = require("../utilities/color");
|
|
41
41
|
const config_1 = require("../utilities/config");
|
|
42
42
|
const environment_options_1 = require("../utilities/environment-options");
|
|
43
|
+
const error_1 = require("../utilities/error");
|
|
43
44
|
const tty_1 = require("../utilities/tty");
|
|
44
45
|
const version_1 = require("../utilities/version");
|
|
45
46
|
const analytics_collector_1 = require("./analytics-collector");
|
|
@@ -200,6 +201,7 @@ async function getAnalytics(level) {
|
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
catch (err) {
|
|
204
|
+
(0, error_1.assertIsError)(err);
|
|
203
205
|
analyticsDebug('Error happened during reading of analytics config: %s', err.message);
|
|
204
206
|
return undefined;
|
|
205
207
|
}
|
|
@@ -229,6 +231,7 @@ async function getSharedAnalytics() {
|
|
|
229
231
|
}
|
|
230
232
|
}
|
|
231
233
|
catch (err) {
|
|
234
|
+
(0, error_1.assertIsError)(err);
|
|
232
235
|
analyticsDebug('Error happened during reading of analytics sharing config: %s', err.message);
|
|
233
236
|
return undefined;
|
|
234
237
|
}
|
|
@@ -14,7 +14,7 @@ export interface MissingTargetChoice {
|
|
|
14
14
|
value: string;
|
|
15
15
|
}
|
|
16
16
|
export declare abstract class ArchitectBaseCommandModule<T extends object> extends CommandModule<T> implements CommandModuleImplementation<T> {
|
|
17
|
-
|
|
17
|
+
scope: CommandScope;
|
|
18
18
|
protected shouldReportAnalytics: boolean;
|
|
19
19
|
protected readonly missingTargetChoices: MissingTargetChoice[] | undefined;
|
|
20
20
|
protected runSingleTarget(target: Target, options: OtherOptions): Promise<number>;
|
|
@@ -15,6 +15,7 @@ const child_process_1 = require("child_process");
|
|
|
15
15
|
const fs_1 = require("fs");
|
|
16
16
|
const path_1 = require("path");
|
|
17
17
|
const analytics_1 = require("../analytics/analytics");
|
|
18
|
+
const error_1 = require("../utilities/error");
|
|
18
19
|
const prompt_1 = require("../utilities/prompt");
|
|
19
20
|
const tty_1 = require("../utilities/tty");
|
|
20
21
|
const command_module_1 = require("./command-module");
|
|
@@ -22,6 +23,7 @@ const json_schema_1 = require("./utilities/json-schema");
|
|
|
22
23
|
class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
23
24
|
constructor() {
|
|
24
25
|
super(...arguments);
|
|
26
|
+
this.scope = command_module_1.CommandScope.In;
|
|
25
27
|
this.shouldReportAnalytics = false;
|
|
26
28
|
}
|
|
27
29
|
async runSingleTarget(target, options) {
|
|
@@ -31,6 +33,7 @@ class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
|
31
33
|
builderName = await architectHost.getBuilderNameForTarget(target);
|
|
32
34
|
}
|
|
33
35
|
catch (e) {
|
|
36
|
+
(0, error_1.assertIsError)(e);
|
|
34
37
|
return this.onMissingTarget(e.message);
|
|
35
38
|
}
|
|
36
39
|
await this.reportAnalytics({
|
|
@@ -80,6 +83,7 @@ class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
|
80
83
|
builderDesc = await architectHost.resolveBuilder(builderConf);
|
|
81
84
|
}
|
|
82
85
|
catch (e) {
|
|
86
|
+
(0, error_1.assertIsError)(e);
|
|
83
87
|
if (e.code === 'MODULE_NOT_FOUND') {
|
|
84
88
|
this.warnOnMissingNodeModules();
|
|
85
89
|
throw new command_module_1.CommandModuleError(`Could not find the '${builderConf}' builder's node package.`);
|
|
@@ -162,4 +166,3 @@ class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
168
|
exports.ArchitectBaseCommandModule = ArchitectBaseCommandModule;
|
|
165
|
-
ArchitectBaseCommandModule.scope = command_module_1.CommandScope.In;
|
|
@@ -40,6 +40,8 @@ export interface CommandContext {
|
|
|
40
40
|
}
|
|
41
41
|
export declare type OtherOptions = Record<string, unknown>;
|
|
42
42
|
export interface CommandModuleImplementation<T extends {} = {}> extends Omit<YargsCommandModule<{}, T>, 'builder' | 'handler'> {
|
|
43
|
+
/** Scope in which the command can be executed in. */
|
|
44
|
+
scope: CommandScope;
|
|
43
45
|
/** Path used to load the long description for the command in JSON help text. */
|
|
44
46
|
longDescriptionPath?: string;
|
|
45
47
|
/** Object declaring the options the command accepts, or a function accepting and returning a yargs instance. */
|
|
@@ -58,7 +60,7 @@ export declare abstract class CommandModule<T extends {} = {}> implements Comman
|
|
|
58
60
|
abstract readonly describe: string | false;
|
|
59
61
|
abstract readonly longDescriptionPath?: string;
|
|
60
62
|
protected readonly shouldReportAnalytics: boolean;
|
|
61
|
-
|
|
63
|
+
readonly scope: CommandScope;
|
|
62
64
|
private readonly optionsWithAnalytics;
|
|
63
65
|
constructor(context: CommandContext);
|
|
64
66
|
/**
|
|
@@ -57,6 +57,7 @@ class CommandModule {
|
|
|
57
57
|
constructor(context) {
|
|
58
58
|
this.context = context;
|
|
59
59
|
this.shouldReportAnalytics = true;
|
|
60
|
+
this.scope = CommandScope.Both;
|
|
60
61
|
this.optionsWithAnalytics = new Map();
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
@@ -186,7 +187,6 @@ class CommandModule {
|
|
|
186
187
|
return workspace;
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
|
-
CommandModule.scope = CommandScope.Both;
|
|
190
190
|
__decorate([
|
|
191
191
|
memoize_1.memoize
|
|
192
192
|
], CommandModule.prototype, "getAnalytics", null);
|
|
@@ -34,6 +34,7 @@ const cli_18 = require("../commands/update/cli");
|
|
|
34
34
|
const cli_19 = require("../commands/version/cli");
|
|
35
35
|
const color_1 = require("../utilities/color");
|
|
36
36
|
const config_1 = require("../utilities/config");
|
|
37
|
+
const error_1 = require("../utilities/error");
|
|
37
38
|
const package_manager_1 = require("../utilities/package-manager");
|
|
38
39
|
const command_module_1 = require("./command-module");
|
|
39
40
|
const command_1 = require("./utilities/command");
|
|
@@ -78,6 +79,7 @@ async function runCommand(args, logger) {
|
|
|
78
79
|
]);
|
|
79
80
|
}
|
|
80
81
|
catch (e) {
|
|
82
|
+
(0, error_1.assertIsError)(e);
|
|
81
83
|
logger.fatal(e.message);
|
|
82
84
|
return 1;
|
|
83
85
|
}
|
|
@@ -101,13 +103,6 @@ async function runCommand(args, logger) {
|
|
|
101
103
|
};
|
|
102
104
|
let localYargs = (0, yargs_1.default)(args);
|
|
103
105
|
for (const CommandModule of COMMANDS) {
|
|
104
|
-
if (!jsonHelp) {
|
|
105
|
-
// Skip scope validation when running with '--json-help' since it's easier to generate the output for all commands this way.
|
|
106
|
-
const scope = CommandModule.scope;
|
|
107
|
-
if ((scope === command_module_1.CommandScope.In && !workspace) || (scope === command_module_1.CommandScope.Out && workspace)) {
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
106
|
localYargs = (0, command_1.addCommandModuleToYargs)(localYargs, CommandModule, context);
|
|
112
107
|
}
|
|
113
108
|
if (jsonHelp) {
|
|
@@ -143,7 +138,7 @@ async function runCommand(args, logger) {
|
|
|
143
138
|
'deprecated: %s': color_1.colors.yellow('deprecated:') + ' %s',
|
|
144
139
|
'Did you mean %s?': 'Unknown command. Did you mean %s?',
|
|
145
140
|
})
|
|
146
|
-
.epilogue(color_1.colors.gray(
|
|
141
|
+
.epilogue(color_1.colors.gray('For more information, see https://angular.io/cli/.\n'))
|
|
147
142
|
.demandCommand(1, command_1.demandCommandFailureMessage)
|
|
148
143
|
.recommendCommands()
|
|
149
144
|
.middleware(normalize_options_middleware_1.normalizeOptionsMiddleware)
|
|
@@ -162,17 +157,3 @@ async function runCommand(args, logger) {
|
|
|
162
157
|
return (_b = process.exitCode) !== null && _b !== void 0 ? _b : 0;
|
|
163
158
|
}
|
|
164
159
|
exports.runCommand = runCommand;
|
|
165
|
-
function getEpilogue(isInsideWorkspace) {
|
|
166
|
-
let message;
|
|
167
|
-
if (isInsideWorkspace) {
|
|
168
|
-
message =
|
|
169
|
-
'The above commands are available when running the Angular CLI inside a workspace.' +
|
|
170
|
-
'More commands are available when running outside a workspace.\n';
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
message =
|
|
174
|
-
'The above commands are available when running the Angular CLI outside a workspace.' +
|
|
175
|
-
'More commands are available when running inside a workspace.\n';
|
|
176
|
-
}
|
|
177
|
-
return message + 'For more information, see https://angular.io/cli/.\n';
|
|
178
|
-
}
|
|
@@ -21,7 +21,7 @@ export interface SchematicsExecutionOptions extends Options<SchematicsCommandArg
|
|
|
21
21
|
packageRegistry?: string;
|
|
22
22
|
}
|
|
23
23
|
export declare abstract class SchematicsCommandModule extends CommandModule<SchematicsCommandArgs> implements CommandModuleImplementation<SchematicsCommandArgs> {
|
|
24
|
-
|
|
24
|
+
scope: CommandScope;
|
|
25
25
|
protected readonly allowPrivateSchematics: boolean;
|
|
26
26
|
protected readonly shouldReportAnalytics = false;
|
|
27
27
|
builder(argv: Argv): Promise<Argv<SchematicsCommandArgs>>;
|
|
@@ -42,6 +42,7 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
|
42
42
|
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
43
43
|
const path_1 = require("path");
|
|
44
44
|
const config_1 = require("../utilities/config");
|
|
45
|
+
const error_1 = require("../utilities/error");
|
|
45
46
|
const memoize_1 = require("../utilities/memoize");
|
|
46
47
|
const tty_1 = require("../utilities/tty");
|
|
47
48
|
const command_module_1 = require("./command-module");
|
|
@@ -52,6 +53,7 @@ exports.DEFAULT_SCHEMATICS_COLLECTION = '@schematics/angular';
|
|
|
52
53
|
class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
53
54
|
constructor() {
|
|
54
55
|
super(...arguments);
|
|
56
|
+
this.scope = command_module_1.CommandScope.In;
|
|
55
57
|
this.allowPrivateSchematics = false;
|
|
56
58
|
this.shouldReportAnalytics = false;
|
|
57
59
|
this.defaultProjectDeprecationWarningShown = false;
|
|
@@ -306,6 +308,7 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
306
308
|
logger.fatal('The Schematic workflow failed. See above.');
|
|
307
309
|
}
|
|
308
310
|
else {
|
|
311
|
+
(0, error_1.assertIsError)(err);
|
|
309
312
|
logger.fatal(err.message);
|
|
310
313
|
}
|
|
311
314
|
return 1;
|
|
@@ -349,7 +352,6 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
349
352
|
[__dirname, process.cwd()];
|
|
350
353
|
}
|
|
351
354
|
}
|
|
352
|
-
SchematicsCommandModule.scope = command_module_1.CommandScope.In;
|
|
353
355
|
__decorate([
|
|
354
356
|
memoize_1.memoize
|
|
355
357
|
], SchematicsCommandModule.prototype, "getOrCreateWorkflowForBuilder", null);
|
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.addCommandModuleToYargs = exports.demandCommandFailureMessage = void 0;
|
|
11
|
+
const command_module_1 = require("../command-module");
|
|
11
12
|
exports.demandCommandFailureMessage = `You need to specify a command before moving on. Use '--help' to view the available commands.`;
|
|
12
13
|
function addCommandModuleToYargs(localYargs, commandModule, context) {
|
|
13
14
|
const cmd = new commandModule(context);
|
|
14
|
-
const
|
|
15
|
+
const { args: { options: { jsonHelp }, }, workspace, } = context;
|
|
16
|
+
const describe = jsonHelp ? cmd.fullDescribe : cmd.describe;
|
|
15
17
|
return localYargs.command({
|
|
16
18
|
command: cmd.command,
|
|
17
19
|
aliases: cmd.aliases,
|
|
@@ -20,7 +22,16 @@ function addCommandModuleToYargs(localYargs, commandModule, context) {
|
|
|
20
22
|
// Therefore, we get around this by adding a complex object as a string which we later parse when generating the help files.
|
|
21
23
|
typeof describe === 'object' ? JSON.stringify(describe) : describe,
|
|
22
24
|
deprecated: cmd.deprecated,
|
|
23
|
-
builder: (argv) =>
|
|
25
|
+
builder: (argv) => {
|
|
26
|
+
// Skip scope validation when running with '--json-help' since it's easier to generate the output for all commands this way.
|
|
27
|
+
const isInvalidScope = !jsonHelp &&
|
|
28
|
+
((cmd.scope === command_module_1.CommandScope.In && !workspace) ||
|
|
29
|
+
(cmd.scope === command_module_1.CommandScope.Out && workspace));
|
|
30
|
+
if (isInvalidScope) {
|
|
31
|
+
throw new command_module_1.CommandModuleError(`This command is not available when running the Angular CLI ${workspace ? 'inside' : 'outside'} a workspace.`);
|
|
32
|
+
}
|
|
33
|
+
return cmd.builder(argv);
|
|
34
|
+
},
|
|
24
35
|
handler: (args) => cmd.handler(args),
|
|
25
36
|
});
|
|
26
37
|
}
|
|
@@ -19,6 +19,7 @@ const jsonc_parser_1 = require("jsonc-parser");
|
|
|
19
19
|
const module_1 = __importDefault(require("module"));
|
|
20
20
|
const path_1 = require("path");
|
|
21
21
|
const vm_1 = require("vm");
|
|
22
|
+
const error_1 = require("../../utilities/error");
|
|
22
23
|
/**
|
|
23
24
|
* Environment variable to control schematic package redirection
|
|
24
25
|
*/
|
|
@@ -127,6 +128,7 @@ function wrap(schematicFile, schematicDirectory, moduleCache, exportName) {
|
|
|
127
128
|
return schematicRequire(id);
|
|
128
129
|
}
|
|
129
130
|
catch (e) {
|
|
131
|
+
(0, error_1.assertIsError)(e);
|
|
130
132
|
if (e.code !== 'MODULE_NOT_FOUND') {
|
|
131
133
|
throw e;
|
|
132
134
|
}
|
package/src/commands/add/cli.js
CHANGED
|
@@ -20,6 +20,7 @@ const workspace_schema_1 = require("../../../lib/config/workspace-schema");
|
|
|
20
20
|
const analytics_1 = require("../../analytics/analytics");
|
|
21
21
|
const schematics_command_module_1 = require("../../command-builder/schematics-command-module");
|
|
22
22
|
const color_1 = require("../../utilities/color");
|
|
23
|
+
const error_1 = require("../../utilities/error");
|
|
23
24
|
const package_metadata_1 = require("../../utilities/package-metadata");
|
|
24
25
|
const prompt_1 = require("../../utilities/prompt");
|
|
25
26
|
const spinner_1 = require("../../utilities/spinner");
|
|
@@ -90,6 +91,7 @@ class AddCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
90
91
|
packageIdentifier = (0, npm_package_arg_1.default)(collection);
|
|
91
92
|
}
|
|
92
93
|
catch (e) {
|
|
94
|
+
(0, error_1.assertIsError)(e);
|
|
93
95
|
logger.error(e.message);
|
|
94
96
|
return 1;
|
|
95
97
|
}
|
|
@@ -120,6 +122,7 @@ class AddCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
120
122
|
});
|
|
121
123
|
}
|
|
122
124
|
catch (e) {
|
|
125
|
+
(0, error_1.assertIsError)(e);
|
|
123
126
|
spinner.fail(`Unable to load package information from registry: ${e.message}`);
|
|
124
127
|
return 1;
|
|
125
128
|
}
|
|
@@ -190,6 +193,7 @@ class AddCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
190
193
|
}
|
|
191
194
|
}
|
|
192
195
|
catch (e) {
|
|
196
|
+
(0, error_1.assertIsError)(e);
|
|
193
197
|
spinner.fail(`Unable to fetch package information for '${packageIdentifier}': ${e.message}`);
|
|
194
198
|
return 1;
|
|
195
199
|
}
|
|
@@ -266,6 +270,7 @@ class AddCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
266
270
|
return true;
|
|
267
271
|
}
|
|
268
272
|
catch (e) {
|
|
273
|
+
(0, error_1.assertIsError)(e);
|
|
269
274
|
if (e.code !== 'MODULE_NOT_FOUND') {
|
|
270
275
|
throw e;
|
|
271
276
|
}
|
|
@@ -11,7 +11,7 @@ export declare class CacheCleanModule extends CommandModule implements CommandMo
|
|
|
11
11
|
command: string;
|
|
12
12
|
describe: string;
|
|
13
13
|
longDescriptionPath: string | undefined;
|
|
14
|
-
|
|
14
|
+
scope: CommandScope;
|
|
15
15
|
builder(localYargs: Argv): Argv;
|
|
16
16
|
run(): Promise<void>;
|
|
17
17
|
}
|
|
@@ -16,6 +16,7 @@ class CacheCleanModule extends command_module_1.CommandModule {
|
|
|
16
16
|
super(...arguments);
|
|
17
17
|
this.command = 'clean';
|
|
18
18
|
this.describe = 'Deletes persistent disk cache from disk.';
|
|
19
|
+
this.scope = command_module_1.CommandScope.In;
|
|
19
20
|
}
|
|
20
21
|
builder(localYargs) {
|
|
21
22
|
return localYargs.strict();
|
|
@@ -30,4 +31,3 @@ class CacheCleanModule extends command_module_1.CommandModule {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
exports.CacheCleanModule = CacheCleanModule;
|
|
33
|
-
CacheCleanModule.scope = command_module_1.CommandScope.In;
|
|
@@ -11,7 +11,7 @@ export declare class CacheCommandModule extends CommandModule implements Command
|
|
|
11
11
|
command: string;
|
|
12
12
|
describe: string;
|
|
13
13
|
longDescriptionPath: string;
|
|
14
|
-
|
|
14
|
+
scope: CommandScope;
|
|
15
15
|
builder(localYargs: Argv): Argv;
|
|
16
16
|
run(_options: Options<{}>): void;
|
|
17
17
|
}
|
|
@@ -20,6 +20,7 @@ class CacheCommandModule extends command_module_1.CommandModule {
|
|
|
20
20
|
this.command = 'cache';
|
|
21
21
|
this.describe = 'Configure persistent disk cache and retrieve cache statistics.';
|
|
22
22
|
this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
|
23
|
+
this.scope = command_module_1.CommandScope.In;
|
|
23
24
|
}
|
|
24
25
|
builder(localYargs) {
|
|
25
26
|
const subcommands = [
|
|
@@ -36,4 +37,3 @@ class CacheCommandModule extends command_module_1.CommandModule {
|
|
|
36
37
|
run(_options) { }
|
|
37
38
|
}
|
|
38
39
|
exports.CacheCommandModule = CacheCommandModule;
|
|
39
|
-
CacheCommandModule.scope = command_module_1.CommandScope.In;
|
|
@@ -11,7 +11,7 @@ export declare class CacheInfoCommandModule extends CommandModule implements Com
|
|
|
11
11
|
command: string;
|
|
12
12
|
describe: string;
|
|
13
13
|
longDescriptionPath?: string | undefined;
|
|
14
|
-
|
|
14
|
+
scope: CommandScope;
|
|
15
15
|
builder(localYargs: Argv): Argv;
|
|
16
16
|
run(): Promise<void>;
|
|
17
17
|
private getSizeOfDirectory;
|
|
@@ -19,6 +19,7 @@ class CacheInfoCommandModule extends command_module_1.CommandModule {
|
|
|
19
19
|
super(...arguments);
|
|
20
20
|
this.command = 'info';
|
|
21
21
|
this.describe = 'Prints persistent disk cache configuration and statistics in the console.';
|
|
22
|
+
this.scope = command_module_1.CommandScope.In;
|
|
22
23
|
}
|
|
23
24
|
builder(localYargs) {
|
|
24
25
|
return localYargs.strict();
|
|
@@ -80,4 +81,3 @@ class CacheInfoCommandModule extends command_module_1.CommandModule {
|
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
exports.CacheInfoCommandModule = CacheInfoCommandModule;
|
|
83
|
-
CacheInfoCommandModule.scope = command_module_1.CommandScope.In;
|
|
@@ -12,7 +12,7 @@ export declare class CacheDisableModule extends CommandModule implements Command
|
|
|
12
12
|
aliases: string;
|
|
13
13
|
describe: string;
|
|
14
14
|
longDescriptionPath: string | undefined;
|
|
15
|
-
|
|
15
|
+
scope: CommandScope;
|
|
16
16
|
builder(localYargs: Argv): Argv;
|
|
17
17
|
run(): Promise<void>;
|
|
18
18
|
}
|
|
@@ -21,7 +21,7 @@ export declare class CacheEnableModule extends CommandModule implements CommandM
|
|
|
21
21
|
aliases: string;
|
|
22
22
|
describe: string;
|
|
23
23
|
longDescriptionPath: string | undefined;
|
|
24
|
-
|
|
24
|
+
scope: CommandScope;
|
|
25
25
|
builder(localYargs: Argv): Argv;
|
|
26
26
|
run(): Promise<void>;
|
|
27
27
|
}
|
|
@@ -16,6 +16,7 @@ class CacheDisableModule extends command_module_1.CommandModule {
|
|
|
16
16
|
this.command = 'disable';
|
|
17
17
|
this.aliases = 'off';
|
|
18
18
|
this.describe = 'Disables persistent disk cache for all projects in the workspace.';
|
|
19
|
+
this.scope = command_module_1.CommandScope.In;
|
|
19
20
|
}
|
|
20
21
|
builder(localYargs) {
|
|
21
22
|
return localYargs;
|
|
@@ -25,13 +26,13 @@ class CacheDisableModule extends command_module_1.CommandModule {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
exports.CacheDisableModule = CacheDisableModule;
|
|
28
|
-
CacheDisableModule.scope = command_module_1.CommandScope.In;
|
|
29
29
|
class CacheEnableModule extends command_module_1.CommandModule {
|
|
30
30
|
constructor() {
|
|
31
31
|
super(...arguments);
|
|
32
32
|
this.command = 'enable';
|
|
33
33
|
this.aliases = 'on';
|
|
34
34
|
this.describe = 'Enables disk cache for all projects in the workspace.';
|
|
35
|
+
this.scope = command_module_1.CommandScope.In;
|
|
35
36
|
}
|
|
36
37
|
builder(localYargs) {
|
|
37
38
|
return localYargs;
|
|
@@ -41,4 +42,3 @@ class CacheEnableModule extends command_module_1.CommandModule {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
exports.CacheEnableModule = CacheEnableModule;
|
|
44
|
-
CacheEnableModule.scope = command_module_1.CommandScope.In;
|
|
@@ -17,6 +17,7 @@ const command_module_1 = require("../../command-builder/command-module");
|
|
|
17
17
|
const command_1 = require("../../command-builder/utilities/command");
|
|
18
18
|
const color_1 = require("../../utilities/color");
|
|
19
19
|
const completion_1 = require("../../utilities/completion");
|
|
20
|
+
const error_1 = require("../../utilities/error");
|
|
20
21
|
class CompletionCommandModule extends command_module_1.CommandModule {
|
|
21
22
|
constructor() {
|
|
22
23
|
super(...arguments);
|
|
@@ -33,6 +34,7 @@ class CompletionCommandModule extends command_module_1.CommandModule {
|
|
|
33
34
|
rcFile = await (0, completion_1.initializeAutocomplete)();
|
|
34
35
|
}
|
|
35
36
|
catch (err) {
|
|
37
|
+
(0, error_1.assertIsError)(err);
|
|
36
38
|
this.context.logger.error(err.message);
|
|
37
39
|
return 1;
|
|
38
40
|
}
|
|
@@ -13,7 +13,7 @@ interface NewCommandArgs extends SchematicsCommandArgs {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class NewCommandModule extends SchematicsCommandModule implements CommandModuleImplementation<NewCommandArgs> {
|
|
15
15
|
private readonly schematicName;
|
|
16
|
-
|
|
16
|
+
scope: CommandScope;
|
|
17
17
|
protected allowPrivateSchematics: boolean;
|
|
18
18
|
command: string;
|
|
19
19
|
aliases: string;
|
package/src/commands/new/cli.js
CHANGED
|
@@ -15,6 +15,7 @@ class NewCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
17
|
this.schematicName = 'ng-new';
|
|
18
|
+
this.scope = command_module_1.CommandScope.Out;
|
|
18
19
|
this.allowPrivateSchematics = true;
|
|
19
20
|
this.command = 'new [name]';
|
|
20
21
|
this.aliases = 'n';
|
|
@@ -79,4 +80,3 @@ class NewCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
exports.NewCommandModule = NewCommandModule;
|
|
82
|
-
NewCommandModule.scope = command_module_1.CommandScope.Out;
|
|
@@ -13,7 +13,7 @@ export interface RunCommandArgs {
|
|
|
13
13
|
target: string;
|
|
14
14
|
}
|
|
15
15
|
export declare class RunCommandModule extends ArchitectBaseCommandModule<RunCommandArgs> implements CommandModuleImplementation<RunCommandArgs> {
|
|
16
|
-
|
|
16
|
+
scope: CommandScope;
|
|
17
17
|
command: string;
|
|
18
18
|
describe: string;
|
|
19
19
|
longDescriptionPath: string;
|
package/src/commands/run/cli.js
CHANGED
|
@@ -14,6 +14,7 @@ const command_module_1 = require("../../command-builder/command-module");
|
|
|
14
14
|
class RunCommandModule extends architect_base_command_module_1.ArchitectBaseCommandModule {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
|
+
this.scope = command_module_1.CommandScope.In;
|
|
17
18
|
this.command = 'run <target>';
|
|
18
19
|
this.describe = 'Runs an Architect target with an optional custom builder configuration defined in your project.';
|
|
19
20
|
this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
|
@@ -80,4 +81,3 @@ class RunCommandModule extends architect_base_command_module_1.ArchitectBaseComm
|
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
exports.RunCommandModule = RunCommandModule;
|
|
83
|
-
RunCommandModule.scope = command_module_1.CommandScope.In;
|
|
@@ -20,7 +20,7 @@ interface UpdateCommandArgs {
|
|
|
20
20
|
'create-commits': boolean;
|
|
21
21
|
}
|
|
22
22
|
export declare class UpdateCommandModule extends CommandModule<UpdateCommandArgs> {
|
|
23
|
-
|
|
23
|
+
scope: CommandScope;
|
|
24
24
|
protected shouldReportAnalytics: boolean;
|
|
25
25
|
command: string;
|
|
26
26
|
describe: string;
|
|
@@ -49,6 +49,7 @@ const schematic_engine_host_1 = require("../../command-builder/utilities/schemat
|
|
|
49
49
|
const schematic_workflow_1 = require("../../command-builder/utilities/schematic-workflow");
|
|
50
50
|
const color_1 = require("../../utilities/color");
|
|
51
51
|
const environment_options_1 = require("../../utilities/environment-options");
|
|
52
|
+
const error_1 = require("../../utilities/error");
|
|
52
53
|
const log_file_1 = require("../../utilities/log-file");
|
|
53
54
|
const package_metadata_1 = require("../../utilities/package-metadata");
|
|
54
55
|
const package_tree_1 = require("../../utilities/package-tree");
|
|
@@ -58,6 +59,7 @@ const UPDATE_SCHEMATIC_COLLECTION = path.join(__dirname, 'schematic/collection.j
|
|
|
58
59
|
class UpdateCommandModule extends command_module_1.CommandModule {
|
|
59
60
|
constructor() {
|
|
60
61
|
super(...arguments);
|
|
62
|
+
this.scope = command_module_1.CommandScope.In;
|
|
61
63
|
this.shouldReportAnalytics = false;
|
|
62
64
|
this.command = 'update [packages..]';
|
|
63
65
|
this.describe = 'Updates your workspace and its dependencies. See https://update.angular.io/.';
|
|
@@ -178,6 +180,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
178
180
|
packages.push(packageIdentifier);
|
|
179
181
|
}
|
|
180
182
|
catch (e) {
|
|
183
|
+
(0, error_1.assertIsError)(e);
|
|
181
184
|
logger.error(e.message);
|
|
182
185
|
return 1;
|
|
183
186
|
}
|
|
@@ -230,6 +233,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
230
233
|
logger.error(`${color_1.colors.symbols.cross} Migration failed. See above for further details.\n`);
|
|
231
234
|
}
|
|
232
235
|
else {
|
|
236
|
+
(0, error_1.assertIsError)(e);
|
|
233
237
|
const logPath = (0, log_file_1.writeErrorToLogFile)(e);
|
|
234
238
|
logger.fatal(`${color_1.colors.symbols.cross} Migration failed: ${e.message}\n` +
|
|
235
239
|
` See "${logPath}" for further details.\n`);
|
|
@@ -366,6 +370,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
366
370
|
migrations = require.resolve(migrations, { paths: [packagePath] });
|
|
367
371
|
}
|
|
368
372
|
catch (e) {
|
|
373
|
+
(0, error_1.assertIsError)(e);
|
|
369
374
|
if (e.code === 'MODULE_NOT_FOUND') {
|
|
370
375
|
logger.error('Migrations for package were not found.');
|
|
371
376
|
}
|
|
@@ -425,6 +430,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
425
430
|
});
|
|
426
431
|
}
|
|
427
432
|
catch (e) {
|
|
433
|
+
(0, error_1.assertIsError)(e);
|
|
428
434
|
logger.error(`Error fetching metadata for '${packageName}': ` + e.message);
|
|
429
435
|
return 1;
|
|
430
436
|
}
|
|
@@ -438,6 +444,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
438
444
|
manifest = (0, npm_pick_manifest_1.default)(metadata, requestIdentifier.fetchSpec);
|
|
439
445
|
}
|
|
440
446
|
catch (e) {
|
|
447
|
+
(0, error_1.assertIsError)(e);
|
|
441
448
|
if (e.code === 'ETARGET') {
|
|
442
449
|
// If not found and next was used and user did not provide a specifier, try latest.
|
|
443
450
|
// Package may not have a next tag.
|
|
@@ -448,6 +455,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
448
455
|
manifest = (0, npm_pick_manifest_1.default)(metadata, 'latest');
|
|
449
456
|
}
|
|
450
457
|
catch (e) {
|
|
458
|
+
(0, error_1.assertIsError)(e);
|
|
451
459
|
if (e.code !== 'ETARGET' && e.code !== 'ENOVERSIONS') {
|
|
452
460
|
throw e;
|
|
453
461
|
}
|
|
@@ -554,6 +562,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
554
562
|
}));
|
|
555
563
|
}
|
|
556
564
|
catch (e) {
|
|
565
|
+
(0, error_1.assertIsError)(e);
|
|
557
566
|
if (e.code === 'MODULE_NOT_FOUND') {
|
|
558
567
|
// Fallback to trying to resolve the package's main entry point
|
|
559
568
|
packagePath = require.resolve(migration.package, { paths: [this.context.root] });
|
|
@@ -564,6 +573,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
564
573
|
}
|
|
565
574
|
}
|
|
566
575
|
catch (e) {
|
|
576
|
+
(0, error_1.assertIsError)(e);
|
|
567
577
|
if (e.code === 'MODULE_NOT_FOUND') {
|
|
568
578
|
logVerbose(e.toString());
|
|
569
579
|
logger.error(`Migrations for package (${migration.package}) were not found.` +
|
|
@@ -587,6 +597,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
587
597
|
migrations = require.resolve(migration.collection, { paths: [packagePath] });
|
|
588
598
|
}
|
|
589
599
|
catch (e) {
|
|
600
|
+
(0, error_1.assertIsError)(e);
|
|
590
601
|
if (e.code === 'MODULE_NOT_FOUND') {
|
|
591
602
|
logger.error(`Migrations for package (${migration.package}) were not found.`);
|
|
592
603
|
}
|
|
@@ -740,7 +751,6 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
740
751
|
}
|
|
741
752
|
}
|
|
742
753
|
exports.UpdateCommandModule = UpdateCommandModule;
|
|
743
|
-
UpdateCommandModule.scope = command_module_1.CommandScope.In;
|
|
744
754
|
/**
|
|
745
755
|
* @return Whether or not the working directory has Git changes to commit.
|
|
746
756
|
*/
|
|
@@ -35,6 +35,7 @@ const core_1 = require("@angular-devkit/core");
|
|
|
35
35
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
36
36
|
const npa = __importStar(require("npm-package-arg"));
|
|
37
37
|
const semver = __importStar(require("semver"));
|
|
38
|
+
const error_1 = require("../../../utilities/error");
|
|
38
39
|
const package_metadata_1 = require("../../../utilities/package-metadata");
|
|
39
40
|
// Angular guarantees that a major is compatible with its following major (so packages that depend
|
|
40
41
|
// on Angular 5 are also compatible with Angular 6). This is, in code, represented by verifying
|
|
@@ -199,6 +200,7 @@ function _performUpdate(tree, context, infoMap, logger, migrateOnly) {
|
|
|
199
200
|
packageJson = JSON.parse(packageJsonContent.toString());
|
|
200
201
|
}
|
|
201
202
|
catch (e) {
|
|
203
|
+
(0, error_1.assertIsError)(e);
|
|
202
204
|
throw new schematics_1.SchematicsException('package.json could not be parsed: ' + e.message);
|
|
203
205
|
}
|
|
204
206
|
const updateDependency = (deps, name, newVersion) => {
|
|
@@ -588,6 +590,7 @@ function _getAllDependencies(tree) {
|
|
|
588
590
|
packageJson = JSON.parse(packageJsonContent.toString());
|
|
589
591
|
}
|
|
590
592
|
catch (e) {
|
|
593
|
+
(0, error_1.assertIsError)(e);
|
|
591
594
|
throw new schematics_1.SchematicsException('package.json could not be parsed: ' + e.message);
|
|
592
595
|
}
|
|
593
596
|
return [
|
|
@@ -40,6 +40,7 @@ const color_1 = require("../utilities/color");
|
|
|
40
40
|
const config_1 = require("../utilities/config");
|
|
41
41
|
const environment_options_1 = require("../utilities/environment-options");
|
|
42
42
|
const tty_1 = require("../utilities/tty");
|
|
43
|
+
const error_1 = require("./error");
|
|
43
44
|
/**
|
|
44
45
|
* Checks if it is appropriate to prompt the user to setup autocompletion. If not, does nothing. If
|
|
45
46
|
* so prompts and sets up autocompletion for the user. Returns an exit code if the program should
|
|
@@ -71,6 +72,7 @@ Ok, you won't be prompted again. Should you change your mind, the following comm
|
|
|
71
72
|
rcFile = await initializeAutocomplete();
|
|
72
73
|
}
|
|
73
74
|
catch (err) {
|
|
75
|
+
(0, error_1.assertIsError)(err);
|
|
74
76
|
// Failed to set up autocompeletion, log the error and abort.
|
|
75
77
|
logger.error(err.message);
|
|
76
78
|
return 1;
|
|
@@ -213,6 +215,7 @@ async function initializeAutocomplete() {
|
|
|
213
215
|
await fs_1.promises.appendFile(rcFile, '\n\n# Load Angular CLI autocompletion.\nsource <(ng completion script)\n');
|
|
214
216
|
}
|
|
215
217
|
catch (err) {
|
|
218
|
+
(0, error_1.assertIsError)(err);
|
|
216
219
|
throw new Error(`Failed to append autocompletion setup to \`${rcFile}\`:\n${err.message}`);
|
|
217
220
|
}
|
|
218
221
|
return rcFile;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
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.io/license
|
|
7
|
+
*/
|
|
8
|
+
export declare function assertIsError(value: unknown): asserts value is Error & {
|
|
9
|
+
code?: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
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.io/license
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.assertIsError = void 0;
|
|
14
|
+
const assert_1 = __importDefault(require("assert"));
|
|
15
|
+
function assertIsError(value) {
|
|
16
|
+
(0, assert_1.default)(value instanceof Error, 'catch clause variable is not an Error instance');
|
|
17
|
+
}
|
|
18
|
+
exports.assertIsError = assertIsError;
|