@angular/cli 14.0.1 → 14.0.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.
@@ -74,7 +74,8 @@
74
74
  "description": "Show a warning when the global version is newer than the local one.",
75
75
  "type": "boolean"
76
76
  }
77
- }
77
+ },
78
+ "additionalProperties": false
78
79
  },
79
80
  "analytics": {
80
81
  "type": [
@@ -96,7 +97,8 @@
96
97
  "type": "string",
97
98
  "format": "uuid"
98
99
  }
99
- }
100
+ },
101
+ "additionalProperties": false
100
102
  },
101
103
  "cache": {
102
104
  "description": "Control disk cache.",
@@ -119,7 +121,82 @@
119
121
  "description": "Cache base path.",
120
122
  "type": "string"
121
123
  }
124
+ },
125
+ "additionalProperties": false
126
+ }
127
+ },
128
+ "additionalProperties": false
129
+ },
130
+ "cliGlobalOptions": {
131
+ "type": "object",
132
+ "properties": {
133
+ "defaultCollection": {
134
+ "description": "The default schematics collection to use.",
135
+ "type": "string",
136
+ "x-deprecated": "Use 'schematicCollections' instead."
137
+ },
138
+ "schematicCollections": {
139
+ "type": "array",
140
+ "description": "The list of schematic collections to use.",
141
+ "items": {
142
+ "type": "string",
143
+ "uniqueItems": true
122
144
  }
145
+ },
146
+ "packageManager": {
147
+ "description": "Specify which package manager tool to use.",
148
+ "type": "string",
149
+ "enum": [
150
+ "npm",
151
+ "cnpm",
152
+ "yarn",
153
+ "pnpm"
154
+ ]
155
+ },
156
+ "warnings": {
157
+ "description": "Control CLI specific console warnings",
158
+ "type": "object",
159
+ "properties": {
160
+ "versionMismatch": {
161
+ "description": "Show a warning when the global version is newer than the local one.",
162
+ "type": "boolean"
163
+ }
164
+ },
165
+ "additionalProperties": false
166
+ },
167
+ "analytics": {
168
+ "type": [
169
+ "boolean",
170
+ "string"
171
+ ],
172
+ "description": "Share anonymous usage data with the Angular Team at Google."
173
+ },
174
+ "analyticsSharing": {
175
+ "type": "object",
176
+ "properties": {
177
+ "tracking": {
178
+ "description": "Analytics sharing info tracking ID.",
179
+ "type": "string",
180
+ "pattern": "^(GA|UA)?-\\d+-\\d+$"
181
+ },
182
+ "uuid": {
183
+ "description": "Analytics sharing info universally unique identifier.",
184
+ "type": "string",
185
+ "format": "uuid"
186
+ }
187
+ },
188
+ "additionalProperties": false
189
+ },
190
+ "completion": {
191
+ "type": "object",
192
+ "description": "Angular CLI completion settings.",
193
+ "properties": {
194
+ "prompted": {
195
+ "type": "boolean",
196
+ "description": "Whether the user has been prompted to add completion command prompt."
197
+ }
198
+ },
199
+ "additionalProperties": false
123
200
  }
124
201
  },
125
202
  "additionalProperties": false
@@ -585,14 +662,13 @@
585
662
  "type": "object",
586
663
  "properties": {
587
664
  "$schema": {
588
- "type": "string",
589
- "format": "uri"
665
+ "type": "string"
590
666
  },
591
667
  "version": {
592
668
  "$ref": "#/definitions/fileVersion"
593
669
  },
594
670
  "cli": {
595
- "$ref": "#/definitions/cliOptions"
671
+ "$ref": "#/definitions/cliGlobalOptions"
596
672
  },
597
673
  "schematics": {
598
674
  "$ref": "#/definitions/schematicOptions"
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.0.1",
3
+ "version": "14.0.4",
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.1",
29
- "@angular-devkit/core": "14.0.1",
30
- "@angular-devkit/schematics": "14.0.1",
31
- "@schematics/angular": "14.0.1",
28
+ "@angular-devkit/architect": "0.1400.4",
29
+ "@angular-devkit/core": "14.0.4",
30
+ "@angular-devkit/schematics": "14.0.4",
31
+ "@schematics/angular": "14.0.4",
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.1",
53
- "@angular-devkit/architect": "0.1400.1",
54
- "@angular-devkit/build-angular": "14.0.1",
55
- "@angular-devkit/build-webpack": "0.1400.1",
56
- "@angular-devkit/core": "14.0.1",
57
- "@angular-devkit/schematics": "14.0.1"
52
+ "@angular/cli": "14.0.4",
53
+ "@angular-devkit/architect": "0.1400.4",
54
+ "@angular-devkit/build-angular": "14.0.4",
55
+ "@angular-devkit/build-webpack": "0.1400.4",
56
+ "@angular-devkit/core": "14.0.4",
57
+ "@angular-devkit/schematics": "14.0.4"
58
58
  }
59
59
  },
60
60
  "engines": {
@@ -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>;
@@ -22,6 +22,7 @@ const json_schema_1 = require("./utilities/json-schema");
22
22
  class ArchitectBaseCommandModule extends command_module_1.CommandModule {
23
23
  constructor() {
24
24
  super(...arguments);
25
+ this.scope = command_module_1.CommandScope.In;
25
26
  this.shouldReportAnalytics = false;
26
27
  }
27
28
  async runSingleTarget(target, options) {
@@ -162,4 +163,3 @@ class ArchitectBaseCommandModule extends command_module_1.CommandModule {
162
163
  }
163
164
  }
164
165
  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);
@@ -101,13 +101,6 @@ async function runCommand(args, logger) {
101
101
  };
102
102
  let localYargs = (0, yargs_1.default)(args);
103
103
  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
104
  localYargs = (0, command_1.addCommandModuleToYargs)(localYargs, CommandModule, context);
112
105
  }
113
106
  if (jsonHelp) {
@@ -143,7 +136,7 @@ async function runCommand(args, logger) {
143
136
  'deprecated: %s': color_1.colors.yellow('deprecated:') + ' %s',
144
137
  'Did you mean %s?': 'Unknown command. Did you mean %s?',
145
138
  })
146
- .epilogue(color_1.colors.gray(getEpilogue(!!workspace)))
139
+ .epilogue('For more information, see https://angular.io/cli/.\n')
147
140
  .demandCommand(1, command_1.demandCommandFailureMessage)
148
141
  .recommendCommands()
149
142
  .middleware(normalize_options_middleware_1.normalizeOptionsMiddleware)
@@ -162,17 +155,3 @@ async function runCommand(args, logger) {
162
155
  return (_b = process.exitCode) !== null && _b !== void 0 ? _b : 0;
163
156
  }
164
157
  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>>;
@@ -52,6 +52,7 @@ exports.DEFAULT_SCHEMATICS_COLLECTION = '@schematics/angular';
52
52
  class SchematicsCommandModule extends command_module_1.CommandModule {
53
53
  constructor() {
54
54
  super(...arguments);
55
+ this.scope = command_module_1.CommandScope.In;
55
56
  this.allowPrivateSchematics = false;
56
57
  this.shouldReportAnalytics = false;
57
58
  this.defaultProjectDeprecationWarningShown = false;
@@ -349,7 +350,6 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
349
350
  [__dirname, process.cwd()];
350
351
  }
351
352
  }
352
- SchematicsCommandModule.scope = command_module_1.CommandScope.In;
353
353
  __decorate([
354
354
  memoize_1.memoize
355
355
  ], 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
  }
@@ -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;
@@ -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;
@@ -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');
@@ -29,6 +30,16 @@ class RunCommandModule extends architect_base_command_module_1.ArchitectBaseComm
29
30
  // Also, hide choices from JSON help so that we don't display them in AIO.
30
31
  choices: (getYargsCompletions || help) && !jsonHelp ? this.getTargetChoices() : undefined,
31
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)
32
43
  .strict();
33
44
  const target = this.makeTargetSpecifier();
34
45
  if (!target) {
@@ -80,4 +91,3 @@ class RunCommandModule extends architect_base_command_module_1.ArchitectBaseComm
80
91
  }
81
92
  }
82
93
  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
- static scope: CommandScope;
23
+ scope: CommandScope;
24
24
  protected shouldReportAnalytics: boolean;
25
25
  command: string;
26
26
  describe: string;
@@ -58,6 +58,7 @@ const UPDATE_SCHEMATIC_COLLECTION = path.join(__dirname, 'schematic/collection.j
58
58
  class UpdateCommandModule extends command_module_1.CommandModule {
59
59
  constructor() {
60
60
  super(...arguments);
61
+ this.scope = command_module_1.CommandScope.In;
61
62
  this.shouldReportAnalytics = false;
62
63
  this.command = 'update [packages..]';
63
64
  this.describe = 'Updates your workspace and its dependencies. See https://update.angular.io/.';
@@ -740,7 +741,6 @@ class UpdateCommandModule extends command_module_1.CommandModule {
740
741
  }
741
742
  }
742
743
  exports.UpdateCommandModule = UpdateCommandModule;
743
- UpdateCommandModule.scope = command_module_1.CommandScope.In;
744
744
  /**
745
745
  * @return Whether or not the working directory has Git changes to commit.
746
746
  */
@@ -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<{}>;
@@ -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(schema).toPromise();
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);