@angular/cli 14.1.0-next.0 → 14.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.
Files changed (38) hide show
  1. package/lib/cli/index.js +2 -2
  2. package/lib/config/schema.json +667 -5
  3. package/lib/init.js +4 -2
  4. package/package.json +14 -14
  5. package/src/analytics/analytics.js +3 -0
  6. package/src/command-builder/architect-base-command-module.d.ts +1 -1
  7. package/src/command-builder/architect-base-command-module.js +4 -1
  8. package/src/command-builder/command-module.d.ts +3 -1
  9. package/src/command-builder/command-module.js +26 -3
  10. package/src/command-builder/command-runner.js +3 -22
  11. package/src/command-builder/schematics-command-module.d.ts +1 -1
  12. package/src/command-builder/schematics-command-module.js +3 -1
  13. package/src/command-builder/utilities/command.js +13 -2
  14. package/src/command-builder/utilities/schematic-engine-host.js +2 -0
  15. package/src/commands/add/cli.js +5 -0
  16. package/src/commands/cache/clean/cli.d.ts +1 -1
  17. package/src/commands/cache/clean/cli.js +1 -1
  18. package/src/commands/cache/cli.d.ts +1 -1
  19. package/src/commands/cache/cli.js +1 -1
  20. package/src/commands/cache/info/cli.d.ts +1 -1
  21. package/src/commands/cache/info/cli.js +1 -1
  22. package/src/commands/cache/settings/cli.d.ts +2 -2
  23. package/src/commands/cache/settings/cli.js +2 -2
  24. package/src/commands/completion/cli.js +2 -0
  25. package/src/commands/config/cli.js +2 -17
  26. package/src/commands/new/cli.d.ts +1 -1
  27. package/src/commands/new/cli.js +2 -2
  28. package/src/commands/run/cli.d.ts +1 -1
  29. package/src/commands/run/cli.js +11 -1
  30. package/src/commands/update/cli.d.ts +1 -1
  31. package/src/commands/update/cli.js +11 -1
  32. package/src/commands/update/schematic/index.js +3 -0
  33. package/src/utilities/color.js +0 -1
  34. package/src/utilities/completion.js +3 -0
  35. package/src/utilities/config.d.ts +1 -1
  36. package/src/utilities/config.js +9 -2
  37. package/src/utilities/error.d.ts +10 -0
  38. package/src/utilities/error.js +18 -0
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
- if (isGlobalGreater) {
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 (process.argv[2] === 'update' &&
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.0",
3
+ "version": "14.1.0-next.3",
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.0",
29
- "@angular-devkit/core": "14.1.0-next.0",
30
- "@angular-devkit/schematics": "14.1.0-next.0",
31
- "@schematics/angular": "14.1.0-next.0",
28
+ "@angular-devkit/architect": "0.1401.0-next.3",
29
+ "@angular-devkit/core": "14.1.0-next.3",
30
+ "@angular-devkit/schematics": "14.1.0-next.3",
31
+ "@schematics/angular": "14.1.0-next.3",
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.2",
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.0",
43
- "resolve": "1.22.0",
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.0",
53
- "@angular-devkit/architect": "0.1401.0-next.0",
54
- "@angular-devkit/build-angular": "14.1.0-next.0",
55
- "@angular-devkit/build-webpack": "0.1401.0-next.0",
56
- "@angular-devkit/core": "14.1.0-next.0",
57
- "@angular-devkit/schematics": "14.1.0-next.0"
52
+ "@angular/cli": "14.1.0-next.3",
53
+ "@angular-devkit/architect": "0.1401.0-next.3",
54
+ "@angular-devkit/build-angular": "14.1.0-next.3",
55
+ "@angular-devkit/build-webpack": "0.1401.0-next.3",
56
+ "@angular-devkit/core": "14.1.0-next.3",
57
+ "@angular-devkit/schematics": "14.1.0-next.3"
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
- static scope: CommandScope;
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
- static scope: CommandScope;
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
  /**
@@ -148,6 +149,7 @@ class CommandModule {
148
149
  * **Note:** This method should be called from the command bundler method.
149
150
  */
150
151
  addSchemaOptionsToCommand(localYargs, options) {
152
+ const booleanOptionsWithNoPrefix = new Set();
151
153
  for (const option of options) {
152
154
  const { default: defaultVal, positional, deprecated, description, alias, userAnalytics, type, hidden, name, choices, } = option;
153
155
  const sharedOptions = {
@@ -159,14 +161,24 @@ class CommandModule {
159
161
  // This should only be done when `--help` is used otherwise default will override options set in angular.json.
160
162
  ...(this.context.args.options.help ? { default: defaultVal } : {}),
161
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
+ }
162
174
  if (positional === undefined) {
163
- localYargs = localYargs.option(core_1.strings.dasherize(name), {
175
+ localYargs = localYargs.option(dashedName, {
164
176
  type,
165
177
  ...sharedOptions,
166
178
  });
167
179
  }
168
180
  else {
169
- localYargs = localYargs.positional(core_1.strings.dasherize(name), {
181
+ localYargs = localYargs.positional(dashedName, {
170
182
  type: type === 'array' || type === 'count' ? 'string' : type,
171
183
  ...sharedOptions,
172
184
  });
@@ -176,6 +188,18 @@ class CommandModule {
176
188
  this.optionsWithAnalytics.set(name, userAnalytics);
177
189
  }
178
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
+ }
179
203
  return localYargs;
180
204
  }
181
205
  getWorkspaceOrThrow() {
@@ -186,7 +210,6 @@ class CommandModule {
186
210
  return workspace;
187
211
  }
188
212
  }
189
- CommandModule.scope = CommandScope.Both;
190
213
  __decorate([
191
214
  memoize_1.memoize
192
215
  ], 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(getEpilogue(!!workspace)))
141
+ .epilogue('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
- static scope: CommandScope;
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 describe = context.args.options.jsonHelp ? cmd.fullDescribe : cmd.describe;
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) => cmd.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
  }
@@ -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
- static scope: CommandScope;
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
- static scope: CommandScope;
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
- static scope: CommandScope;
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
- static scope: CommandScope;
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
- static scope: CommandScope;
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
  }
@@ -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
  }
@@ -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
- static scope: CommandScope;
16
+ scope: CommandScope;
17
17
  protected allowPrivateSchematics: boolean;
18
18
  command: string;
19
19
  aliases: string;
@@ -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';
@@ -26,7 +27,7 @@ class NewCommandModule extends schematics_command_module_1.SchematicsCommandModu
26
27
  describe: 'A collection of schematics to use in generating the initial application.',
27
28
  type: 'string',
28
29
  });
29
- const { options: { collectionNameFromArgs }, } = this.context.args;
30
+ const { options: { collection: collectionNameFromArgs }, } = this.context.args;
30
31
  const collectionName = typeof collectionNameFromArgs === 'string'
31
32
  ? collectionNameFromArgs
32
33
  : await this.getCollectionFromConfig();
@@ -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
- static scope: CommandScope;
16
+ scope: CommandScope;
17
17
  command: string;
18
18
  describe: string;
19
19
  longDescriptionPath: string;