@angular/cli 18.1.0-next.0 → 18.1.0-next.2

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 (130) hide show
  1. package/bin/bootstrap.js +1 -1
  2. package/bin/ng.js +1 -1
  3. package/lib/cli/index.d.ts +1 -1
  4. package/lib/cli/index.js +7 -7
  5. package/lib/config/schema.json +27 -1
  6. package/lib/config/workspace-schema.d.ts +1 -1
  7. package/lib/init.d.ts +1 -1
  8. package/lib/init.js +1 -1
  9. package/package.json +23 -14
  10. package/src/analytics/analytics-collector.d.ts +1 -1
  11. package/src/analytics/analytics-collector.js +1 -1
  12. package/src/analytics/analytics-parameters.d.ts +1 -1
  13. package/src/analytics/analytics-parameters.js +1 -1
  14. package/src/analytics/analytics.d.ts +1 -1
  15. package/src/analytics/analytics.js +7 -7
  16. package/src/command-builder/architect-base-command-module.d.ts +1 -1
  17. package/src/command-builder/architect-base-command-module.js +1 -1
  18. package/src/command-builder/architect-command-module.d.ts +1 -1
  19. package/src/command-builder/architect-command-module.js +1 -1
  20. package/src/command-builder/command-module.d.ts +1 -1
  21. package/src/command-builder/command-module.js +1 -1
  22. package/src/command-builder/command-runner.d.ts +1 -1
  23. package/src/command-builder/command-runner.js +2 -3
  24. package/src/command-builder/schematics-command-module.d.ts +1 -1
  25. package/src/command-builder/schematics-command-module.js +88 -51
  26. package/src/command-builder/utilities/command.d.ts +1 -1
  27. package/src/command-builder/utilities/command.js +3 -3
  28. package/src/command-builder/utilities/json-help.d.ts +1 -1
  29. package/src/command-builder/utilities/json-help.js +2 -3
  30. package/src/command-builder/utilities/json-schema.d.ts +1 -1
  31. package/src/command-builder/utilities/json-schema.js +2 -3
  32. package/src/command-builder/utilities/normalize-options-middleware.d.ts +1 -1
  33. package/src/command-builder/utilities/normalize-options-middleware.js +2 -3
  34. package/src/command-builder/utilities/schematic-engine-host.d.ts +1 -1
  35. package/src/command-builder/utilities/schematic-engine-host.js +1 -1
  36. package/src/command-builder/utilities/schematic-workflow.d.ts +1 -1
  37. package/src/command-builder/utilities/schematic-workflow.js +2 -3
  38. package/src/commands/add/cli.d.ts +1 -1
  39. package/src/commands/add/cli.js +12 -2
  40. package/src/commands/analytics/cli.d.ts +1 -1
  41. package/src/commands/analytics/cli.js +1 -1
  42. package/src/commands/analytics/info/cli.d.ts +1 -1
  43. package/src/commands/analytics/info/cli.js +1 -1
  44. package/src/commands/analytics/settings/cli.d.ts +1 -1
  45. package/src/commands/analytics/settings/cli.js +1 -1
  46. package/src/commands/build/cli.d.ts +1 -1
  47. package/src/commands/build/cli.js +1 -1
  48. package/src/commands/cache/clean/cli.d.ts +1 -1
  49. package/src/commands/cache/clean/cli.js +1 -1
  50. package/src/commands/cache/cli.d.ts +1 -1
  51. package/src/commands/cache/cli.js +1 -1
  52. package/src/commands/cache/info/cli.d.ts +1 -1
  53. package/src/commands/cache/info/cli.js +1 -1
  54. package/src/commands/cache/settings/cli.d.ts +1 -1
  55. package/src/commands/cache/settings/cli.js +1 -1
  56. package/src/commands/cache/utilities.d.ts +1 -1
  57. package/src/commands/cache/utilities.js +3 -4
  58. package/src/commands/command-config.d.ts +1 -1
  59. package/src/commands/command-config.js +1 -1
  60. package/src/commands/completion/cli.d.ts +1 -1
  61. package/src/commands/completion/cli.js +1 -1
  62. package/src/commands/config/cli.d.ts +1 -1
  63. package/src/commands/config/cli.js +1 -1
  64. package/src/commands/deploy/cli.d.ts +1 -1
  65. package/src/commands/deploy/cli.js +1 -1
  66. package/src/commands/e2e/cli.d.ts +1 -1
  67. package/src/commands/e2e/cli.js +1 -1
  68. package/src/commands/extract-i18n/cli.d.ts +1 -1
  69. package/src/commands/extract-i18n/cli.js +1 -1
  70. package/src/commands/generate/cli.d.ts +1 -1
  71. package/src/commands/generate/cli.js +1 -1
  72. package/src/commands/lint/cli.d.ts +1 -1
  73. package/src/commands/lint/cli.js +1 -1
  74. package/src/commands/make-this-awesome/cli.d.ts +1 -1
  75. package/src/commands/make-this-awesome/cli.js +1 -1
  76. package/src/commands/new/cli.d.ts +1 -1
  77. package/src/commands/new/cli.js +1 -1
  78. package/src/commands/run/cli.d.ts +1 -1
  79. package/src/commands/run/cli.js +1 -1
  80. package/src/commands/serve/cli.d.ts +1 -1
  81. package/src/commands/serve/cli.js +1 -1
  82. package/src/commands/test/cli.d.ts +1 -1
  83. package/src/commands/test/cli.js +1 -1
  84. package/src/commands/update/cli.d.ts +2 -1
  85. package/src/commands/update/cli.js +4 -3
  86. package/src/commands/update/schematic/index.d.ts +1 -1
  87. package/src/commands/update/schematic/index.js +3 -4
  88. package/src/commands/version/cli.d.ts +1 -1
  89. package/src/commands/version/cli.js +1 -1
  90. package/src/typings-bazel.d.ts +1 -1
  91. package/src/typings.d.ts +1 -1
  92. package/src/typings.js +1 -1
  93. package/src/utilities/color.d.ts +1 -2
  94. package/src/utilities/color.js +2 -8
  95. package/src/utilities/completion.d.ts +1 -1
  96. package/src/utilities/completion.js +4 -5
  97. package/src/utilities/config.d.ts +1 -1
  98. package/src/utilities/config.js +9 -9
  99. package/src/utilities/environment-options.d.ts +1 -1
  100. package/src/utilities/environment-options.js +1 -1
  101. package/src/utilities/eol.d.ts +1 -1
  102. package/src/utilities/eol.js +2 -3
  103. package/src/utilities/error.d.ts +1 -1
  104. package/src/utilities/error.js +2 -3
  105. package/src/utilities/find-up.d.ts +1 -1
  106. package/src/utilities/find-up.js +2 -3
  107. package/src/utilities/json-file.d.ts +1 -1
  108. package/src/utilities/json-file.js +4 -4
  109. package/src/utilities/load-esm.d.ts +1 -2
  110. package/src/utilities/load-esm.js +2 -3
  111. package/src/utilities/log-file.d.ts +1 -1
  112. package/src/utilities/log-file.js +2 -3
  113. package/src/utilities/memoize.d.ts +1 -1
  114. package/src/utilities/memoize.js +2 -3
  115. package/src/utilities/package-manager.d.ts +1 -1
  116. package/src/utilities/package-manager.js +1 -1
  117. package/src/utilities/package-metadata.d.ts +1 -1
  118. package/src/utilities/package-metadata.js +4 -5
  119. package/src/utilities/package-tree.d.ts +1 -1
  120. package/src/utilities/package-tree.js +4 -5
  121. package/src/utilities/project.d.ts +1 -1
  122. package/src/utilities/project.js +2 -3
  123. package/src/utilities/prompt.d.ts +9 -4
  124. package/src/utilities/prompt.js +48 -30
  125. package/src/utilities/spinner.d.ts +1 -1
  126. package/src/utilities/spinner.js +1 -1
  127. package/src/utilities/tty.d.ts +1 -1
  128. package/src/utilities/tty.js +2 -3
  129. package/src/utilities/version.d.ts +1 -1
  130. package/src/utilities/version.js +2 -2
package/bin/bootstrap.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
 
9
9
  /**
package/bin/ng.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
 
10
10
  /* eslint-disable no-console */
@@ -3,7 +3,7 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  export { VERSION } from '../../src/utilities/version';
9
9
  export default function (options: {
package/lib/cli/index.js CHANGED
@@ -4,12 +4,13 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.VERSION = void 0;
11
+ exports.default = default_1;
11
12
  const core_1 = require("@angular-devkit/core");
12
- const util_1 = require("util");
13
+ const node_util_1 = require("node:util");
13
14
  const command_module_1 = require("../../src/command-builder/command-module");
14
15
  const command_runner_1 = require("../../src/command-builder/command-runner");
15
16
  const color_1 = require("../../src/utilities/color");
@@ -43,7 +44,7 @@ async function default_1(options) {
43
44
  if (!environment_options_1.ngDebug && entry.level === 'debug') {
44
45
  return;
45
46
  }
46
- const color = color_1.colors.enabled ? colorLevels[entry.level] : color_1.removeColor;
47
+ const color = color_1.colors.enabled ? colorLevels[entry.level] : node_util_1.stripVTControlCharacters;
47
48
  const message = color(entry.message);
48
49
  switch (entry.level) {
49
50
  case 'warn':
@@ -58,13 +59,13 @@ async function default_1(options) {
58
59
  });
59
60
  // Redirect console to logger
60
61
  console.info = console.log = function (...args) {
61
- logger.info((0, util_1.format)(...args));
62
+ logger.info((0, node_util_1.format)(...args));
62
63
  };
63
64
  console.warn = function (...args) {
64
- logger.warn((0, util_1.format)(...args));
65
+ logger.warn((0, node_util_1.format)(...args));
65
66
  };
66
67
  console.error = function (...args) {
67
- logger.error((0, util_1.format)(...args));
68
+ logger.error((0, node_util_1.format)(...args));
68
69
  };
69
70
  try {
70
71
  return await (0, command_runner_1.runCommand)(options.cliArgs, logger);
@@ -104,4 +105,3 @@ async function default_1(options) {
104
105
  await loggerFinished;
105
106
  }
106
107
  }
107
- exports.default = default_1;
@@ -1628,7 +1628,7 @@
1628
1628
  "default": false
1629
1629
  },
1630
1630
  "strict": {
1631
- "description": "Creates a workspace with stricter type checking and stricter bundle budgets settings. This setting helps improve maintainability and catch bugs ahead of time. For more information, see https://angular.io/guide/strict-mode",
1631
+ "description": "Creates a workspace with stricter type checking and stricter bundle budgets settings. This setting helps improve maintainability and catch bugs ahead of time. For more information, see https://angular.dev/tools/cli/template-typecheck#strict-mode",
1632
1632
  "type": "boolean",
1633
1633
  "default": true
1634
1634
  },
@@ -3683,6 +3683,19 @@
3683
3683
  "type": "number",
3684
3684
  "description": "Enable and define the file watching poll time period in milliseconds."
3685
3685
  },
3686
+ "inspect": {
3687
+ "default": false,
3688
+ "description": "Activate debugging inspector. This option only has an effect when 'SSR' or 'SSG' are enabled.",
3689
+ "oneOf": [
3690
+ {
3691
+ "type": "string",
3692
+ "description": "Activate the inspector on host and port in the format of `[[host:]port]`. See the security warning in https://nodejs.org/docs/latest-v22.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure regarding the host parameter usage."
3693
+ },
3694
+ {
3695
+ "type": "boolean"
3696
+ }
3697
+ ]
3698
+ },
3686
3699
  "prebundle": {
3687
3700
  "description": "Enable and control the Vite-based development server's prebundling capabilities. To enable prebundling, the Angular CLI cache must also be enabled.",
3688
3701
  "default": true,
@@ -3811,6 +3824,19 @@
3811
3824
  "type": "number",
3812
3825
  "description": "Enable and define the file watching poll time period in milliseconds."
3813
3826
  },
3827
+ "inspect": {
3828
+ "default": false,
3829
+ "description": "Activate debugging inspector. This option only has an effect when 'SSR' or 'SSG' are enabled.",
3830
+ "oneOf": [
3831
+ {
3832
+ "type": "string",
3833
+ "description": "Activate the inspector on host and port in the format of `[[host:]port]`. See the security warning in https://nodejs.org/docs/latest-v22.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure regarding the host parameter usage."
3834
+ },
3835
+ {
3836
+ "type": "boolean"
3837
+ }
3838
+ ]
3839
+ },
3814
3840
  "forceEsbuild": {
3815
3841
  "type": "boolean",
3816
3842
  "description": "Force the development server to use the 'browser-esbuild' builder when building. This is a developer preview option for the esbuild-based build system.",
@@ -599,7 +599,7 @@ export interface AngularNgNewOptionsSchema {
599
599
  /**
600
600
  * Creates a workspace with stricter type checking and stricter bundle budgets settings.
601
601
  * This setting helps improve maintainability and catch bugs ahead of time. For more
602
- * information, see https://angular.io/guide/strict-mode
602
+ * information, see https://angular.dev/tools/cli/template-typecheck#strict-mode
603
603
  */
604
604
  strict?: boolean;
605
605
  /**
package/lib/init.d.ts CHANGED
@@ -3,6 +3,6 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import 'symbol-observable';
package/lib/init.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "18.1.0-next.0",
3
+ "version": "18.1.0-next.2",
4
4
  "description": "CLI tool for Angular",
5
5
  "main": "lib/cli/index.js",
6
6
  "bin": {
@@ -25,14 +25,14 @@
25
25
  },
26
26
  "homepage": "https://github.com/angular/angular-cli",
27
27
  "dependencies": {
28
- "@angular-devkit/architect": "0.1801.0-next.0",
29
- "@angular-devkit/core": "18.1.0-next.0",
30
- "@angular-devkit/schematics": "18.1.0-next.0",
31
- "@schematics/angular": "18.1.0-next.0",
28
+ "@angular-devkit/architect": "0.1801.0-next.2",
29
+ "@angular-devkit/core": "18.1.0-next.2",
30
+ "@angular-devkit/schematics": "18.1.0-next.2",
31
+ "@inquirer/prompts": "5.0.5",
32
+ "@schematics/angular": "18.1.0-next.2",
32
33
  "@yarnpkg/lockfile": "1.1.0",
33
34
  "ansi-colors": "4.1.3",
34
35
  "ini": "4.1.3",
35
- "inquirer": "9.2.22",
36
36
  "jsonc-parser": "3.2.1",
37
37
  "npm-package-arg": "11.0.2",
38
38
  "npm-pick-manifest": "9.0.1",
@@ -46,19 +46,28 @@
46
46
  "ng-update": {
47
47
  "migrations": "@schematics/angular/migrations/migration-collection.json",
48
48
  "packageGroup": {
49
- "@angular/cli": "18.1.0-next.0",
50
- "@angular/build": "18.1.0-next.0",
51
- "@angular/ssr": "18.1.0-next.0",
52
- "@angular-devkit/architect": "0.1801.0-next.0",
53
- "@angular-devkit/build-angular": "18.1.0-next.0",
54
- "@angular-devkit/build-webpack": "0.1801.0-next.0",
55
- "@angular-devkit/core": "18.1.0-next.0",
56
- "@angular-devkit/schematics": "18.1.0-next.0"
49
+ "@angular/cli": "18.1.0-next.2",
50
+ "@angular/build": "18.1.0-next.2",
51
+ "@angular/ssr": "18.1.0-next.2",
52
+ "@angular-devkit/architect": "0.1801.0-next.2",
53
+ "@angular-devkit/build-angular": "18.1.0-next.2",
54
+ "@angular-devkit/build-webpack": "0.1801.0-next.2",
55
+ "@angular-devkit/core": "18.1.0-next.2",
56
+ "@angular-devkit/schematics": "18.1.0-next.2"
57
57
  }
58
58
  },
59
+ "packageManager": "yarn@4.2.2",
59
60
  "engines": {
60
61
  "node": "^18.19.1 || ^20.11.1 || >=22.0.0",
61
62
  "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
62
63
  "yarn": ">= 1.13.0"
64
+ },
65
+ "dependenciesMeta": {
66
+ "esbuild": {
67
+ "built": true
68
+ },
69
+ "puppeteer": {
70
+ "built": true
71
+ }
63
72
  }
64
73
  }
@@ -3,7 +3,7 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import type { CommandContext } from '../command-builder/command-module';
9
9
  import { EventCustomDimension, EventCustomMetric, PrimitiveTypes } from './analytics-parameters';
@@ -4,7 +4,7 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
@@ -3,7 +3,7 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  /** Any changes in this file needs to be done in the mts version. */
9
9
  export type PrimitiveTypes = string | number | boolean;
@@ -4,7 +4,7 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.EventCustomMetric = exports.EventCustomDimension = exports.UserCustomDimension = exports.RequestParameter = void 0;
@@ -3,7 +3,7 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import type { CommandContext } from '../command-builder/command-module';
9
9
  /**
@@ -4,10 +4,15 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.getAnalyticsInfoString = exports.getAnalyticsUserId = exports.promptAnalytics = exports.setAnalyticsConfig = exports.isPackageNameSafeForAnalytics = exports.analyticsPackageSafelist = void 0;
10
+ exports.analyticsPackageSafelist = void 0;
11
+ exports.isPackageNameSafeForAnalytics = isPackageNameSafeForAnalytics;
12
+ exports.setAnalyticsConfig = setAnalyticsConfig;
13
+ exports.promptAnalytics = promptAnalytics;
14
+ exports.getAnalyticsUserId = getAnalyticsUserId;
15
+ exports.getAnalyticsInfoString = getAnalyticsInfoString;
11
16
  const core_1 = require("@angular-devkit/core");
12
17
  const crypto_1 = require("crypto");
13
18
  const color_1 = require("../utilities/color");
@@ -35,7 +40,6 @@ function isPackageNameSafeForAnalytics(name) {
35
40
  }
36
41
  });
37
42
  }
38
- exports.isPackageNameSafeForAnalytics = isPackageNameSafeForAnalytics;
39
43
  /**
40
44
  * Set analytics settings. This does not work if the user is not inside a project.
41
45
  * @param global Which config to use. "global" for user-level, and "local" for project-level.
@@ -54,7 +58,6 @@ async function setAnalyticsConfig(global, value) {
54
58
  cli.analytics = value === true ? (0, crypto_1.randomUUID)() : value;
55
59
  await workspace.save();
56
60
  }
57
- exports.setAnalyticsConfig = setAnalyticsConfig;
58
61
  /**
59
62
  * Prompt the user for usage gathering permission.
60
63
  * @param force Whether to ask regardless of whether or not the user is using an interactive shell.
@@ -89,7 +92,6 @@ details and how to change this setting, see https://angular.dev/cli/analytics.
89
92
  }
90
93
  return false;
91
94
  }
92
- exports.promptAnalytics = promptAnalytics;
93
95
  /**
94
96
  * Get the analytics user id.
95
97
  *
@@ -154,7 +156,6 @@ async function getAnalyticsUserId(context, skipPrompt = false) {
154
156
  }
155
157
  return globalConfig;
156
158
  }
157
- exports.getAnalyticsUserId = getAnalyticsUserId;
158
159
  function analyticsConfigValueToHumanFormat(value) {
159
160
  if (value === false) {
160
161
  return 'disabled';
@@ -179,4 +180,3 @@ async function getAnalyticsInfoString(context) {
179
180
  Effective status: ${analyticsInstance ? 'enabled' : 'disabled'}
180
181
  ` + '\n');
181
182
  }
182
- exports.getAnalyticsInfoString = getAnalyticsInfoString;
@@ -3,7 +3,7 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { Architect, Target } from '@angular-devkit/architect';
9
9
  import { WorkspaceNodeModulesArchitectHost } from '@angular-devkit/architect/node';
@@ -4,7 +4,7 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
@@ -3,7 +3,7 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { Argv } from 'yargs';
9
9
  import { ArchitectBaseCommandModule } from './architect-base-command-module';
@@ -4,7 +4,7 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
10
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3,7 +3,7 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { logging } from '@angular-devkit/core';
9
9
  import { ArgumentsCamelCase, Argv, CamelCaseKey, CommandModule as YargsCommandModule } from 'yargs';
@@ -4,7 +4,7 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
@@ -3,7 +3,7 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { logging } from '@angular-devkit/core';
9
9
  export declare function runCommand(args: string[], logger: logging.Logger): Promise<number>;
@@ -4,13 +4,13 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  var __importDefault = (this && this.__importDefault) || function (mod) {
10
10
  return (mod && mod.__esModule) ? mod : { "default": mod };
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.runCommand = void 0;
13
+ exports.runCommand = runCommand;
14
14
  const yargs_1 = __importDefault(require("yargs"));
15
15
  const helpers_1 = require("yargs/helpers");
16
16
  const command_config_1 = require("../commands/command-config");
@@ -119,7 +119,6 @@ async function runCommand(args, logger) {
119
119
  .parseAsync();
120
120
  return process.exitCode ?? 0;
121
121
  }
122
- exports.runCommand = runCommand;
123
122
  /**
124
123
  * Get the commands that need to be registered.
125
124
  * @returns One or more command factories that needs to be registered.
@@ -3,7 +3,7 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { Collection } from '@angular-devkit/schematics';
9
9
  import { FileSystemCollectionDescription, FileSystemSchematicDescription, NodeWorkflow } from '@angular-devkit/schematics/tools';
@@ -4,14 +4,37 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
9
25
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
26
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
27
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
28
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
29
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
30
  };
31
+ var __importStar = (this && this.__importStar) || function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
15
38
  var __metadata = (this && this.__metadata) || function (k, v) {
16
39
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
17
40
  };
@@ -25,7 +48,6 @@ const analytics_1 = require("../analytics/analytics");
25
48
  const analytics_parameters_1 = require("../analytics/analytics-parameters");
26
49
  const config_1 = require("../utilities/config");
27
50
  const error_1 = require("../utilities/error");
28
- const load_esm_1 = require("../utilities/load-esm");
29
51
  const memoize_1 = require("../utilities/memoize");
30
52
  const tty_1 = require("../utilities/tty");
31
53
  const command_module_1 = require("./command-module");
@@ -124,70 +146,85 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
124
146
  });
125
147
  if (options.interactive !== false && (0, tty_1.isTTY)()) {
126
148
  workflow.registry.usePromptProvider(async (definitions) => {
127
- const questions = definitions
128
- .filter((definition) => !options.defaults || definition.default === undefined)
129
- .map((definition) => {
130
- const question = {
131
- name: definition.id,
132
- message: definition.message,
133
- default: definition.default,
134
- };
135
- const validator = definition.validator;
136
- if (validator) {
137
- question.validate = (input) => validator(input);
138
- // Filter allows transformation of the value prior to validation
139
- question.filter = async (input) => {
140
- for (const type of definition.propertyTypes) {
141
- let value;
142
- switch (type) {
143
- case 'string':
144
- value = String(input);
145
- break;
146
- case 'integer':
147
- case 'number':
148
- value = Number(input);
149
- break;
150
- default:
151
- value = input;
152
- break;
153
- }
154
- // Can be a string if validation fails
155
- const isValid = (await validator(value)) === true;
156
- if (isValid) {
157
- return value;
158
- }
159
- }
160
- return input;
161
- };
149
+ let prompts;
150
+ const answers = {};
151
+ for (const definition of definitions) {
152
+ if (options.defaults && definition.default !== undefined) {
153
+ continue;
162
154
  }
155
+ // Only load prompt package if needed
156
+ prompts ??= await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
163
157
  switch (definition.type) {
164
158
  case 'confirmation':
165
- question.type = 'confirm';
159
+ answers[definition.id] = await prompts.confirm({
160
+ message: definition.message,
161
+ default: definition.default,
162
+ });
166
163
  break;
167
164
  case 'list':
168
- question.type = definition.multiselect ? 'checkbox' : 'list';
169
- question.choices = definition.items?.map((item) => {
165
+ if (!definition.items?.length) {
166
+ continue;
167
+ }
168
+ const choices = definition.items?.map((item) => {
170
169
  return typeof item == 'string'
171
- ? item
170
+ ? {
171
+ name: item,
172
+ value: item,
173
+ }
172
174
  : {
173
175
  name: item.label,
174
176
  value: item.value,
175
177
  };
176
178
  });
179
+ answers[definition.id] = await (definition.multiselect ? prompts.checkbox : prompts.select)({
180
+ message: definition.message,
181
+ default: definition.default,
182
+ choices,
183
+ });
177
184
  break;
178
- default:
179
- question.type = definition.type;
185
+ case 'input':
186
+ let finalValue;
187
+ answers[definition.id] = await prompts.input({
188
+ message: definition.message,
189
+ default: definition.default,
190
+ async validate(value) {
191
+ if (definition.validator === undefined) {
192
+ return true;
193
+ }
194
+ let lastValidation = false;
195
+ for (const type of definition.propertyTypes) {
196
+ let potential;
197
+ switch (type) {
198
+ case 'string':
199
+ potential = String(value);
200
+ break;
201
+ case 'integer':
202
+ case 'number':
203
+ potential = Number(value);
204
+ break;
205
+ default:
206
+ potential = value;
207
+ break;
208
+ }
209
+ lastValidation = await definition.validator(potential);
210
+ // Can be a string if validation fails
211
+ if (lastValidation === true) {
212
+ finalValue = potential;
213
+ return true;
214
+ }
215
+ }
216
+ return lastValidation;
217
+ },
218
+ });
219
+ // Use validated value if present.
220
+ // This ensures the correct type is inserted into the final schema options.
221
+ if (finalValue !== undefined) {
222
+ answers[definition.id] = finalValue;
223
+ }
180
224
  break;
181
225
  }
182
- return question;
183
- });
184
- if (questions.length) {
185
- const { default: inquirer } = await (0, load_esm_1.loadEsmModule)('inquirer');
186
- return inquirer.prompt(questions);
187
- }
188
- else {
189
- return {};
190
226
  }
227
+ return answers;
191
228
  });
192
229
  }
193
230
  return workflow;
@@ -3,7 +3,7 @@
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  *
5
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
6
+ * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { Argv } from 'yargs';
9
9
  import { CommandContext, CommandModule, CommandModuleImplementation } from '../command-module';
@@ -4,10 +4,11 @@
4
4
  * Copyright Google LLC All Rights Reserved.
5
5
  *
6
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
7
+ * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.addCommandModuleToYargs = exports.demandCommandFailureMessage = void 0;
10
+ exports.demandCommandFailureMessage = void 0;
11
+ exports.addCommandModuleToYargs = addCommandModuleToYargs;
11
12
  const command_module_1 = require("../command-module");
12
13
  exports.demandCommandFailureMessage = `You need to specify a command before moving on. Use '--help' to view the available commands.`;
13
14
  function addCommandModuleToYargs(localYargs, commandModule, context) {
@@ -35,4 +36,3 @@ function addCommandModuleToYargs(localYargs, commandModule, context) {
35
36
  handler: (args) => cmd.handler(args),
36
37
  });
37
38
  }
38
- exports.addCommandModuleToYargs = addCommandModuleToYargs;