@angular/cli 14.0.0-next.3 → 14.0.0-next.6

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 (217) hide show
  1. package/bin/ng.js +3 -5
  2. package/bin/postinstall/analytics-prompt.js +3 -3
  3. package/lib/cli/index.d.ts +1 -1
  4. package/lib/cli/index.js +16 -18
  5. package/lib/config/schema.json +8 -12
  6. package/lib/config/workspace-schema.d.ts +1 -1
  7. package/lib/init.js +8 -4
  8. package/package.json +17 -16
  9. package/{models → src/analytics}/analytics-collector.d.ts +0 -0
  10. package/{models → src/analytics}/analytics-collector.js +6 -2
  11. package/src/analytics/analytics-environment-options.d.ts +9 -0
  12. package/src/analytics/analytics-environment-options.js +20 -0
  13. package/src/analytics/analytics.d.ts +47 -0
  14. package/src/analytics/analytics.js +303 -0
  15. package/src/command-builder/architect-base-command-module.d.ts +23 -0
  16. package/src/command-builder/architect-base-command-module.js +103 -0
  17. package/src/command-builder/architect-command-module.d.ts +22 -0
  18. package/src/command-builder/architect-command-module.js +108 -0
  19. package/src/command-builder/command-module.d.ts +88 -0
  20. package/src/command-builder/command-module.js +191 -0
  21. package/src/command-builder/command-runner.d.ts +10 -0
  22. package/src/command-builder/command-runner.js +135 -0
  23. package/src/command-builder/schematics-command-module.d.ts +44 -0
  24. package/src/command-builder/schematics-command-module.js +295 -0
  25. package/src/command-builder/utilities/command.d.ts +13 -0
  26. package/src/command-builder/utilities/command.js +27 -0
  27. package/src/command-builder/utilities/json-help.d.ts +36 -0
  28. package/src/command-builder/utilities/json-help.js +94 -0
  29. package/src/command-builder/utilities/json-schema.d.ts +40 -0
  30. package/{utilities → src/command-builder/utilities}/json-schema.js +20 -121
  31. package/{models → src/command-builder/utilities}/schematic-engine-host.d.ts +0 -0
  32. package/{models → src/command-builder/utilities}/schematic-engine-host.js +0 -0
  33. package/src/command-builder/utilities/schematic-workflow.d.ts +14 -0
  34. package/src/command-builder/utilities/schematic-workflow.js +68 -0
  35. package/src/commands/add/cli.d.ts +33 -0
  36. package/{commands/add-impl.js → src/commands/add/cli.js} +100 -72
  37. package/{commands/add.md → src/commands/add/long-description.md} +0 -0
  38. package/src/commands/analytics/cli.d.ts +16 -0
  39. package/src/commands/analytics/cli.js +35 -0
  40. package/src/commands/analytics/info/cli.d.ts +16 -0
  41. package/src/commands/analytics/info/cli.js +26 -0
  42. package/src/commands/analytics/settings/cli.d.ts +35 -0
  43. package/src/commands/analytics/settings/cli.js +61 -0
  44. package/src/commands/build/cli.d.ts +16 -0
  45. package/src/commands/build/cli.js +23 -0
  46. package/{commands/build-long.md → src/commands/build/long-description.md} +0 -0
  47. package/src/commands/config/cli.d.ts +24 -0
  48. package/{commands/config-impl.js → src/commands/config/cli.js} +102 -89
  49. package/{commands/config-long.md → src/commands/config/long-description.md} +2 -2
  50. package/src/commands/deploy/cli.d.ts +16 -0
  51. package/src/commands/deploy/cli.js +35 -0
  52. package/{commands/deploy-long.md → src/commands/deploy/long-description.md} +0 -0
  53. package/src/commands/doc/cli.d.ts +23 -0
  54. package/{commands/doc-impl.js → src/commands/doc/cli.js} +41 -12
  55. package/src/commands/e2e/cli.d.ts +17 -0
  56. package/src/commands/e2e/cli.js +34 -0
  57. package/src/commands/extract-i18n/cli.d.ts +15 -0
  58. package/src/commands/extract-i18n/cli.js +20 -0
  59. package/src/commands/generate/cli.d.ts +29 -0
  60. package/src/commands/generate/cli.js +114 -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 +25 -0
  67. package/src/commands/new/cli.js +66 -0
  68. package/src/commands/run/cli.d.ts +23 -0
  69. package/src/commands/run/cli.js +59 -0
  70. package/{commands/run-long.md → src/commands/run/long-description.md} +0 -0
  71. package/src/commands/serve/cli.d.ts +16 -0
  72. package/src/commands/serve/cli.js +21 -0
  73. package/src/commands/test/cli.d.ts +16 -0
  74. package/src/commands/test/cli.js +23 -0
  75. package/{commands/test-long.md → src/commands/test/long-description.md} +0 -0
  76. package/{commands/update-impl.d.ts → src/commands/update/cli.d.ts} +25 -9
  77. package/{commands/update-impl.js → src/commands/update/cli.js} +323 -306
  78. package/{commands/update-long.md → src/commands/update/long-description.md} +0 -0
  79. package/src/commands/update/schematic/index.js +6 -2
  80. package/src/commands/version/cli.d.ts +19 -0
  81. package/{commands/version-impl.js → src/commands/version/cli.js} +57 -56
  82. package/src/typings.d.ts +2 -2
  83. package/{utilities → src/utilities}/color.d.ts +0 -0
  84. package/{utilities → src/utilities}/color.js +5 -1
  85. package/{utilities → src/utilities}/config.d.ts +2 -1
  86. package/{utilities → src/utilities}/config.js +38 -7
  87. package/{utilities → src/utilities}/find-up.d.ts +0 -0
  88. package/{utilities → src/utilities}/find-up.js +5 -1
  89. package/{utilities → src/utilities}/install-package.d.ts +2 -2
  90. package/{utilities → src/utilities}/install-package.js +1 -1
  91. package/{utilities → src/utilities}/json-file.d.ts +0 -0
  92. package/{utilities → src/utilities}/json-file.js +0 -0
  93. package/{utilities → src/utilities}/log-file.d.ts +0 -0
  94. package/{utilities → src/utilities}/log-file.js +0 -0
  95. package/{utilities → src/utilities}/package-json.d.ts +0 -0
  96. package/{utilities → src/utilities}/package-json.js +0 -0
  97. package/{utilities → src/utilities}/package-manager.d.ts +1 -1
  98. package/{utilities → src/utilities}/package-manager.js +1 -1
  99. package/{utilities → src/utilities}/package-metadata.d.ts +0 -0
  100. package/{utilities → src/utilities}/package-metadata.js +5 -1
  101. package/{utilities → src/utilities}/package-tree.d.ts +0 -0
  102. package/{utilities → src/utilities}/package-tree.js +5 -1
  103. package/{utilities → src/utilities}/project.d.ts +0 -0
  104. package/{utilities → src/utilities}/project.js +5 -1
  105. package/{utilities → src/utilities}/prompt.d.ts +0 -0
  106. package/{utilities → src/utilities}/prompt.js +5 -1
  107. package/{utilities → src/utilities}/spinner.d.ts +0 -0
  108. package/{utilities → src/utilities}/spinner.js +0 -0
  109. package/{utilities → src/utilities}/tty.d.ts +0 -0
  110. package/{utilities → src/utilities}/tty.js +0 -0
  111. package/{models → src/utilities}/version.d.ts +2 -1
  112. package/{models → src/utilities}/version.js +6 -6
  113. package/commands/add-impl.d.ts +0 -21
  114. package/commands/add.d.ts +0 -42
  115. package/commands/add.js +0 -10
  116. package/commands/add.json +0 -54
  117. package/commands/analytics-impl.d.ts +0 -13
  118. package/commands/analytics-impl.js +0 -80
  119. package/commands/analytics-long.md +0 -8
  120. package/commands/analytics.d.ts +0 -46
  121. package/commands/analytics.js +0 -31
  122. package/commands/analytics.json +0 -37
  123. package/commands/build-impl.d.ts +0 -14
  124. package/commands/build-impl.js +0 -21
  125. package/commands/build.d.ts +0 -30
  126. package/commands/build.js +0 -10
  127. package/commands/build.json +0 -16
  128. package/commands/config-impl.d.ts +0 -15
  129. package/commands/config.d.ts +0 -34
  130. package/commands/config.js +0 -10
  131. package/commands/config.json +0 -43
  132. package/commands/definitions.json +0 -66
  133. package/commands/deploy-impl.d.ts +0 -15
  134. package/commands/deploy-impl.js +0 -36
  135. package/commands/deploy.d.ts +0 -30
  136. package/commands/deploy.js +0 -10
  137. package/commands/deploy.json +0 -34
  138. package/commands/doc-impl.d.ts +0 -13
  139. package/commands/doc.d.ts +0 -39
  140. package/commands/doc.js +0 -14
  141. package/commands/doc.json +0 -46
  142. package/commands/e2e-impl.d.ts +0 -16
  143. package/commands/e2e-impl.js +0 -36
  144. package/commands/e2e-long.md +0 -4
  145. package/commands/e2e.d.ts +0 -29
  146. package/commands/e2e.js +0 -10
  147. package/commands/e2e.json +0 -17
  148. package/commands/easter-egg-impl.d.ts +0 -12
  149. package/commands/easter-egg.d.ts +0 -14
  150. package/commands/easter-egg.js +0 -10
  151. package/commands/easter-egg.json +0 -12
  152. package/commands/extract-i18n-impl.d.ts +0 -14
  153. package/commands/extract-i18n-impl.js +0 -21
  154. package/commands/extract-i18n.d.ts +0 -29
  155. package/commands/extract-i18n.js +0 -10
  156. package/commands/extract-i18n.json +0 -15
  157. package/commands/generate-impl.d.ts +0 -18
  158. package/commands/generate-impl.js +0 -89
  159. package/commands/generate.d.ts +0 -37
  160. package/commands/generate.js +0 -10
  161. package/commands/generate.json +0 -31
  162. package/commands/help-impl.d.ts +0 -12
  163. package/commands/help-impl.js +0 -26
  164. package/commands/help-long.md +0 -7
  165. package/commands/help.d.ts +0 -17
  166. package/commands/help.js +0 -10
  167. package/commands/help.json +0 -13
  168. package/commands/lint-impl.d.ts +0 -16
  169. package/commands/lint-impl.js +0 -69
  170. package/commands/lint.d.ts +0 -29
  171. package/commands/lint.js +0 -10
  172. package/commands/lint.json +0 -36
  173. package/commands/new-impl.d.ts +0 -16
  174. package/commands/new-impl.js +0 -37
  175. package/commands/new.d.ts +0 -41
  176. package/commands/new.js +0 -10
  177. package/commands/new.json +0 -34
  178. package/commands/new.md +0 -16
  179. package/commands/run-impl.d.ts +0 -13
  180. package/commands/run-impl.js +0 -22
  181. package/commands/run.d.ts +0 -30
  182. package/commands/run.js +0 -10
  183. package/commands/run.json +0 -36
  184. package/commands/serve-impl.d.ts +0 -15
  185. package/commands/serve-impl.js +0 -24
  186. package/commands/serve.d.ts +0 -29
  187. package/commands/serve.js +0 -10
  188. package/commands/serve.json +0 -17
  189. package/commands/test-impl.d.ts +0 -15
  190. package/commands/test-impl.js +0 -22
  191. package/commands/test.d.ts +0 -29
  192. package/commands/test.js +0 -10
  193. package/commands/test.json +0 -17
  194. package/commands/update.d.ts +0 -61
  195. package/commands/update.js +0 -10
  196. package/commands/update.json +0 -78
  197. package/commands/version-impl.d.ts +0 -17
  198. package/commands/version.d.ts +0 -17
  199. package/commands/version.js +0 -10
  200. package/commands/version.json +0 -13
  201. package/commands.json +0 -20
  202. package/models/analytics.d.ts +0 -58
  203. package/models/analytics.js +0 -358
  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/command.d.ts +0 -34
  209. package/models/command.js +0 -143
  210. package/models/interface.d.ts +0 -196
  211. package/models/interface.js +0 -31
  212. package/models/parser.d.ts +0 -39
  213. package/models/parser.js +0 -349
  214. package/models/schematic-command.d.ts +0 -55
  215. package/models/schematic-command.js +0 -485
  216. package/utilities/INITIAL_COMMIT_MESSAGE.txt +0 -8
  217. package/utilities/json-schema.d.ts +0 -17
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -31,7 +35,7 @@ const core_1 = require("@angular-devkit/core");
31
35
  const schematics_1 = require("@angular-devkit/schematics");
32
36
  const npa = __importStar(require("npm-package-arg"));
33
37
  const semver = __importStar(require("semver"));
34
- const package_metadata_1 = require("../../../../utilities/package-metadata");
38
+ const package_metadata_1 = require("../../../utilities/package-metadata");
35
39
  // Angular guarantees that a major is compatible with its following major (so packages that depend
36
40
  // on Angular 5 are also compatible with Angular 6). This is, in code, represented by verifying
37
41
  // that all other packages that have a peer dependency of `"@angular/core": "^5.0.0"` actually
@@ -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
+ }
@@ -10,59 +10,63 @@ 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.VersionCommand = void 0;
13
+ exports.VersionCommandModule = void 0;
14
14
  const child_process_1 = require("child_process");
15
15
  const module_1 = __importDefault(require("module"));
16
- const command_1 = require("../models/command");
17
- const color_1 = require("../utilities/color");
18
- const package_manager_1 = require("../utilities/package-manager");
16
+ const path_1 = require("path");
17
+ const command_module_1 = require("../../command-builder/command-module");
18
+ const color_1 = require("../../utilities/color");
19
19
  /**
20
20
  * Major versions of Node.js that are officially supported by Angular.
21
21
  */
22
- const SUPPORTED_NODE_MAJORS = [12, 14, 16];
23
- class VersionCommand extends command_1.Command {
22
+ const SUPPORTED_NODE_MAJORS = [14, 16];
23
+ const PACKAGE_PATTERNS = [
24
+ /^@angular\/.*/,
25
+ /^@angular-devkit\/.*/,
26
+ /^@bazel\/.*/,
27
+ /^@ngtools\/.*/,
28
+ /^@nguniversal\/.*/,
29
+ /^@schematics\/.*/,
30
+ /^rxjs$/,
31
+ /^typescript$/,
32
+ /^ng-packagr$/,
33
+ /^webpack$/,
34
+ ];
35
+ class VersionCommandModule extends command_module_1.CommandModule {
24
36
  constructor() {
25
37
  super(...arguments);
26
- this.localRequire = module_1.default.createRequire(__filename);
27
- // Trailing slash is used to allow the path to be treated as a directory
28
- this.workspaceRequire = module_1.default.createRequire(this.context.root + '/');
38
+ this.command = 'version';
39
+ this.aliases = ['v'];
40
+ this.describe = 'Outputs Angular CLI version.';
41
+ }
42
+ builder(localYargs) {
43
+ return localYargs;
29
44
  }
30
45
  async run() {
31
- const cliPackage = this.localRequire('../package.json');
46
+ const logger = this.context.logger;
47
+ const localRequire = module_1.default.createRequire((0, path_1.resolve)(__filename, '../../../'));
48
+ // Trailing slash is used to allow the path to be treated as a directory
49
+ const workspaceRequire = module_1.default.createRequire(this.context.root + '/');
50
+ const cliPackage = localRequire('./package.json');
32
51
  let workspacePackage;
33
52
  try {
34
- workspacePackage = this.workspaceRequire('./package.json');
53
+ workspacePackage = workspaceRequire('./package.json');
35
54
  }
36
55
  catch { }
37
56
  const [nodeMajor] = process.versions.node.split('.').map((part) => Number(part));
38
57
  const unsupportedNodeVersion = !SUPPORTED_NODE_MAJORS.includes(nodeMajor);
39
- const patterns = [
40
- /^@angular\/.*/,
41
- /^@angular-devkit\/.*/,
42
- /^@bazel\/.*/,
43
- /^@ngtools\/.*/,
44
- /^@nguniversal\/.*/,
45
- /^@schematics\/.*/,
46
- /^rxjs$/,
47
- /^typescript$/,
48
- /^ng-packagr$/,
49
- /^webpack$/,
50
- ];
51
- const packageNames = [
52
- ...Object.keys(cliPackage.dependencies || {}),
53
- ...Object.keys(cliPackage.devDependencies || {}),
54
- ...Object.keys((workspacePackage === null || workspacePackage === void 0 ? void 0 : workspacePackage.dependencies) || {}),
55
- ...Object.keys((workspacePackage === null || workspacePackage === void 0 ? void 0 : workspacePackage.devDependencies) || {}),
56
- ];
57
- const versions = packageNames
58
- .filter((x) => patterns.some((p) => p.test(x)))
59
- .reduce((acc, name) => {
60
- if (name in acc) {
61
- return acc;
58
+ const packageNames = new Set(Object.keys({
59
+ ...cliPackage.dependencies,
60
+ ...cliPackage.devDependencies,
61
+ ...workspacePackage === null || workspacePackage === void 0 ? void 0 : workspacePackage.dependencies,
62
+ ...workspacePackage === null || workspacePackage === void 0 ? void 0 : workspacePackage.devDependencies,
63
+ }));
64
+ const versions = {};
65
+ for (const name of packageNames) {
66
+ if (PACKAGE_PATTERNS.some((p) => p.test(name))) {
67
+ versions[name] = this.getVersion(name, workspaceRequire, localRequire);
62
68
  }
63
- acc[name] = this.getVersion(name);
64
- return acc;
65
- }, {});
69
+ }
66
70
  const ngCliVersion = cliPackage.version;
67
71
  let angularCoreVersion = '';
68
72
  const angularSameAsCore = [];
@@ -70,11 +74,10 @@ class VersionCommand extends command_1.Command {
70
74
  // Filter all angular versions that are the same as core.
71
75
  angularCoreVersion = versions['@angular/core'];
72
76
  if (angularCoreVersion) {
73
- for (const angularPackage of Object.keys(versions)) {
74
- if (versions[angularPackage] == angularCoreVersion &&
75
- angularPackage.startsWith('@angular/')) {
76
- angularSameAsCore.push(angularPackage.replace(/^@angular\//, ''));
77
- delete versions[angularPackage];
77
+ for (const [name, version] of Object.entries(versions)) {
78
+ if (version === angularCoreVersion && name.startsWith('@angular/')) {
79
+ angularSameAsCore.push(name.replace(/^@angular\//, ''));
80
+ delete versions[name];
78
81
  }
79
82
  }
80
83
  // Make sure we list them in alphabetical order.
@@ -93,11 +96,11 @@ class VersionCommand extends command_1.Command {
93
96
  .split('\n')
94
97
  .map((x) => color_1.colors.red(x))
95
98
  .join('\n');
96
- this.logger.info(asciiArt);
97
- this.logger.info(`
99
+ logger.info(asciiArt);
100
+ logger.info(`
98
101
  Angular CLI: ${ngCliVersion}
99
102
  Node: ${process.versions.node}${unsupportedNodeVersion ? ' (Unsupported)' : ''}
100
- Package Manager: ${await this.getPackageManager()}
103
+ Package Manager: ${this.getPackageManagerVersion()}
101
104
  OS: ${process.platform} ${process.arch}
102
105
 
103
106
  Angular: ${angularCoreVersion}
@@ -126,38 +129,37 @@ class VersionCommand extends command_1.Command {
126
129
  .join('\n')}
127
130
  `.replace(/^ {6}/gm, ''));
128
131
  if (unsupportedNodeVersion) {
129
- this.logger.warn(`Warning: The current version of Node (${process.versions.node}) is not supported by Angular.`);
132
+ logger.warn(`Warning: The current version of Node (${process.versions.node}) is not supported by Angular.`);
130
133
  }
131
134
  }
132
- getVersion(moduleName) {
135
+ getVersion(moduleName, workspaceRequire, localRequire) {
133
136
  let packageInfo;
134
137
  let cliOnly = false;
135
138
  // Try to find the package in the workspace
136
139
  try {
137
- packageInfo = this.workspaceRequire(`${moduleName}/package.json`);
140
+ packageInfo = workspaceRequire(`${moduleName}/package.json`);
138
141
  }
139
142
  catch { }
140
143
  // If not found, try to find within the CLI
141
144
  if (!packageInfo) {
142
145
  try {
143
- packageInfo = this.localRequire(`${moduleName}/package.json`);
146
+ packageInfo = localRequire(`${moduleName}/package.json`);
144
147
  cliOnly = true;
145
148
  }
146
149
  catch { }
147
150
  }
148
- let version;
149
151
  // If found, attempt to get the version
150
152
  if (packageInfo) {
151
153
  try {
152
- version = packageInfo.version + (cliOnly ? ' (cli-only)' : '');
154
+ return packageInfo.version + (cliOnly ? ' (cli-only)' : '');
153
155
  }
154
156
  catch { }
155
157
  }
156
- return version || '<error>';
158
+ return '<error>';
157
159
  }
158
- async getPackageManager() {
160
+ getPackageManagerVersion() {
159
161
  try {
160
- const manager = await (0, package_manager_1.getPackageManager)(this.context.root);
162
+ const manager = this.context.packageManager;
161
163
  const version = (0, child_process_1.execSync)(`${manager} --version`, {
162
164
  encoding: 'utf8',
163
165
  stdio: ['ignore', 'pipe', 'ignore'],
@@ -175,5 +177,4 @@ class VersionCommand extends command_1.Command {
175
177
  }
176
178
  }
177
179
  }
178
- exports.VersionCommand = VersionCommand;
179
- VersionCommand.aliases = ['v'];
180
+ exports.VersionCommandModule = VersionCommandModule;
package/src/typings.d.ts CHANGED
@@ -12,7 +12,7 @@ declare module 'ini' {
12
12
  function parse(data: string): Record<string, any>;
13
13
  }
14
14
  declare module 'npm-pick-manifest' {
15
- function pickManifest(metadata: import('../utilities/package-metadata').PackageMetadata, selector: string): import('../utilities/package-metadata').PackageManifest;
15
+ function pickManifest(metadata: import('./utilities/package-metadata').PackageMetadata, selector: string): import('./utilities/package-metadata').PackageManifest;
16
16
  export = pickManifest;
17
17
  }
18
18
  declare module 'pacote' {
@@ -20,5 +20,5 @@ declare module 'pacote' {
20
20
  name: string;
21
21
  version: string;
22
22
  }>;
23
- function packument(specifier: string, options: Record<string, unknown>): Promise<import('../utilities/package-metadata').NpmRepositoryPackageJson>;
23
+ function packument(specifier: string, options: Record<string, unknown>): Promise<import('./utilities/package-metadata').NpmRepositoryPackageJson>;
24
24
  }
File without changes
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -6,7 +6,7 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { json, workspaces } from '@angular-devkit/core';
9
- import { PackageManager } from '../lib/config/workspace-schema';
9
+ import { PackageManager } from '../../lib/config/workspace-schema';
10
10
  import { JSONFile } from './json-file';
11
11
  export declare const workspaceSchemaPath: string;
12
12
  export declare class AngularWorkspace {
@@ -28,3 +28,4 @@ export declare function getProjectByCwd(workspace: AngularWorkspace): string | n
28
28
  export declare function getConfiguredPackageManager(): Promise<PackageManager | null>;
29
29
  export declare function getSchematicDefaults(collection: string, schematic: string, project?: string | null): Promise<{}>;
30
30
  export declare function isWarningEnabled(warning: string): Promise<boolean>;
31
+ export declare function getProjectsByPath(workspace: workspaces.WorkspaceDefinition, cwd: string, root: string): string[];
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -26,7 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
30
  return result;
27
31
  };
28
32
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.isWarningEnabled = exports.getSchematicDefaults = exports.getConfiguredPackageManager = exports.getProjectByCwd = exports.validateWorkspace = exports.getWorkspaceRaw = exports.createGlobalSettings = exports.getWorkspace = exports.AngularWorkspace = exports.workspaceSchemaPath = void 0;
33
+ exports.getProjectsByPath = exports.isWarningEnabled = exports.getSchematicDefaults = exports.getConfiguredPackageManager = exports.getProjectByCwd = exports.validateWorkspace = exports.getWorkspaceRaw = exports.createGlobalSettings = exports.getWorkspace = exports.AngularWorkspace = exports.workspaceSchemaPath = void 0;
30
34
  const core_1 = require("@angular-devkit/core");
31
35
  const fs_1 = require("fs");
32
36
  const os = __importStar(require("os"));
@@ -62,10 +66,7 @@ function createWorkspaceHost() {
62
66
  },
63
67
  };
64
68
  }
65
- function getSchemaLocation() {
66
- return path.join(__dirname, '../lib/config/schema.json');
67
- }
68
- exports.workspaceSchemaPath = getSchemaLocation();
69
+ exports.workspaceSchemaPath = path.join(__dirname, '../../lib/config/schema.json');
69
70
  const configNames = ['angular.json', '.angular.json'];
70
71
  const globalFileName = '.angular-config.json';
71
72
  function xdgConfigHome(home, configFile) {
@@ -190,7 +191,7 @@ function getWorkspaceRaw(level = 'local') {
190
191
  }
191
192
  exports.getWorkspaceRaw = getWorkspaceRaw;
192
193
  async function validateWorkspace(data) {
193
- const schema = (0, json_file_1.readAndParseJson)(path.join(__dirname, '../lib/config/schema.json'));
194
+ const schema = (0, json_file_1.readAndParseJson)(exports.workspaceSchemaPath);
194
195
  const { formats } = await Promise.resolve().then(() => __importStar(require('@angular-devkit/schematics')));
195
196
  const registry = new core_1.json.schema.CoreSchemaRegistry(formats.standardFormats);
196
197
  const validator = await registry.compile(schema).toPromise();
@@ -340,3 +341,33 @@ async function isWarningEnabled(warning) {
340
341
  return result !== null && result !== void 0 ? result : true;
341
342
  }
342
343
  exports.isWarningEnabled = isWarningEnabled;
344
+ function getProjectsByPath(workspace, cwd, root) {
345
+ if (workspace.projects.size === 1) {
346
+ return Array.from(workspace.projects.keys());
347
+ }
348
+ const isInside = (base, potential) => {
349
+ const absoluteBase = path.resolve(root, base);
350
+ const absolutePotential = path.resolve(root, potential);
351
+ const relativePotential = path.relative(absoluteBase, absolutePotential);
352
+ if (!relativePotential.startsWith('..') && !path.isAbsolute(relativePotential)) {
353
+ return true;
354
+ }
355
+ return false;
356
+ };
357
+ const projects = Array.from(workspace.projects.entries())
358
+ .map(([name, project]) => [path.resolve(root, project.root), name])
359
+ .filter((tuple) => isInside(tuple[0], cwd))
360
+ // Sort tuples by depth, with the deeper ones first. Since the first member is a path and
361
+ // we filtered all invalid paths, the longest will be the deepest (and in case of equality
362
+ // the sort is stable and the first declared project will win).
363
+ .sort((a, b) => b[0].length - a[0].length);
364
+ if (projects.length === 1) {
365
+ return [projects[0][1]];
366
+ }
367
+ else if (projects.length > 1) {
368
+ const firstPath = projects[0][0];
369
+ return projects.filter((v) => v[0] === firstPath).map((v) => v[1]);
370
+ }
371
+ return [];
372
+ }
373
+ exports.getProjectsByPath = getProjectsByPath;
File without changes
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
@@ -5,8 +5,8 @@
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 { PackageManager } from '../lib/config/workspace-schema';
9
- import { NgAddSaveDepedency } from '../utilities/package-metadata';
8
+ import { PackageManager } from '../../lib/config/workspace-schema';
9
+ import { NgAddSaveDepedency } from './package-metadata';
10
10
  export declare function installAllPackages(packageManager?: PackageManager, extraArgs?: string[], cwd?: string): Promise<1 | 0>;
11
11
  export declare function installPackage(packageName: string, packageManager?: PackageManager, save?: Exclude<NgAddSaveDepedency, false>, extraArgs?: string[], cwd?: string): Promise<1 | 0>;
12
12
  export declare function installTempPackage(packageName: string, packageManager?: PackageManager, extraArgs?: string[]): Promise<{
@@ -12,7 +12,7 @@ const child_process_1 = require("child_process");
12
12
  const fs_1 = require("fs");
13
13
  const os_1 = require("os");
14
14
  const path_1 = require("path");
15
- const workspace_schema_1 = require("../lib/config/workspace-schema");
15
+ const workspace_schema_1 = require("../../lib/config/workspace-schema");
16
16
  const spinner_1 = require("./spinner");
17
17
  async function installAllPackages(packageManager = workspace_schema_1.PackageManager.Npm, extraArgs = [], cwd = process.cwd()) {
18
18
  const packageManagerArgs = getPackageManagerArguments(packageManager);
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -5,7 +5,7 @@
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 { PackageManager } from '../lib/config/workspace-schema';
8
+ import { PackageManager } from '../../lib/config/workspace-schema';
9
9
  export declare function getPackageManager(root: string): Promise<PackageManager>;
10
10
  /**
11
11
  * Checks if the npm version is a supported 7.x version. If not, display a warning.
@@ -13,7 +13,7 @@ const fs_1 = require("fs");
13
13
  const path_1 = require("path");
14
14
  const semver_1 = require("semver");
15
15
  const util_1 = require("util");
16
- const workspace_schema_1 = require("../lib/config/workspace-schema");
16
+ const workspace_schema_1 = require("../../lib/config/workspace-schema");
17
17
  const config_1 = require("./config");
18
18
  const exec = (0, util_1.promisify)(child_process_1.exec);
19
19
  async function supports(name) {
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
File without changes
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
File without changes
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
File without changes
@@ -8,7 +8,11 @@
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
12
16
  }) : (function(o, m, k, k2) {
13
17
  if (k2 === undefined) k2 = k;
14
18
  o[k2] = m[k];
File without changes
File without changes
File without changes
File without changes
@@ -5,7 +5,7 @@
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
- export declare class Version {
8
+ declare class Version {
9
9
  readonly full: string;
10
10
  readonly major: string;
11
11
  readonly minor: string;
@@ -13,3 +13,4 @@ export declare class Version {
13
13
  constructor(full: string);
14
14
  }
15
15
  export declare const VERSION: Version;
16
+ export {};
@@ -7,19 +7,19 @@
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.VERSION = exports.Version = void 0;
10
+ exports.VERSION = void 0;
11
11
  const fs_1 = require("fs");
12
12
  const path_1 = require("path");
13
13
  // Same structure as used in framework packages
14
14
  class Version {
15
15
  constructor(full) {
16
16
  this.full = full;
17
- this.major = full.split('.')[0];
18
- this.minor = full.split('.')[1];
19
- this.patch = full.split('.').slice(2).join('.');
17
+ const [major, minor, patch] = full.split('-', 1)[0].split('.', 3);
18
+ this.major = major;
19
+ this.minor = minor;
20
+ this.patch = patch;
20
21
  }
21
22
  }
22
- exports.Version = Version;
23
23
  // TODO: Convert this to use build-time version stamping after flipping the build script to use bazel
24
24
  // export const VERSION = new Version('0.0.0-PLACEHOLDER');
25
- exports.VERSION = new Version(JSON.parse((0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../package.json'), 'utf-8')).version);
25
+ exports.VERSION = new Version(JSON.parse((0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../../package.json'), 'utf-8')).version);
@@ -1,21 +0,0 @@
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 { Arguments } from '../models/interface';
9
- import { SchematicCommand } from '../models/schematic-command';
10
- import { Schema as AddCommandSchema } from './add';
11
- export declare class AddCommand extends SchematicCommand<AddCommandSchema> {
12
- readonly allowPrivateSchematics = true;
13
- initialize(options: AddCommandSchema & Arguments): Promise<void>;
14
- run(options: AddCommandSchema & Arguments): Promise<number | void>;
15
- private isProjectVersionValid;
16
- reportAnalytics(paths: string[], options: AddCommandSchema & Arguments, dimensions?: (boolean | number | string)[], metrics?: (boolean | number | string)[]): Promise<void>;
17
- private isPackageInstalled;
18
- private executeSchematic;
19
- private findProjectVersion;
20
- private hasMismatchedPeer;
21
- }
package/commands/add.d.ts DELETED
@@ -1,42 +0,0 @@
1
- /**
2
- * Adds support for an external library to your project.
3
- */
4
- export interface Schema {
5
- /**
6
- * The package to be added.
7
- */
8
- collection?: string;
9
- /**
10
- * Disable interactive input prompts for options with a default.
11
- */
12
- defaults?: boolean;
13
- /**
14
- * Shows a help message for this command in the console.
15
- */
16
- help?: HelpUnion;
17
- /**
18
- * Enable interactive input prompts.
19
- */
20
- interactive?: boolean;
21
- /**
22
- * The NPM registry to use.
23
- */
24
- registry?: string;
25
- /**
26
- * Skip asking a confirmation prompt before installing and executing the package. Ensure
27
- * package name is correct prior to using this option.
28
- */
29
- skipConfirmation?: boolean;
30
- /**
31
- * Display additional details about internal operations during execution.
32
- */
33
- verbose?: boolean;
34
- }
35
- /**
36
- * Shows a help message for this command in the console.
37
- */
38
- export declare type HelpUnion = boolean | HelpEnum;
39
- export declare enum HelpEnum {
40
- HelpJson = "JSON",
41
- Json = "json"
42
- }
package/commands/add.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- // THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
3
- // CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.HelpEnum = void 0;
6
- var HelpEnum;
7
- (function (HelpEnum) {
8
- HelpEnum["HelpJson"] = "JSON";
9
- HelpEnum["Json"] = "json";
10
- })(HelpEnum = exports.HelpEnum || (exports.HelpEnum = {}));