@angular/cli 14.0.0-next.4 → 14.0.0-next.5

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 (210) hide show
  1. package/bin/ng.js +3 -5
  2. package/bin/postinstall/analytics-prompt.js +1 -1
  3. package/lib/cli/index.d.ts +1 -1
  4. package/lib/cli/index.js +16 -18
  5. package/lib/config/schema.json +4 -8
  6. package/lib/init.js +3 -3
  7. package/models/command.d.ts +14 -19
  8. package/models/command.js +13 -106
  9. package/models/interface.d.ts +3 -180
  10. package/models/interface.js +0 -22
  11. package/models/schematic-command.d.ts +6 -18
  12. package/models/schematic-command.js +16 -123
  13. package/package.json +15 -14
  14. package/{models → src/analytics}/analytics-collector.d.ts +0 -0
  15. package/{models → src/analytics}/analytics-collector.js +1 -1
  16. package/{models → src/analytics}/analytics.d.ts +2 -0
  17. package/{models → src/analytics}/analytics.js +33 -2
  18. package/src/command-builder/architect-base-command-module.d.ts +23 -0
  19. package/src/command-builder/architect-base-command-module.js +105 -0
  20. package/src/command-builder/architect-command-module.d.ts +22 -0
  21. package/src/command-builder/architect-command-module.js +110 -0
  22. package/src/command-builder/command-module.d.ts +85 -0
  23. package/src/command-builder/command-module.js +185 -0
  24. package/src/command-builder/command-runner.d.ts +10 -0
  25. package/src/command-builder/command-runner.js +146 -0
  26. package/src/command-builder/schematics-command-module.d.ts +31 -0
  27. package/src/command-builder/schematics-command-module.js +117 -0
  28. package/src/command-builder/utilities/json-help.d.ts +34 -0
  29. package/src/command-builder/utilities/json-help.js +90 -0
  30. package/src/command-builder/utilities/json-schema.d.ts +40 -0
  31. package/{utilities → src/command-builder/utilities}/json-schema.js +20 -121
  32. package/src/commands/add/add-impl.d.ts +22 -0
  33. package/{commands → src/commands/add}/add-impl.js +24 -32
  34. package/src/commands/add/cli.d.ts +23 -0
  35. package/src/commands/add/cli.js +48 -0
  36. package/{commands/add.md → src/commands/add/long-description.md} +0 -0
  37. package/src/commands/analytics/cli.d.ts +21 -0
  38. package/src/commands/analytics/cli.js +70 -0
  39. package/src/commands/analytics/long-description.md +10 -0
  40. package/src/commands/build/cli.d.ts +16 -0
  41. package/src/commands/build/cli.js +23 -0
  42. package/{commands/build-long.md → src/commands/build/long-description.md} +0 -0
  43. package/src/commands/config/cli.d.ts +21 -0
  44. package/src/commands/config/cli.js +46 -0
  45. package/{commands → src/commands/config}/config-impl.d.ts +7 -5
  46. package/{commands → src/commands/config}/config-impl.js +3 -7
  47. package/{commands/config-long.md → src/commands/config/long-description.md} +2 -2
  48. package/src/commands/deploy/cli.d.ts +16 -0
  49. package/src/commands/deploy/cli.js +35 -0
  50. package/{commands/deploy-long.md → src/commands/deploy/long-description.md} +0 -0
  51. package/src/commands/doc/cli.d.ts +23 -0
  52. package/{commands/doc-impl.js → src/commands/doc/cli.js} +36 -11
  53. package/src/commands/e2e/cli.d.ts +17 -0
  54. package/src/commands/e2e/cli.js +34 -0
  55. package/src/commands/extract-i18n/cli.d.ts +15 -0
  56. package/src/commands/extract-i18n/cli.js +20 -0
  57. package/src/commands/generate/cli.d.ts +27 -0
  58. package/src/commands/generate/cli.js +98 -0
  59. package/src/commands/generate/generate-impl.d.ts +19 -0
  60. package/src/commands/generate/generate-impl.js +49 -0
  61. package/src/commands/lint/cli.d.ts +16 -0
  62. package/src/commands/lint/cli.js +31 -0
  63. package/{commands/lint-long.md → src/commands/lint/long-description.md} +0 -0
  64. package/src/commands/make-this-awesome/cli.d.ts +17 -0
  65. package/{commands/easter-egg-impl.js → src/commands/make-this-awesome/cli.js} +17 -10
  66. package/src/commands/new/cli.d.ts +23 -0
  67. package/src/commands/new/cli.js +36 -0
  68. package/src/commands/new/new-impl.d.ts +18 -0
  69. package/{commands → src/commands/new}/new-impl.js +7 -6
  70. package/src/commands/run/cli.d.ts +23 -0
  71. package/src/commands/run/cli.js +59 -0
  72. package/{commands/run-long.md → src/commands/run/long-description.md} +0 -0
  73. package/src/commands/serve/cli.d.ts +16 -0
  74. package/src/commands/serve/cli.js +21 -0
  75. package/src/commands/test/cli.d.ts +16 -0
  76. package/src/commands/test/cli.js +23 -0
  77. package/{commands/test-long.md → src/commands/test/long-description.md} +0 -0
  78. package/src/commands/update/cli.d.ts +29 -0
  79. package/src/commands/update/cli.js +83 -0
  80. package/{commands/update-long.md → src/commands/update/long-description.md} +0 -0
  81. package/src/commands/update/schematic/index.js +1 -1
  82. package/{commands → src/commands/update}/update-impl.d.ts +8 -6
  83. package/{commands → src/commands/update}/update-impl.js +22 -31
  84. package/src/commands/version/cli.d.ts +19 -0
  85. package/{commands/version-impl.js → src/commands/version/cli.js} +44 -38
  86. package/src/typings.d.ts +2 -2
  87. package/{utilities → src/utilities}/color.d.ts +0 -0
  88. package/{utilities → src/utilities}/color.js +0 -0
  89. package/{utilities → src/utilities}/config.d.ts +1 -1
  90. package/{utilities → src/utilities}/config.js +2 -5
  91. package/{utilities → src/utilities}/find-up.d.ts +0 -0
  92. package/{utilities → src/utilities}/find-up.js +0 -0
  93. package/{utilities → src/utilities}/install-package.d.ts +2 -2
  94. package/{utilities → src/utilities}/install-package.js +1 -1
  95. package/{utilities → src/utilities}/json-file.d.ts +0 -0
  96. package/{utilities → src/utilities}/json-file.js +0 -0
  97. package/{utilities → src/utilities}/log-file.d.ts +0 -0
  98. package/{utilities → src/utilities}/log-file.js +0 -0
  99. package/{utilities → src/utilities}/package-json.d.ts +0 -0
  100. package/{utilities → src/utilities}/package-json.js +0 -0
  101. package/{utilities → src/utilities}/package-manager.d.ts +1 -1
  102. package/{utilities → src/utilities}/package-manager.js +1 -1
  103. package/{utilities → src/utilities}/package-metadata.d.ts +0 -0
  104. package/{utilities → src/utilities}/package-metadata.js +0 -0
  105. package/{utilities → src/utilities}/package-tree.d.ts +0 -0
  106. package/{utilities → src/utilities}/package-tree.js +0 -0
  107. package/{utilities → src/utilities}/project.d.ts +0 -0
  108. package/{utilities → src/utilities}/project.js +0 -0
  109. package/{utilities → src/utilities}/prompt.d.ts +0 -0
  110. package/{utilities → src/utilities}/prompt.js +0 -0
  111. package/{utilities → src/utilities}/spinner.d.ts +0 -0
  112. package/{utilities → src/utilities}/spinner.js +0 -0
  113. package/{utilities → src/utilities}/tty.d.ts +0 -0
  114. package/{utilities → src/utilities}/tty.js +0 -0
  115. package/{models → src/utilities}/version.d.ts +2 -1
  116. package/{models → src/utilities}/version.js +6 -6
  117. package/commands/add-impl.d.ts +0 -21
  118. package/commands/add.d.ts +0 -42
  119. package/commands/add.js +0 -10
  120. package/commands/add.json +0 -54
  121. package/commands/analytics-impl.d.ts +0 -13
  122. package/commands/analytics-impl.js +0 -80
  123. package/commands/analytics-long.md +0 -8
  124. package/commands/analytics.d.ts +0 -46
  125. package/commands/analytics.js +0 -31
  126. package/commands/analytics.json +0 -37
  127. package/commands/build-impl.d.ts +0 -14
  128. package/commands/build-impl.js +0 -21
  129. package/commands/build.d.ts +0 -30
  130. package/commands/build.js +0 -10
  131. package/commands/build.json +0 -16
  132. package/commands/config.d.ts +0 -34
  133. package/commands/config.js +0 -10
  134. package/commands/config.json +0 -43
  135. package/commands/definitions.json +0 -66
  136. package/commands/deploy-impl.d.ts +0 -15
  137. package/commands/deploy-impl.js +0 -36
  138. package/commands/deploy.d.ts +0 -30
  139. package/commands/deploy.js +0 -10
  140. package/commands/deploy.json +0 -34
  141. package/commands/doc-impl.d.ts +0 -13
  142. package/commands/doc.d.ts +0 -39
  143. package/commands/doc.js +0 -14
  144. package/commands/doc.json +0 -46
  145. package/commands/e2e-impl.d.ts +0 -16
  146. package/commands/e2e-impl.js +0 -36
  147. package/commands/e2e-long.md +0 -4
  148. package/commands/e2e.d.ts +0 -29
  149. package/commands/e2e.js +0 -10
  150. package/commands/e2e.json +0 -17
  151. package/commands/easter-egg-impl.d.ts +0 -12
  152. package/commands/easter-egg.d.ts +0 -14
  153. package/commands/easter-egg.js +0 -10
  154. package/commands/easter-egg.json +0 -12
  155. package/commands/extract-i18n-impl.d.ts +0 -14
  156. package/commands/extract-i18n-impl.js +0 -21
  157. package/commands/extract-i18n.d.ts +0 -29
  158. package/commands/extract-i18n.js +0 -10
  159. package/commands/extract-i18n.json +0 -15
  160. package/commands/generate-impl.d.ts +0 -18
  161. package/commands/generate-impl.js +0 -89
  162. package/commands/generate.d.ts +0 -37
  163. package/commands/generate.js +0 -10
  164. package/commands/generate.json +0 -31
  165. package/commands/help-impl.d.ts +0 -12
  166. package/commands/help-impl.js +0 -26
  167. package/commands/help-long.md +0 -7
  168. package/commands/help.d.ts +0 -17
  169. package/commands/help.js +0 -10
  170. package/commands/help.json +0 -13
  171. package/commands/lint-impl.d.ts +0 -16
  172. package/commands/lint-impl.js +0 -69
  173. package/commands/lint.d.ts +0 -29
  174. package/commands/lint.js +0 -10
  175. package/commands/lint.json +0 -36
  176. package/commands/new-impl.d.ts +0 -16
  177. package/commands/new.d.ts +0 -41
  178. package/commands/new.js +0 -10
  179. package/commands/new.json +0 -34
  180. package/commands/new.md +0 -16
  181. package/commands/run-impl.d.ts +0 -13
  182. package/commands/run-impl.js +0 -22
  183. package/commands/run.d.ts +0 -30
  184. package/commands/run.js +0 -10
  185. package/commands/run.json +0 -36
  186. package/commands/serve-impl.d.ts +0 -15
  187. package/commands/serve-impl.js +0 -24
  188. package/commands/serve.d.ts +0 -29
  189. package/commands/serve.js +0 -10
  190. package/commands/serve.json +0 -17
  191. package/commands/test-impl.d.ts +0 -15
  192. package/commands/test-impl.js +0 -22
  193. package/commands/test.d.ts +0 -29
  194. package/commands/test.js +0 -10
  195. package/commands/test.json +0 -17
  196. package/commands/update.d.ts +0 -61
  197. package/commands/update.js +0 -10
  198. package/commands/update.json +0 -78
  199. package/commands/version-impl.d.ts +0 -17
  200. package/commands/version.d.ts +0 -17
  201. package/commands/version.js +0 -10
  202. package/commands/version.json +0 -13
  203. package/commands.json +0 -20
  204. package/models/architect-command.d.ts +0 -35
  205. package/models/architect-command.js +0 -364
  206. package/models/command-runner.d.ts +0 -24
  207. package/models/command-runner.js +0 -241
  208. package/models/parser.d.ts +0 -39
  209. package/models/parser.js +0 -349
  210. package/utilities/json-schema.d.ts +0 -17
@@ -0,0 +1,21 @@
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
+ import { Argv } from 'yargs';
9
+ import { CommandModule, CommandModuleImplementation, Options } from '../../command-builder/command-module';
10
+ export interface ConfigCommandArgs {
11
+ 'json-path': string;
12
+ value?: string;
13
+ global?: boolean;
14
+ }
15
+ export declare class ConfigCommandModule extends CommandModule<ConfigCommandArgs> implements CommandModuleImplementation<ConfigCommandArgs> {
16
+ command: string;
17
+ describe: string;
18
+ longDescriptionPath: string;
19
+ builder(localYargs: Argv): Argv<ConfigCommandArgs>;
20
+ run(options: Options<ConfigCommandArgs>): Promise<number | void>;
21
+ }
@@ -0,0 +1,46 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ConfigCommandModule = void 0;
11
+ const path_1 = require("path");
12
+ const command_module_1 = require("../../command-builder/command-module");
13
+ const config_impl_1 = require("./config-impl");
14
+ class ConfigCommandModule extends command_module_1.CommandModule {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.command = 'config <json-path> [value]';
18
+ this.describe = 'Retrieves or sets Angular configuration values in the angular.json file for the workspace.';
19
+ this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
20
+ }
21
+ builder(localYargs) {
22
+ return localYargs
23
+ .positional('json-path', {
24
+ description: `The configuration key to set or query, in JSON path format. ` +
25
+ `For example: "a[3].foo.bar[2]". If no new value is provided, returns the current value of this key.`,
26
+ type: 'string',
27
+ demandOption: true,
28
+ })
29
+ .positional('value', {
30
+ description: 'If provided, a new value for the given configuration key.',
31
+ type: 'string',
32
+ })
33
+ .option('global', {
34
+ description: `Access the global configuration in the caller's home directory.`,
35
+ alias: ['g'],
36
+ type: 'boolean',
37
+ default: false,
38
+ })
39
+ .strict();
40
+ }
41
+ run(options) {
42
+ const command = new config_impl_1.ConfigCommand(this.context, 'config');
43
+ return command.validateAndRun(options);
44
+ }
45
+ }
46
+ exports.ConfigCommandModule = ConfigCommandModule;
@@ -5,11 +5,13 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { Command } from '../models/command';
9
- import { Arguments } from '../models/interface';
10
- import { Schema as ConfigCommandSchema } from './config';
11
- export declare class ConfigCommand extends Command<ConfigCommandSchema> {
12
- run(options: ConfigCommandSchema & Arguments): Promise<0 | 1>;
8
+ import { Command } from '../../../models/command';
9
+ import { Options } from '../../command-builder/command-module';
10
+ import { ConfigCommandArgs } from './cli';
11
+ declare type ConfigCommandOptions = Options<ConfigCommandArgs>;
12
+ export declare class ConfigCommand extends Command<ConfigCommandOptions> {
13
+ run(options: ConfigCommandOptions): Promise<0 | 1>;
13
14
  private get;
14
15
  private set;
15
16
  }
17
+ export {};
@@ -9,10 +9,9 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.ConfigCommand = void 0;
11
11
  const uuid_1 = require("uuid");
12
- const command_1 = require("../models/command");
13
- const interface_1 = require("../models/interface");
14
- const config_1 = require("../utilities/config");
15
- const json_file_1 = require("../utilities/json-file");
12
+ const command_1 = require("../../../models/command");
13
+ const config_1 = require("../../utilities/config");
14
+ const json_file_1 = require("../../utilities/json-file");
16
15
  const validCliPaths = new Map([
17
16
  ['cli.warnings.versionMismatch', undefined],
18
17
  ['cli.defaultCollection', undefined],
@@ -84,9 +83,6 @@ function normalizeValue(value) {
84
83
  class ConfigCommand extends command_1.Command {
85
84
  async run(options) {
86
85
  const level = options.global ? 'global' : 'local';
87
- if (!options.global) {
88
- await this.validateScope(interface_1.CommandScope.InProject);
89
- }
90
86
  const [config] = (0, config_1.getWorkspaceRaw)(level);
91
87
  if (options.value == undefined) {
92
88
  if (!config) {
@@ -6,8 +6,8 @@ or indirectly on the command line using this command.
6
6
 
7
7
  The configurable property names match command option names,
8
8
  except that in the configuration file, all names must use camelCase,
9
- while on the command line options can be given in either camelCase or dash-case.
9
+ while on the command line options can be given dash-case.
10
10
 
11
11
  For further details, see [Workspace Configuration](guide/workspace-config).
12
12
 
13
- For configuration of CLI usage analytics, see [Gathering an Viewing CLI Usage Analytics](./usage-analytics-gathering).
13
+ For configuration of CLI usage analytics, see [Gathering an Viewing CLI Usage Analytics](cli/usage-analytics-gathering).
@@ -0,0 +1,16 @@
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
+ import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
9
+ import { CommandModuleImplementation } from '../../command-builder/command-module';
10
+ export declare class DeployCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
11
+ missingErrorTarget: string;
12
+ multiTarget: boolean;
13
+ command: string;
14
+ longDescriptionPath: string;
15
+ describe: string;
16
+ }
@@ -0,0 +1,35 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.DeployCommandModule = void 0;
11
+ const core_1 = require("@angular-devkit/core");
12
+ const path_1 = require("path");
13
+ const architect_command_module_1 = require("../../command-builder/architect-command-module");
14
+ class DeployCommandModule extends architect_command_module_1.ArchitectCommandModule {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.missingErrorTarget = core_1.tags.stripIndents `
18
+ Cannot find "deploy" target for the specified project.
19
+
20
+ You should add a package that implements deployment capabilities for your
21
+ favorite platform.
22
+
23
+ For example:
24
+ ng add @angular/fire
25
+ ng add @azure/ng-deploy
26
+
27
+ Find more packages on npm https://www.npmjs.com/search?q=ng%20deploy
28
+ `;
29
+ this.multiTarget = false;
30
+ this.command = 'deploy [project]';
31
+ this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
32
+ this.describe = 'Invokes the deploy builder for a specified project or for the default project in the workspace.';
33
+ }
34
+ }
35
+ exports.DeployCommandModule = DeployCommandModule;
@@ -0,0 +1,23 @@
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
+ import { Argv } from 'yargs';
9
+ import { CommandModule, CommandModuleImplementation, Options } from '../../command-builder/command-module';
10
+ interface DocCommandArgs {
11
+ keyword: string;
12
+ search?: boolean;
13
+ version?: string;
14
+ }
15
+ export declare class DocCommandModule extends CommandModule<DocCommandArgs> implements CommandModuleImplementation<DocCommandArgs> {
16
+ command: string;
17
+ aliases: string[];
18
+ describe: string;
19
+ longDescriptionPath?: string | undefined;
20
+ builder(localYargs: Argv): Argv<DocCommandArgs>;
21
+ run(options: Options<DocCommandArgs>): Promise<number | void>;
22
+ }
23
+ export {};
@@ -29,28 +29,53 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.DocCommand = void 0;
32
+ exports.DocCommandModule = void 0;
33
33
  const open_1 = __importDefault(require("open"));
34
- const command_1 = require("../models/command");
35
- class DocCommand extends command_1.Command {
34
+ const command_module_1 = require("../../command-builder/command-module");
35
+ class DocCommandModule extends command_module_1.CommandModule {
36
+ constructor() {
37
+ super(...arguments);
38
+ this.command = 'doc <keyword>';
39
+ this.aliases = ['d'];
40
+ this.describe = 'Opens the official Angular documentation (angular.io) in a browser, and searches for a given keyword.';
41
+ }
42
+ builder(localYargs) {
43
+ return localYargs
44
+ .positional('keyword', {
45
+ description: 'The keyword to search for, as provided in the search bar in angular.io.',
46
+ type: 'string',
47
+ demandOption: true,
48
+ })
49
+ .option('search', {
50
+ description: `Search all of angular.io. Otherwise, searches only API reference documentation.`,
51
+ alias: ['s'],
52
+ type: 'boolean',
53
+ default: false,
54
+ })
55
+ .option('version', {
56
+ description: 'Contains the version of Angular to use for the documentation. ' +
57
+ 'If not provided, the command uses your current Angular core version.',
58
+ type: 'string',
59
+ })
60
+ .strict();
61
+ }
36
62
  async run(options) {
37
- if (!options.keyword) {
38
- this.logger.error('You should specify a keyword, for instance, `ng doc ActivatedRoute`.');
39
- return 0;
40
- }
41
63
  let domain = 'angular.io';
42
64
  if (options.version) {
43
65
  // version can either be a string containing "next"
44
- if (options.version == 'next') {
66
+ if (options.version === 'next') {
45
67
  domain = 'next.angular.io';
68
+ }
69
+ else if (options.version === 'rc') {
70
+ domain = 'rc.angular.io';
46
71
  // or a number where version must be a valid Angular version (i.e. not 0, 1 or 3)
47
72
  }
48
73
  else if (!isNaN(+options.version) && ![0, 1, 3].includes(+options.version)) {
49
74
  domain = `v${options.version}.angular.io`;
50
75
  }
51
76
  else {
52
- this.logger.error('Version should either be a number (2, 4, 5, 6...) or "next"');
53
- return 0;
77
+ this.context.logger.error('Version should either be a number (2, 4, 5, 6...), "rc" or "next"');
78
+ return 1;
54
79
  }
55
80
  }
56
81
  else {
@@ -68,4 +93,4 @@ class DocCommand extends command_1.Command {
68
93
  : `https://${domain}/docs?search=${options.keyword}`);
69
94
  }
70
95
  }
71
- exports.DocCommand = DocCommand;
96
+ exports.DocCommandModule = DocCommandModule;
@@ -0,0 +1,17 @@
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
+ import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
9
+ import { CommandModuleImplementation } from '../../command-builder/command-module';
10
+ export declare class E2eCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
11
+ multiTarget: boolean;
12
+ missingErrorTarget: string;
13
+ command: string;
14
+ aliases: string[];
15
+ describe: string;
16
+ longDescriptionPath?: string | undefined;
17
+ }
@@ -0,0 +1,34 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.E2eCommandModule = void 0;
11
+ const core_1 = require("@angular-devkit/core");
12
+ const architect_command_module_1 = require("../../command-builder/architect-command-module");
13
+ class E2eCommandModule extends architect_command_module_1.ArchitectCommandModule {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.multiTarget = true;
17
+ this.missingErrorTarget = core_1.tags.stripIndents `
18
+ Cannot find "e2e" target for the specified project.
19
+
20
+ You should add a package that implements end-to-end testing capabilities.
21
+
22
+ For example:
23
+ Cypress: ng add @cypress/schematic
24
+ Nightwatch: ng add @nightwatch/schematics
25
+ WebdriverIO: ng add @wdio/schematics
26
+
27
+ More options will be added to the list as they become available.
28
+ `;
29
+ this.command = 'e2e [project]';
30
+ this.aliases = ['e'];
31
+ this.describe = 'Builds and serves an Angular application, then runs end-to-end tests.';
32
+ }
33
+ }
34
+ exports.E2eCommandModule = E2eCommandModule;
@@ -0,0 +1,15 @@
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
+ import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
9
+ import { CommandModuleImplementation } from '../../command-builder/command-module';
10
+ export declare class ExtractI18nCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
11
+ multiTarget: boolean;
12
+ command: string;
13
+ describe: string;
14
+ longDescriptionPath?: string | undefined;
15
+ }
@@ -0,0 +1,20 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ExtractI18nCommandModule = void 0;
11
+ const architect_command_module_1 = require("../../command-builder/architect-command-module");
12
+ class ExtractI18nCommandModule extends architect_command_module_1.ArchitectCommandModule {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.multiTarget = false;
16
+ this.command = 'extract-i18n [project]';
17
+ this.describe = 'Extracts i18n messages from source code.';
18
+ }
19
+ }
20
+ exports.ExtractI18nCommandModule = ExtractI18nCommandModule;
@@ -0,0 +1,27 @@
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
+ import { Argv } from 'yargs';
9
+ import { CommandModuleImplementation, Options, OtherOptions } from '../../command-builder/command-module';
10
+ import { SchematicsCommandArgs, SchematicsCommandModule } from '../../command-builder/schematics-command-module';
11
+ export interface GenerateCommandArgs extends SchematicsCommandArgs {
12
+ schematic?: string;
13
+ }
14
+ export declare class GenerateCommandModule extends SchematicsCommandModule implements CommandModuleImplementation<GenerateCommandArgs> {
15
+ command: string;
16
+ aliases: string;
17
+ describe: string;
18
+ longDescriptionPath?: string | undefined;
19
+ builder(argv: Argv): Promise<Argv<GenerateCommandArgs>>;
20
+ run(options: Options<GenerateCommandArgs> & OtherOptions): number | void | Promise<number | void>;
21
+ /**
22
+ * Generate a command string to be passed to the command builder.
23
+ *
24
+ * @example `component [name]` or `@schematics/angular:component [name]`.
25
+ */
26
+ private generateCommandString;
27
+ }
@@ -0,0 +1,98 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.GenerateCommandModule = void 0;
11
+ const core_1 = require("@angular-devkit/core");
12
+ const schematics_command_module_1 = require("../../command-builder/schematics-command-module");
13
+ const generate_impl_1 = require("./generate-impl");
14
+ class GenerateCommandModule extends schematics_command_module_1.SchematicsCommandModule {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.command = 'generate [schematic]';
18
+ this.aliases = 'g';
19
+ this.describe = 'Generates and/or modifies files based on a schematic.';
20
+ }
21
+ async builder(argv) {
22
+ const [, schematicNameFromArgs] = this.parseSchematicInfo(
23
+ // positional = [generate, component] or [generate]
24
+ this.context.args.positional[1]);
25
+ const baseYargs = await super.builder(argv);
26
+ if (this.schematicName) {
27
+ return baseYargs;
28
+ }
29
+ // When we do know the schematic name we need to add the 'schematic'
30
+ // positional option as the schematic will be accessable as a subcommand.
31
+ let localYargs = schematicNameFromArgs
32
+ ? baseYargs
33
+ : baseYargs.positional('schematic', {
34
+ describe: 'The schematic or collection:schematic to generate.',
35
+ type: 'string',
36
+ demandOption: true,
37
+ });
38
+ const collectionName = await this.getCollectionName();
39
+ const workflow = this.getOrCreateWorkflow(collectionName);
40
+ const collection = workflow.engine.createCollection(collectionName);
41
+ const schematicsInCollection = collection.description.schematics;
42
+ // We cannot use `collection.listSchematicNames()` as this doesn't return hidden schematics.
43
+ const schematicNames = new Set(Object.keys(schematicsInCollection).sort());
44
+ if (schematicNameFromArgs && schematicNames.has(schematicNameFromArgs)) {
45
+ // No need to process all schematics since we know which one the user invoked.
46
+ schematicNames.clear();
47
+ schematicNames.add(schematicNameFromArgs);
48
+ }
49
+ for (const schematicName of schematicNames) {
50
+ const { description: { schemaJson, aliases: schematicAliases, hidden: schematicHidden }, } = collection.createSchematic(schematicName, true);
51
+ if (!schemaJson) {
52
+ continue;
53
+ }
54
+ const { description, 'x-deprecated': xDeprecated, aliases = schematicAliases, hidden = schematicHidden, } = schemaJson;
55
+ const options = await this.getSchematicOptions(collection, schematicName, workflow);
56
+ localYargs = localYargs.command({
57
+ command: await this.generateCommandString(collectionName, schematicName, options),
58
+ // When 'describe' is set to false, it results in a hidden command.
59
+ describe: hidden === true ? false : typeof description === 'string' ? description : '',
60
+ deprecated: xDeprecated === true || typeof xDeprecated === 'string' ? xDeprecated : false,
61
+ aliases: Array.isArray(aliases) ? aliases : undefined,
62
+ builder: (localYargs) => this.addSchemaOptionsToCommand(localYargs, options).strict(),
63
+ handler: (options) => this.handler({ ...options, schematic: `${collectionName}:${schematicName}` }),
64
+ });
65
+ }
66
+ return localYargs;
67
+ }
68
+ run(options) {
69
+ const command = new generate_impl_1.GenerateCommand(this.context, 'generate');
70
+ return command.validateAndRun(options);
71
+ }
72
+ /**
73
+ * Generate a command string to be passed to the command builder.
74
+ *
75
+ * @example `component [name]` or `@schematics/angular:component [name]`.
76
+ */
77
+ async generateCommandString(collectionName, schematicName, options) {
78
+ const [collectionNameFromArgs] = this.parseSchematicInfo(
79
+ // positional = [generate, component] or [generate]
80
+ this.context.args.positional[1]);
81
+ const dasherizedSchematicName = core_1.strings.dasherize(schematicName);
82
+ // Only add the collection name as part of the command when it's not the default collection or when it has been provided via the CLI.
83
+ // Ex:`ng generate @schematics/angular:component`
84
+ const commandName = !!collectionNameFromArgs ||
85
+ (await this.getDefaultSchematicCollection()) !== (await this.getCollectionName())
86
+ ? collectionName + ':' + dasherizedSchematicName
87
+ : dasherizedSchematicName;
88
+ const positionalArgs = options
89
+ .filter((o) => o.positional !== undefined)
90
+ .map((o) => {
91
+ const label = `${core_1.strings.dasherize(o.name)}${o.type === 'array' ? ' ..' : ''}`;
92
+ return o.required ? `<${label}>` : `[${label}]`;
93
+ })
94
+ .join(' ');
95
+ return `${commandName}${positionalArgs ? ' ' + positionalArgs : ''}`;
96
+ }
97
+ }
98
+ exports.GenerateCommandModule = GenerateCommandModule;
@@ -0,0 +1,19 @@
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
+ import { SchematicCommand } from '../../../models/schematic-command';
9
+ import { Options, OtherOptions } from '../../command-builder/command-module';
10
+ import { GenerateCommandArgs } from './cli';
11
+ declare type GenerateCommandOptions = Options<GenerateCommandArgs>;
12
+ export declare class GenerateCommand extends SchematicCommand<GenerateCommandOptions> {
13
+ longSchematicName: string | undefined;
14
+ initialize(options: GenerateCommandOptions): Promise<void>;
15
+ run(options: GenerateCommandOptions & OtherOptions): Promise<number | void>;
16
+ reportAnalytics(paths: string[], options: GenerateCommandOptions): Promise<void>;
17
+ private parseSchematicInfo;
18
+ }
19
+ export {};
@@ -0,0 +1,49 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.GenerateCommand = void 0;
11
+ const schematic_command_1 = require("../../../models/schematic-command");
12
+ class GenerateCommand extends schematic_command_1.SchematicCommand {
13
+ async initialize(options) {
14
+ // Fill up the schematics property of the command description.
15
+ const [collectionName, schematicName] = await this.parseSchematicInfo(options.schematic);
16
+ this.collectionName = collectionName !== null && collectionName !== void 0 ? collectionName : (await this.getDefaultSchematicCollection());
17
+ this.schematicName = schematicName;
18
+ await super.initialize(options);
19
+ }
20
+ async run(options) {
21
+ if (!this.schematicName || !this.collectionName) {
22
+ return 1;
23
+ }
24
+ const { dryRun, force, interactive, defaults, schematic, ...schematicOptions } = options;
25
+ return this.runSchematic({
26
+ collectionName: this.collectionName,
27
+ schematicName: this.schematicName,
28
+ schematicOptions: schematicOptions,
29
+ debug: false,
30
+ dryRun,
31
+ force,
32
+ });
33
+ }
34
+ async reportAnalytics(paths, options) {
35
+ if (!this.collectionName || !this.schematicName) {
36
+ return;
37
+ }
38
+ const escapedSchematicName = (this.longSchematicName || this.schematicName).replace(/\//g, '_');
39
+ return super.reportAnalytics(['generate', this.collectionName.replace(/\//g, '_'), escapedSchematicName], options);
40
+ }
41
+ parseSchematicInfo(schematic) {
42
+ if (schematic === null || schematic === void 0 ? void 0 : schematic.includes(':')) {
43
+ const [collectionName, schematicName] = schematic.split(':', 2);
44
+ return [collectionName, schematicName];
45
+ }
46
+ return [undefined, schematic];
47
+ }
48
+ }
49
+ exports.GenerateCommand = GenerateCommand;
@@ -0,0 +1,16 @@
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
+ import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
9
+ import { CommandModuleImplementation } from '../../command-builder/command-module';
10
+ export declare class LintCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
11
+ missingErrorTarget: string;
12
+ multiTarget: boolean;
13
+ command: string;
14
+ longDescriptionPath: string;
15
+ describe: string;
16
+ }
@@ -0,0 +1,31 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.LintCommandModule = void 0;
11
+ const core_1 = require("@angular-devkit/core");
12
+ const path_1 = require("path");
13
+ const architect_command_module_1 = require("../../command-builder/architect-command-module");
14
+ class LintCommandModule extends architect_command_module_1.ArchitectCommandModule {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.missingErrorTarget = core_1.tags.stripIndents `
18
+ Cannot find "lint" target for the specified project.
19
+
20
+ You should add a package that implements linting capabilities.
21
+
22
+ For example:
23
+ ng add @angular-eslint/schematics
24
+ `;
25
+ this.multiTarget = true;
26
+ this.command = 'lint [project]';
27
+ this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
28
+ this.describe = 'Runs linting tools on Angular application code in a given project folder.';
29
+ }
30
+ }
31
+ exports.LintCommandModule = LintCommandModule;
@@ -0,0 +1,17 @@
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
+ import { Argv } from 'yargs';
9
+ import { CommandModule, CommandModuleImplementation } from '../../command-builder/command-module';
10
+ export declare class AwesomeCommandModule extends CommandModule implements CommandModuleImplementation {
11
+ command: string;
12
+ describe: false;
13
+ deprecated: boolean;
14
+ longDescriptionPath?: string | undefined;
15
+ builder(localYargs: Argv): Argv;
16
+ run(): void;
17
+ }