@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
@@ -7,14 +7,21 @@
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.AwesomeCommand = void 0;
11
- const command_1 = require("../models/command");
12
- const color_1 = require("../utilities/color");
13
- function pickOne(of) {
14
- return of[Math.floor(Math.random() * of.length)];
15
- }
16
- class AwesomeCommand extends command_1.Command {
17
- async run() {
10
+ exports.AwesomeCommandModule = void 0;
11
+ const command_module_1 = require("../../command-builder/command-module");
12
+ const color_1 = require("../../utilities/color");
13
+ class AwesomeCommandModule extends command_module_1.CommandModule {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.command = 'make-this-awesome';
17
+ this.describe = false;
18
+ this.deprecated = false;
19
+ }
20
+ builder(localYargs) {
21
+ return localYargs;
22
+ }
23
+ run() {
24
+ const pickOne = (of) => of[Math.floor(Math.random() * of.length)];
18
25
  const phrase = pickOne([
19
26
  `You're on it, there's nothing for me to do!`,
20
27
  `Let's take a look... nope, it's all good!`,
@@ -25,7 +32,7 @@ class AwesomeCommand extends command_1.Command {
25
32
  `I spy with my little eye a great developer!`,
26
33
  `Noop... already awesome.`,
27
34
  ]);
28
- this.logger.info(color_1.colors.green(phrase));
35
+ this.context.logger.info(color_1.colors.green(phrase));
29
36
  }
30
37
  }
31
- exports.AwesomeCommand = AwesomeCommand;
38
+ exports.AwesomeCommandModule = AwesomeCommandModule;
@@ -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 { CommandModuleImplementation, CommandScope, Options, OtherOptions } from '../../command-builder/command-module';
10
+ import { SchematicsCommandArgs, SchematicsCommandModule } from '../../command-builder/schematics-command-module';
11
+ export interface NewCommandArgs extends SchematicsCommandArgs {
12
+ collection?: string;
13
+ }
14
+ export declare class NewCommandModule extends SchematicsCommandModule implements CommandModuleImplementation<NewCommandArgs> {
15
+ protected schematicName: string;
16
+ static scope: CommandScope;
17
+ command: string;
18
+ aliases: string;
19
+ describe: string;
20
+ longDescriptionPath?: string | undefined;
21
+ builder(argv: Argv): Promise<Argv<NewCommandArgs>>;
22
+ run(options: Options<NewCommandArgs> & OtherOptions): number | void | Promise<number | void>;
23
+ }
@@ -0,0 +1,36 @@
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.NewCommandModule = void 0;
11
+ const command_module_1 = require("../../command-builder/command-module");
12
+ const schematics_command_module_1 = require("../../command-builder/schematics-command-module");
13
+ const new_impl_1 = require("./new-impl");
14
+ class NewCommandModule extends schematics_command_module_1.SchematicsCommandModule {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.schematicName = 'ng-new';
18
+ this.command = 'new [name]';
19
+ this.aliases = 'n';
20
+ this.describe = 'Creates a new Angular workspace.';
21
+ }
22
+ async builder(argv) {
23
+ const baseYargs = await super.builder(argv);
24
+ return baseYargs.option('collection', {
25
+ alias: 'c',
26
+ describe: 'A collection of schematics to use in generating the initial application.',
27
+ type: 'string',
28
+ });
29
+ }
30
+ run(options) {
31
+ const command = new new_impl_1.NewCommand(this.context, 'new');
32
+ return command.validateAndRun(options);
33
+ }
34
+ }
35
+ exports.NewCommandModule = NewCommandModule;
36
+ NewCommandModule.scope = command_module_1.CommandScope.Out;
@@ -0,0 +1,18 @@
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 { NewCommandArgs } from './cli';
11
+ declare type NewCommandOptions = Options<NewCommandArgs>;
12
+ export declare class NewCommand extends SchematicCommand<NewCommandOptions> {
13
+ readonly allowMissingWorkspace = true;
14
+ schematicName: string;
15
+ initialize(options: NewCommandOptions): Promise<void>;
16
+ run(options: NewCommandOptions & OtherOptions): Promise<number | void>;
17
+ }
18
+ export {};
@@ -8,8 +8,8 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.NewCommand = void 0;
11
- const schematic_command_1 = require("../models/schematic-command");
12
- const version_1 = require("../models/version");
11
+ const schematic_command_1 = require("../../../models/schematic-command");
12
+ const version_1 = require("../../utilities/version");
13
13
  class NewCommand extends schematic_command_1.SchematicCommand {
14
14
  constructor() {
15
15
  super(...arguments);
@@ -24,13 +24,14 @@ class NewCommand extends schematic_command_1.SchematicCommand {
24
24
  // Register the version of the CLI in the registry.
25
25
  const version = version_1.VERSION.full;
26
26
  this._workflow.registry.addSmartDefaultProvider('ng-cli-version', () => version);
27
+ const { dryRun, force, interactive, defaults, collection, ...schematicOptions } = options;
27
28
  return this.runSchematic({
28
29
  collectionName: this.collectionName,
29
30
  schematicName: this.schematicName,
30
- schematicOptions: options['--'] || [],
31
- debug: !!options.debug,
32
- dryRun: !!options.dryRun,
33
- force: !!options.force,
31
+ schematicOptions,
32
+ debug: false,
33
+ dryRun,
34
+ force,
34
35
  });
35
36
  }
36
37
  }
@@ -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 { Target } from '@angular-devkit/architect';
9
+ import { Argv } from 'yargs';
10
+ import { ArchitectBaseCommandModule } from '../../command-builder/architect-base-command-module';
11
+ import { CommandModuleImplementation, CommandScope, Options, OtherOptions } from '../../command-builder/command-module';
12
+ export interface RunCommandArgs {
13
+ target: string;
14
+ }
15
+ export declare class RunCommandModule extends ArchitectBaseCommandModule<RunCommandArgs> implements CommandModuleImplementation<RunCommandArgs> {
16
+ static scope: CommandScope;
17
+ command: string;
18
+ describe: string;
19
+ longDescriptionPath: string;
20
+ builder(argv: Argv): Promise<Argv<RunCommandArgs>>;
21
+ run(options: Options<RunCommandArgs> & OtherOptions): Promise<number>;
22
+ protected makeTargetSpecifier(options?: Options<RunCommandArgs>): Target | undefined;
23
+ }
@@ -0,0 +1,59 @@
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.RunCommandModule = void 0;
11
+ const path_1 = require("path");
12
+ const architect_base_command_module_1 = require("../../command-builder/architect-base-command-module");
13
+ const command_module_1 = require("../../command-builder/command-module");
14
+ class RunCommandModule extends architect_base_command_module_1.ArchitectBaseCommandModule {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.command = 'run <target>';
18
+ this.describe = 'Runs an Architect target with an optional custom builder configuration defined in your project.';
19
+ this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
20
+ }
21
+ async builder(argv) {
22
+ const localYargs = argv
23
+ .positional('target', {
24
+ describe: 'The Architect target to run.',
25
+ type: 'string',
26
+ demandOption: true,
27
+ })
28
+ .strict();
29
+ const target = this.makeTargetSpecifier();
30
+ if (!target) {
31
+ return localYargs;
32
+ }
33
+ const schemaOptions = await this.getArchitectTargetOptions(target);
34
+ return this.addSchemaOptionsToCommand(localYargs, schemaOptions);
35
+ }
36
+ async run(options) {
37
+ const target = this.makeTargetSpecifier(options);
38
+ const { target: _target, ...extraOptions } = options;
39
+ if (!target) {
40
+ throw new command_module_1.CommandModuleError('Cannot determine project or target.');
41
+ }
42
+ return this.runSingleTarget(target, extraOptions);
43
+ }
44
+ makeTargetSpecifier(options) {
45
+ var _a;
46
+ const architectTarget = (_a = options === null || options === void 0 ? void 0 : options.target) !== null && _a !== void 0 ? _a : this.context.args.positional[1];
47
+ if (!architectTarget) {
48
+ return undefined;
49
+ }
50
+ const [project = '', target = '', configuration] = architectTarget.split(':');
51
+ return {
52
+ project,
53
+ target,
54
+ configuration,
55
+ };
56
+ }
57
+ }
58
+ exports.RunCommandModule = RunCommandModule;
59
+ RunCommandModule.scope = command_module_1.CommandScope.In;
@@ -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 ServeCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
11
+ multiTarget: boolean;
12
+ command: string;
13
+ aliases: string[];
14
+ describe: string;
15
+ longDescriptionPath?: string | undefined;
16
+ }
@@ -0,0 +1,21 @@
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.ServeCommandModule = void 0;
11
+ const architect_command_module_1 = require("../../command-builder/architect-command-module");
12
+ class ServeCommandModule extends architect_command_module_1.ArchitectCommandModule {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.multiTarget = false;
16
+ this.command = 'serve [project]';
17
+ this.aliases = ['s'];
18
+ this.describe = 'Builds and serves your application, rebuilding on file changes.';
19
+ }
20
+ }
21
+ exports.ServeCommandModule = ServeCommandModule;
@@ -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 TestCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
11
+ multiTarget: boolean;
12
+ command: string;
13
+ aliases: string[];
14
+ describe: string;
15
+ longDescriptionPath: string;
16
+ }
@@ -0,0 +1,23 @@
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.TestCommandModule = void 0;
11
+ const path_1 = require("path");
12
+ const architect_command_module_1 = require("../../command-builder/architect-command-module");
13
+ class TestCommandModule extends architect_command_module_1.ArchitectCommandModule {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.multiTarget = true;
17
+ this.command = 'test [project]';
18
+ this.aliases = ['t'];
19
+ this.describe = 'Runs unit tests in a project.';
20
+ this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
21
+ }
22
+ }
23
+ exports.TestCommandModule = TestCommandModule;
@@ -0,0 +1,29 @@
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, CommandScope, Options, OtherOptions } from '../../command-builder/command-module';
10
+ export interface UpdateCommandArgs {
11
+ packages?: string | string[];
12
+ force: boolean;
13
+ next: boolean;
14
+ 'migrate-only'?: boolean;
15
+ name?: string;
16
+ from?: string;
17
+ to?: string;
18
+ 'allow-dirty': boolean;
19
+ verbose: boolean;
20
+ 'create-commits': boolean;
21
+ }
22
+ export declare class UpdateCommandModule extends CommandModule<UpdateCommandArgs> {
23
+ static scope: CommandScope;
24
+ command: string;
25
+ describe: string;
26
+ longDescriptionPath?: string | undefined;
27
+ builder(localYargs: Argv): Argv<UpdateCommandArgs>;
28
+ run(options: Options<UpdateCommandArgs> & OtherOptions): Promise<number | void>;
29
+ }
@@ -0,0 +1,83 @@
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.UpdateCommandModule = void 0;
11
+ const command_module_1 = require("../../command-builder/command-module");
12
+ const update_impl_1 = require("./update-impl");
13
+ class UpdateCommandModule extends command_module_1.CommandModule {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.command = 'update [packages..]';
17
+ this.describe = 'Updates your workspace and its dependencies. See https://update.angular.io/.';
18
+ }
19
+ builder(localYargs) {
20
+ return localYargs
21
+ .positional('packages', {
22
+ description: 'The names of package(s) to update.',
23
+ type: 'string',
24
+ })
25
+ .option('force', {
26
+ description: 'Ignore peer dependency version mismatches. ' +
27
+ 'Passes the `--force` flag to the package manager when installing packages.',
28
+ type: 'boolean',
29
+ default: false,
30
+ })
31
+ .option('next', {
32
+ description: 'Use the prerelease version, including beta and RCs.',
33
+ type: 'boolean',
34
+ default: false,
35
+ })
36
+ .option('migrate-only', {
37
+ description: 'Only perform a migration, do not update the installed version.',
38
+ type: 'boolean',
39
+ })
40
+ .option('name', {
41
+ description: 'The name of the migration to run.',
42
+ type: 'string',
43
+ implies: ['migrate-only'],
44
+ conflicts: ['to', 'from'],
45
+ })
46
+ .option('from', {
47
+ description: 'Version from which to migrate from. Only available with a single package being updated, and only on migration only.',
48
+ type: 'string',
49
+ implies: ['to', 'migrate-only'],
50
+ conflicts: ['name'],
51
+ })
52
+ .option('to', {
53
+ describe: 'Version up to which to apply migrations. Only available with a single package being updated, ' +
54
+ 'and only on migrations only. Requires from to be specified. Default to the installed version detected.',
55
+ type: 'string',
56
+ implies: ['from', 'migrate-only'],
57
+ conflicts: ['name'],
58
+ })
59
+ .option('allow-dirty', {
60
+ describe: 'Whether to allow updating when the repository contains modified or untracked files.',
61
+ type: 'boolean',
62
+ default: false,
63
+ })
64
+ .option('verbose', {
65
+ describe: 'Display additional details about internal operations during execution.',
66
+ type: 'boolean',
67
+ default: false,
68
+ })
69
+ .option('create-commits', {
70
+ describe: 'Create source control commits for updates and migrations.',
71
+ type: 'boolean',
72
+ alias: ['C'],
73
+ default: false,
74
+ })
75
+ .strict();
76
+ }
77
+ run(options) {
78
+ const command = new update_impl_1.UpdateCommand(this.context, 'update');
79
+ return command.validateAndRun(options);
80
+ }
81
+ }
82
+ exports.UpdateCommandModule = UpdateCommandModule;
83
+ UpdateCommandModule.scope = command_module_1.CommandScope.In;
@@ -31,7 +31,7 @@ const core_1 = require("@angular-devkit/core");
31
31
  const schematics_1 = require("@angular-devkit/schematics");
32
32
  const npa = __importStar(require("npm-package-arg"));
33
33
  const semver = __importStar(require("semver"));
34
- const package_metadata_1 = require("../../../../utilities/package-metadata");
34
+ const package_metadata_1 = require("../../../utilities/package-metadata");
35
35
  // Angular guarantees that a major is compatible with its following major (so packages that depend
36
36
  // on Angular 5 are also compatible with Angular 6). This is, in code, represented by verifying
37
37
  // that all other packages that have a peer dependency of `"@angular/core": "^5.0.0"` actually
@@ -5,14 +5,15 @@
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 UpdateCommandSchema } from './update';
11
- export declare class UpdateCommand extends Command<UpdateCommandSchema> {
8
+ import { Command } from '../../../models/command';
9
+ import { Options } from '../../command-builder/command-module';
10
+ import { UpdateCommandArgs } from './cli';
11
+ declare type UpdateCommandOptions = Options<UpdateCommandArgs>;
12
+ export declare class UpdateCommand extends Command<UpdateCommandOptions> {
12
13
  readonly allowMissingWorkspace = true;
13
14
  private workflow;
14
15
  private packageManager;
15
- initialize(options: UpdateCommandSchema & Arguments): Promise<void>;
16
+ initialize(options: UpdateCommandOptions): Promise<void>;
16
17
  private executeSchematic;
17
18
  /**
18
19
  * @return Whether or not the migration was performed successfully.
@@ -23,7 +24,7 @@ export declare class UpdateCommand extends Command<UpdateCommandSchema> {
23
24
  */
24
25
  private executeMigrations;
25
26
  private executePackageMigrations;
26
- run(options: UpdateCommandSchema & Arguments): Promise<number>;
27
+ run(options: UpdateCommandOptions): Promise<number>;
27
28
  /**
28
29
  * @return Whether or not the commit was successful.
29
30
  */
@@ -36,3 +37,4 @@ export declare class UpdateCommand extends Command<UpdateCommandSchema> {
36
37
  private checkCLIVersion;
37
38
  private getCLIUpdateRunnerVersion;
38
39
  }
40
+ export {};
@@ -38,17 +38,17 @@ const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
38
38
  const npm_pick_manifest_1 = __importDefault(require("npm-pick-manifest"));
39
39
  const path = __importStar(require("path"));
40
40
  const semver = __importStar(require("semver"));
41
- const workspace_schema_1 = require("../lib/config/workspace-schema");
42
- const command_1 = require("../models/command");
43
- const schematic_engine_host_1 = require("../models/schematic-engine-host");
44
- const version_1 = require("../models/version");
45
- const color_1 = require("../utilities/color");
46
- const install_package_1 = require("../utilities/install-package");
47
- const log_file_1 = require("../utilities/log-file");
48
- const package_manager_1 = require("../utilities/package-manager");
49
- const package_metadata_1 = require("../utilities/package-metadata");
50
- const package_tree_1 = require("../utilities/package-tree");
51
- const UPDATE_SCHEMATIC_COLLECTION = path.join(__dirname, '../src/commands/update/schematic/collection.json');
41
+ const workspace_schema_1 = require("../../../lib/config/workspace-schema");
42
+ const command_1 = require("../../../models/command");
43
+ const schematic_engine_host_1 = require("../../../models/schematic-engine-host");
44
+ const color_1 = require("../../utilities/color");
45
+ const install_package_1 = require("../../utilities/install-package");
46
+ const log_file_1 = require("../../utilities/log-file");
47
+ const package_manager_1 = require("../../utilities/package-manager");
48
+ const package_metadata_1 = require("../../utilities/package-metadata");
49
+ const package_tree_1 = require("../../utilities/package-tree");
50
+ const version_1 = require("../../utilities/version");
51
+ const UPDATE_SCHEMATIC_COLLECTION = path.join(__dirname, 'schematic/collection.json');
52
52
  /**
53
53
  * Disable CLI version mismatch checks and forces usage of the invoked CLI
54
54
  * instead of invoking the local installed version.
@@ -218,7 +218,7 @@ class UpdateCommand extends command_1.Command {
218
218
  await (0, package_manager_1.ensureCompatibleNpm)(this.context.root);
219
219
  // Check if the current installed CLI version is older than the latest compatible version.
220
220
  if (!disableVersionCheck) {
221
- const cliVersionToInstall = await this.checkCLIVersion(options['--'], options.verbose, options.next);
221
+ const cliVersionToInstall = await this.checkCLIVersion(options.packages, options.verbose, options.next);
222
222
  if (cliVersionToInstall) {
223
223
  this.logger.warn('The installed Angular CLI version is outdated.\n' +
224
224
  `Installing a temporary Angular CLI versioned ${cliVersionToInstall} to perform the update.`);
@@ -231,7 +231,8 @@ class UpdateCommand extends command_1.Command {
231
231
  }
232
232
  };
233
233
  const packages = [];
234
- for (const request of options['--'] || []) {
234
+ const packagesFromOptions = typeof options.packages === 'string' ? [options.packages] : options.packages;
235
+ for (const request of packagesFromOptions !== null && packagesFromOptions !== void 0 ? packagesFromOptions : []) {
235
236
  try {
236
237
  const packageIdentifier = (0, npm_package_arg_1.default)(request);
237
238
  // only registry identifiers are supported
@@ -363,8 +364,8 @@ class UpdateCommand extends command_1.Command {
363
364
  }
364
365
  }
365
366
  let result;
366
- if (typeof options.migrateOnly == 'string') {
367
- result = await this.executeMigration(packageName, migrations, options.migrateOnly, options.createCommits);
367
+ if (options.name) {
368
+ result = await this.executeMigration(packageName, migrations, options.name, options.createCommits);
368
369
  }
369
370
  else {
370
371
  const from = coerceVersionNumber(options.from);
@@ -487,21 +488,11 @@ class UpdateCommand extends command_1.Command {
487
488
  try {
488
489
  // Remove existing node modules directory to provide a stronger guarantee that packages
489
490
  // will be hoisted into the correct locations.
490
- // The below should be removed and replaced with just `rm` when support for Node.Js 12 is removed.
491
- const { rm, rmdir } = fs.promises;
492
- if (rm) {
493
- await rm(path.join(this.context.root, 'node_modules'), {
494
- force: true,
495
- recursive: true,
496
- maxRetries: 3,
497
- });
498
- }
499
- else {
500
- await rmdir(path.join(this.context.root, 'node_modules'), {
501
- recursive: true,
502
- maxRetries: 3,
503
- });
504
- }
491
+ await fs.promises.rm(path.join(this.context.root, 'node_modules'), {
492
+ force: true,
493
+ recursive: true,
494
+ maxRetries: 3,
495
+ });
505
496
  }
506
497
  catch { }
507
498
  const result = await (0, install_package_1.installAllPackages)(this.packageManager, options.force ? ['--force'] : [], this.context.root);
@@ -648,7 +639,7 @@ class UpdateCommand extends command_1.Command {
648
639
  * @returns the version to install or null when there is no update to install.
649
640
  */
650
641
  async checkCLIVersion(packagesToUpdate, verbose = false, next = false) {
651
- const { version } = await (0, package_metadata_1.fetchPackageManifest)(`@angular/cli@${this.getCLIUpdateRunnerVersion(packagesToUpdate, next)}`, this.logger, {
642
+ const { version } = await (0, package_metadata_1.fetchPackageManifest)(`@angular/cli@${this.getCLIUpdateRunnerVersion(typeof packagesToUpdate === 'string' ? [packagesToUpdate] : packagesToUpdate, next)}`, this.logger, {
652
643
  verbose,
653
644
  usingYarn: this.packageManager === workspace_schema_1.PackageManager.Yarn,
654
645
  });
@@ -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 { Argv } from 'yargs';
9
+ import { CommandModule, CommandModuleImplementation } from '../../command-builder/command-module';
10
+ export declare class VersionCommandModule extends CommandModule implements CommandModuleImplementation {
11
+ command: string;
12
+ aliases: string[];
13
+ describe: string;
14
+ longDescriptionPath?: string | undefined;
15
+ builder(localYargs: Argv): Argv;
16
+ run(): Promise<void>;
17
+ private getVersion;
18
+ private getPackageManagerVersion;
19
+ }