@angular/cli 13.2.3 → 14.0.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.
@@ -9,20 +9,12 @@ export interface Schema {
9
9
  * The builder uses the named configurations to run the given target.
10
10
  * For more information, see
11
11
  * https://angular.io/guide/workspace-config#alternate-build-configurations.
12
- * Setting this explicitly overrides the "--prod" flag.
13
12
  */
14
13
  configuration?: string;
15
14
  /**
16
15
  * Shows a help message for this command in the console.
17
16
  */
18
17
  help?: HelpUnion;
19
- /**
20
- * Shorthand for "--configuration=production".
21
- * Set the build configuration to the production target.
22
- * By default, the production target is set up in the workspace configuration such that all
23
- * builds make use of bundling, limited tree-shaking, and also limited dead code elimination.
24
- */
25
- prod?: boolean;
26
18
  /**
27
19
  * The name of the project to build. Can be an application or a library.
28
20
  */
@@ -8,7 +8,6 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.ConfigCommand = void 0;
11
- const core_1 = require("@angular-devkit/core");
12
11
  const uuid_1 = require("uuid");
13
12
  const command_1 = require("../models/command");
14
13
  const interface_1 = require("../models/interface");
@@ -88,18 +87,7 @@ class ConfigCommand extends command_1.Command {
88
87
  if (!options.global) {
89
88
  await this.validateScope(interface_1.CommandScope.InProject);
90
89
  }
91
- let [config] = (0, config_1.getWorkspaceRaw)(level);
92
- if (options.global && !config) {
93
- try {
94
- if ((0, config_1.migrateLegacyGlobalConfig)()) {
95
- config = (0, config_1.getWorkspaceRaw)(level)[0];
96
- this.logger.info(core_1.tags.oneLine `
97
- We found a global configuration that was used in Angular CLI 1.
98
- It has been automatically migrated.`);
99
- }
100
- }
101
- catch { }
102
- }
90
+ const [config] = (0, config_1.getWorkspaceRaw)(level);
103
91
  if (options.value == undefined) {
104
92
  if (!config) {
105
93
  this.logger.error('No config found.');
@@ -14,14 +14,9 @@
14
14
  }
15
15
  },
16
16
  "configuration": {
17
- "description": "One or more named builder configurations as a comma-separated list as specified in the \"configurations\" section of angular.json.\nThe builder uses the named configurations to run the given target.\nFor more information, see https://angular.io/guide/workspace-config#alternate-build-configurations.\nSetting this explicitly overrides the \"--prod\" flag.",
17
+ "description": "One or more named builder configurations as a comma-separated list as specified in the \"configurations\" section of angular.json.\nThe builder uses the named configurations to run the given target.\nFor more information, see https://angular.io/guide/workspace-config#alternate-build-configurations.",
18
18
  "type": "string",
19
19
  "aliases": ["c"]
20
- },
21
- "prod": {
22
- "description": "Shorthand for \"--configuration=production\".\nSet the build configuration to the production target.\nBy default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.",
23
- "type": "boolean",
24
- "x-deprecated": "Use `--configuration production` instead."
25
20
  }
26
21
  }
27
22
  },
package/commands/e2e.d.ts CHANGED
@@ -8,20 +8,12 @@ export interface Schema {
8
8
  * The builder uses the named configurations to run the given target.
9
9
  * For more information, see
10
10
  * https://angular.io/guide/workspace-config#alternate-build-configurations.
11
- * Setting this explicitly overrides the "--prod" flag.
12
11
  */
13
12
  configuration?: string;
14
13
  /**
15
14
  * Shows a help message for this command in the console.
16
15
  */
17
16
  help?: HelpUnion;
18
- /**
19
- * Shorthand for "--configuration=production".
20
- * Set the build configuration to the production target.
21
- * By default, the production target is set up in the workspace configuration such that all
22
- * builds make use of bundling, limited tree-shaking, and also limited dead code elimination.
23
- */
24
- prod?: boolean;
25
17
  /**
26
18
  * The name of the project to build. Can be an application or a library.
27
19
  */
@@ -15,17 +15,6 @@ class ExtractI18nCommand extends architect_command_1.ArchitectCommand {
15
15
  this.target = 'extract-i18n';
16
16
  }
17
17
  async run(options) {
18
- const version = process.version.substr(1).split('.');
19
- if (Number(version[0]) === 12 && Number(version[1]) === 0) {
20
- this.logger.error('Due to a defect in Node.js 12.0, the command is not supported on this Node.js version. ' +
21
- 'Please upgrade to Node.js 12.1 or later.');
22
- return 1;
23
- }
24
- const commandName = process.argv[2];
25
- if (['xi18n', 'i18n-extract'].includes(commandName)) {
26
- this.logger.warn(`Warning: "ng ${commandName}" has been deprecated and will be removed in a future major version. ` +
27
- 'Please use "ng extract-i18n" instead.');
28
- }
29
18
  return this.runArchitectTarget(options);
30
19
  }
31
20
  }
@@ -8,20 +8,12 @@ export interface Schema {
8
8
  * The builder uses the named configurations to run the given target.
9
9
  * For more information, see
10
10
  * https://angular.io/guide/workspace-config#alternate-build-configurations.
11
- * Setting this explicitly overrides the "--prod" flag.
12
11
  */
13
12
  configuration?: string;
14
13
  /**
15
14
  * Shows a help message for this command in the console.
16
15
  */
17
16
  help?: HelpUnion;
18
- /**
19
- * Shorthand for "--configuration=production".
20
- * Set the build configuration to the production target.
21
- * By default, the production target is set up in the workspace configuration such that all
22
- * builds make use of bundling, limited tree-shaking, and also limited dead code elimination.
23
- */
24
- prod?: boolean;
25
17
  /**
26
18
  * The name of the project to build. Can be an application or a library.
27
19
  */
@@ -3,8 +3,6 @@
3
3
  "$id": "ng-cli://commands/extract-i18n.json",
4
4
  "description": "Extracts i18n messages from source code.",
5
5
  "$longDescription": "",
6
-
7
- "$aliases": ["i18n-extract", "xi18n"],
8
6
  "$scope": "in",
9
7
  "$type": "architect",
10
8
  "$impl": "./extract-i18n-impl#ExtractI18nCommand",
@@ -8,20 +8,12 @@ export interface Schema {
8
8
  * The builder uses the named configurations to run the given target.
9
9
  * For more information, see
10
10
  * https://angular.io/guide/workspace-config#alternate-build-configurations.
11
- * Setting this explicitly overrides the "--prod" flag.
12
11
  */
13
12
  configuration?: string;
14
13
  /**
15
14
  * Shows a help message for this command in the console.
16
15
  */
17
16
  help?: HelpUnion;
18
- /**
19
- * Shorthand for "--configuration=production".
20
- * Set the build configuration to the production target.
21
- * By default, the production target is set up in the workspace configuration such that all
22
- * builds make use of bundling, limited tree-shaking, and also limited dead code elimination.
23
- */
24
- prod?: boolean;
25
17
  /**
26
18
  * The name of the project to build. Can be an application or a library.
27
19
  */
@@ -8,20 +8,12 @@ export interface Schema {
8
8
  * The builder uses the named configurations to run the given target.
9
9
  * For more information, see
10
10
  * https://angular.io/guide/workspace-config#alternate-build-configurations.
11
- * Setting this explicitly overrides the "--prod" flag.
12
11
  */
13
12
  configuration?: string;
14
13
  /**
15
14
  * Shows a help message for this command in the console.
16
15
  */
17
16
  help?: HelpUnion;
18
- /**
19
- * Shorthand for "--configuration=production".
20
- * Set the build configuration to the production target.
21
- * By default, the production target is set up in the workspace configuration such that all
22
- * builds make use of bundling, limited tree-shaking, and also limited dead code elimination.
23
- */
24
- prod?: boolean;
25
17
  /**
26
18
  * The name of the project to build. Can be an application or a library.
27
19
  */
@@ -230,17 +230,6 @@ class UpdateCommand extends command_1.Command {
230
230
  this.logger.info(message);
231
231
  }
232
232
  };
233
- if (options.all) {
234
- const updateCmd = this.packageManager === workspace_schema_1.PackageManager.Yarn
235
- ? `'yarn upgrade-interactive' or 'yarn upgrade'`
236
- : `'${this.packageManager} update'`;
237
- this.logger.warn(`
238
- '--all' functionality has been removed as updating multiple packages at once is not recommended.
239
- To update packages which don’t provide 'ng update' capabilities in your workspace 'package.json' use ${updateCmd} instead.
240
- Run the package manager update command after updating packages which provide 'ng update' capabilities.
241
- `);
242
- return 0;
243
- }
244
233
  const packages = [];
245
234
  for (const request of options['--'] || []) {
246
235
  try {
@@ -2,10 +2,6 @@
2
2
  * Updates your application and its dependencies. See https://update.angular.io/
3
3
  */
4
4
  export interface Schema {
5
- /**
6
- * Whether to update all packages in package.json.
7
- */
8
- all?: boolean;
9
5
  /**
10
6
  * Whether to allow updating when the repository contains modified or untracked files.
11
7
  */
@@ -32,12 +32,6 @@
32
32
  "default": false,
33
33
  "type": "boolean"
34
34
  },
35
- "all": {
36
- "description": "Whether to update all packages in package.json.",
37
- "default": false,
38
- "type": "boolean",
39
- "x-deprecated": true
40
- },
41
35
  "next": {
42
36
  "description": "Use the prerelease version, including beta and RCs.",
43
37
  "default": false,
@@ -1584,7 +1584,34 @@
1584
1584
  "type": "array",
1585
1585
  "default": [],
1586
1586
  "items": {
1587
- "$ref": "#/definitions/AngularDevkitBuildAngularBuildersBrowserSchema/definitions/extraEntryPoint"
1587
+ "oneOf": [
1588
+ {
1589
+ "type": "object",
1590
+ "properties": {
1591
+ "input": {
1592
+ "type": "string",
1593
+ "description": "The file to include.",
1594
+ "pattern": "\\.[cm]?jsx?$"
1595
+ },
1596
+ "bundleName": {
1597
+ "type": "string",
1598
+ "pattern": "^[\\w\\-.]*$",
1599
+ "description": "The bundle name for this extra entry point."
1600
+ },
1601
+ "inject": {
1602
+ "type": "boolean",
1603
+ "description": "If the bundle will be referenced in the HTML file.",
1604
+ "default": true
1605
+ }
1606
+ },
1607
+ "additionalProperties": false
1608
+ },
1609
+ {
1610
+ "type": "string",
1611
+ "description": "The file to include.",
1612
+ "pattern": "\\.[cm]?jsx?$"
1613
+ }
1614
+ ]
1588
1615
  }
1589
1616
  },
1590
1617
  "styles": {
@@ -1592,7 +1619,34 @@
1592
1619
  "type": "array",
1593
1620
  "default": [],
1594
1621
  "items": {
1595
- "$ref": "#/definitions/AngularDevkitBuildAngularBuildersBrowserSchema/definitions/extraEntryPoint"
1622
+ "oneOf": [
1623
+ {
1624
+ "type": "object",
1625
+ "properties": {
1626
+ "input": {
1627
+ "type": "string",
1628
+ "description": "The file to include.",
1629
+ "pattern": "\\.(?:css|scss|sass|less|styl)$"
1630
+ },
1631
+ "bundleName": {
1632
+ "type": "string",
1633
+ "pattern": "^[\\w\\-.]*$",
1634
+ "description": "The bundle name for this extra entry point."
1635
+ },
1636
+ "inject": {
1637
+ "type": "boolean",
1638
+ "description": "If the bundle will be referenced in the HTML file.",
1639
+ "default": true
1640
+ }
1641
+ },
1642
+ "additionalProperties": false
1643
+ },
1644
+ {
1645
+ "type": "string",
1646
+ "description": "The file to include.",
1647
+ "pattern": "\\.(?:css|scss|sass|less|styl)$"
1648
+ }
1649
+ ]
1596
1650
  }
1597
1651
  },
1598
1652
  "inlineStyleLanguage": {
@@ -1846,15 +1900,9 @@
1846
1900
  "description": "Extract all licenses in a separate file.",
1847
1901
  "default": true
1848
1902
  },
1849
- "showCircularDependencies": {
1850
- "type": "boolean",
1851
- "description": "Show circular dependency warnings on builds.",
1852
- "default": false,
1853
- "x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
1854
- },
1855
1903
  "buildOptimizer": {
1856
1904
  "type": "boolean",
1857
- "description": "Enables '@angular-devkit/build-optimizer' optimizations when using the 'aot' option.",
1905
+ "description": "Enables advanced build optimizations when using the 'aot' option.",
1858
1906
  "default": true
1859
1907
  },
1860
1908
  "namedChunks": {
@@ -2009,34 +2057,6 @@
2009
2057
  }
2010
2058
  ]
2011
2059
  },
2012
- "extraEntryPoint": {
2013
- "oneOf": [
2014
- {
2015
- "type": "object",
2016
- "properties": {
2017
- "input": {
2018
- "type": "string",
2019
- "description": "The file to include."
2020
- },
2021
- "bundleName": {
2022
- "type": "string",
2023
- "pattern": "^[\\w\\-.]*$",
2024
- "description": "The bundle name for this extra entry point."
2025
- },
2026
- "inject": {
2027
- "type": "boolean",
2028
- "description": "If the bundle will be referenced in the HTML file.",
2029
- "default": true
2030
- }
2031
- },
2032
- "additionalProperties": false
2033
- },
2034
- {
2035
- "type": "string",
2036
- "description": "The file to include."
2037
- }
2038
- ]
2039
- },
2040
2060
  "budget": {
2041
2061
  "type": "object",
2042
2062
  "properties": {
@@ -2266,7 +2286,34 @@
2266
2286
  "type": "array",
2267
2287
  "default": [],
2268
2288
  "items": {
2269
- "$ref": "#/definitions/AngularDevkitBuildAngularBuildersKarmaSchema/definitions/extraEntryPoint"
2289
+ "oneOf": [
2290
+ {
2291
+ "type": "object",
2292
+ "properties": {
2293
+ "input": {
2294
+ "type": "string",
2295
+ "description": "The file to include.",
2296
+ "pattern": "\\.[cm]?jsx?$"
2297
+ },
2298
+ "bundleName": {
2299
+ "type": "string",
2300
+ "pattern": "^[\\w\\-.]*$",
2301
+ "description": "The bundle name for this extra entry point."
2302
+ },
2303
+ "inject": {
2304
+ "type": "boolean",
2305
+ "description": "If the bundle will be referenced in the HTML file.",
2306
+ "default": true
2307
+ }
2308
+ },
2309
+ "additionalProperties": false
2310
+ },
2311
+ {
2312
+ "type": "string",
2313
+ "description": "The file to include.",
2314
+ "pattern": "\\.[cm]?jsx?$"
2315
+ }
2316
+ ]
2270
2317
  }
2271
2318
  },
2272
2319
  "styles": {
@@ -2274,7 +2321,34 @@
2274
2321
  "type": "array",
2275
2322
  "default": [],
2276
2323
  "items": {
2277
- "$ref": "#/definitions/AngularDevkitBuildAngularBuildersKarmaSchema/definitions/extraEntryPoint"
2324
+ "oneOf": [
2325
+ {
2326
+ "type": "object",
2327
+ "properties": {
2328
+ "input": {
2329
+ "type": "string",
2330
+ "description": "The file to include.",
2331
+ "pattern": "\\.(?:css|scss|sass|less|styl)$"
2332
+ },
2333
+ "bundleName": {
2334
+ "type": "string",
2335
+ "pattern": "^[\\w\\-.]*$",
2336
+ "description": "The bundle name for this extra entry point."
2337
+ },
2338
+ "inject": {
2339
+ "type": "boolean",
2340
+ "description": "If the bundle will be referenced in the HTML file.",
2341
+ "default": true
2342
+ }
2343
+ },
2344
+ "additionalProperties": false
2345
+ },
2346
+ {
2347
+ "type": "string",
2348
+ "description": "The file to include.",
2349
+ "pattern": "\\.(?:css|scss|sass|less|styl)$"
2350
+ }
2351
+ ]
2278
2352
  }
2279
2353
  },
2280
2354
  "inlineStyleLanguage": {
@@ -2452,34 +2526,6 @@
2452
2526
  "type": "string"
2453
2527
  }
2454
2528
  ]
2455
- },
2456
- "extraEntryPoint": {
2457
- "oneOf": [
2458
- {
2459
- "type": "object",
2460
- "properties": {
2461
- "input": {
2462
- "type": "string",
2463
- "description": "The file to include."
2464
- },
2465
- "bundleName": {
2466
- "type": "string",
2467
- "pattern": "^[\\w\\-.]*$",
2468
- "description": "The bundle name for this extra entry point."
2469
- },
2470
- "inject": {
2471
- "type": "boolean",
2472
- "description": "If the bundle will be referenced in the HTML file.",
2473
- "default": true
2474
- }
2475
- },
2476
- "additionalProperties": false
2477
- },
2478
- {
2479
- "type": "string",
2480
- "description": "The file to include."
2481
- }
2482
- ]
2483
2529
  }
2484
2530
  }
2485
2531
  },
@@ -2734,12 +2780,6 @@
2734
2780
  "description": "Extract all licenses in a separate file, in the case of production builds only.",
2735
2781
  "default": true
2736
2782
  },
2737
- "showCircularDependencies": {
2738
- "type": "boolean",
2739
- "description": "Show circular dependency warnings on builds.",
2740
- "default": false,
2741
- "x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
2742
- },
2743
2783
  "namedChunks": {
2744
2784
  "type": "boolean",
2745
2785
  "description": "Use file name for lazy loaded chunks.",
@@ -218,19 +218,7 @@ class ArchitectCommand extends command_1.Command {
218
218
  return;
219
219
  }
220
220
  const packageManager = await (0, package_manager_1.getPackageManager)(basePath);
221
- let installSuggestion = 'Try installing with ';
222
- switch (packageManager) {
223
- case 'npm':
224
- installSuggestion += `'npm install'`;
225
- break;
226
- case 'yarn':
227
- installSuggestion += `'yarn'`;
228
- break;
229
- default:
230
- installSuggestion += `the project's package manager`;
231
- break;
232
- }
233
- this.logger.warn(`Node packages may not be installed. ${installSuggestion}.`);
221
+ this.logger.warn(`Node packages may not be installed. Try installing with '${packageManager} install'.`);
234
222
  }
235
223
  async run(options) {
236
224
  return await this.runArchitectTarget(options);
@@ -346,7 +334,6 @@ class ArchitectCommand extends command_1.Command {
346
334
  }
347
335
  }
348
336
  _makeTargetSpecifier(commandOptions) {
349
- var _a, _b, _c;
350
337
  let project, target, configuration;
351
338
  if (commandOptions.target) {
352
339
  [project, target, configuration] = commandOptions.target.split(':');
@@ -357,17 +344,6 @@ class ArchitectCommand extends command_1.Command {
357
344
  else {
358
345
  project = commandOptions.project;
359
346
  target = this.target;
360
- if (commandOptions.prod) {
361
- const defaultConfig = project &&
362
- target &&
363
- ((_c = (_b = (_a = this.workspace) === null || _a === void 0 ? void 0 : _a.projects.get(project)) === null || _b === void 0 ? void 0 : _b.targets.get(target)) === null || _c === void 0 ? void 0 : _c.defaultConfiguration);
364
- this.logger.warn(defaultConfig === 'production'
365
- ? 'Option "--prod" is deprecated: No need to use this option as this builder defaults to configuration "production".'
366
- : 'Option "--prod" is deprecated: Use "--configuration production" instead.');
367
- // The --prod flag will always be the first configuration, available to be overwritten
368
- // by following configurations.
369
- configuration = 'production';
370
- }
371
347
  if (commandOptions.configuration) {
372
348
  configuration = `${configuration ? `${configuration},` : ''}${commandOptions.configuration}`;
373
349
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cli",
3
- "version": "13.2.3",
3
+ "version": "14.0.0-next.2",
4
4
  "description": "CLI tool for Angular",
5
5
  "main": "lib/cli/index.js",
6
6
  "bin": {
@@ -28,21 +28,21 @@
28
28
  },
29
29
  "homepage": "https://github.com/angular/angular-cli",
30
30
  "dependencies": {
31
- "@angular-devkit/architect": "0.1302.3",
32
- "@angular-devkit/core": "13.2.3",
33
- "@angular-devkit/schematics": "13.2.3",
34
- "@schematics/angular": "13.2.3",
31
+ "@angular-devkit/architect": "0.1400.0-next.2",
32
+ "@angular-devkit/core": "14.0.0-next.2",
33
+ "@angular-devkit/schematics": "14.0.0-next.2",
34
+ "@schematics/angular": "14.0.0-next.2",
35
35
  "@yarnpkg/lockfile": "1.1.0",
36
36
  "ansi-colors": "4.1.1",
37
37
  "debug": "4.3.3",
38
38
  "ini": "2.0.0",
39
39
  "inquirer": "8.2.0",
40
40
  "jsonc-parser": "3.0.0",
41
- "npm-package-arg": "8.1.5",
42
- "npm-pick-manifest": "6.1.1",
41
+ "npm-package-arg": "9.0.0",
42
+ "npm-pick-manifest": "7.0.0",
43
43
  "open": "8.4.0",
44
44
  "ora": "5.4.1",
45
- "pacote": "12.0.3",
45
+ "pacote": "13.0.2",
46
46
  "resolve": "1.22.0",
47
47
  "semver": "7.3.5",
48
48
  "symbol-observable": "4.0.0",
@@ -51,12 +51,12 @@
51
51
  "ng-update": {
52
52
  "migrations": "@schematics/angular/migrations/migration-collection.json",
53
53
  "packageGroup": {
54
- "@angular/cli": "13.2.3",
55
- "@angular-devkit/architect": "0.1302.3",
56
- "@angular-devkit/build-angular": "13.2.3",
57
- "@angular-devkit/build-webpack": "0.1302.3",
58
- "@angular-devkit/core": "13.2.3",
59
- "@angular-devkit/schematics": "13.2.3"
54
+ "@angular/cli": "14.0.0-next.2",
55
+ "@angular-devkit/architect": "0.1400.0-next.2",
56
+ "@angular-devkit/build-angular": "14.0.0-next.2",
57
+ "@angular-devkit/build-webpack": "0.1400.0-next.2",
58
+ "@angular-devkit/core": "14.0.0-next.2",
59
+ "@angular-devkit/schematics": "14.0.0-next.2"
60
60
  }
61
61
  },
62
62
  "engines": {
@@ -650,9 +650,7 @@ function default_1(options) {
650
650
  const npmPackageJsonMap = allPackageMetadata.reduce((acc, npmPackageJson) => {
651
651
  // If the package was not found on the registry. It could be private, so we will just
652
652
  // ignore. If the package was part of the list, we will error out, but will simply ignore
653
- // if it's either not requested (so just part of package.json. silently) or if it's a
654
- // `--all` situation. There is an edge case here where a public package peer depends on a
655
- // private one, but it's rare enough.
653
+ // if it's either not requested (so just part of package.json. silently).
656
654
  if (!npmPackageJson.name) {
657
655
  if (npmPackageJson.requestedName && packages.has(npmPackageJson.requestedName)) {
658
656
  throw new schematics_1.SchematicsException(`Package ${JSON.stringify(npmPackageJson.requestedName)} was not found on the ` +
@@ -6,6 +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
10
  import { JSONFile } from './json-file';
10
11
  export declare const workspaceSchemaPath: string;
11
12
  export declare class AngularWorkspace {
@@ -24,7 +25,6 @@ export declare function createGlobalSettings(): string;
24
25
  export declare function getWorkspaceRaw(level?: 'local' | 'global'): [JSONFile | null, string | null];
25
26
  export declare function validateWorkspace(data: json.JsonObject): Promise<void>;
26
27
  export declare function getProjectByCwd(workspace: AngularWorkspace): string | null;
27
- export declare function getConfiguredPackageManager(): Promise<string | null>;
28
- export declare function migrateLegacyGlobalConfig(): boolean;
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>;
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.isWarningEnabled = exports.getSchematicDefaults = exports.migrateLegacyGlobalConfig = exports.getConfiguredPackageManager = exports.getProjectByCwd = exports.validateWorkspace = exports.getWorkspaceRaw = exports.createGlobalSettings = exports.getWorkspace = exports.AngularWorkspace = exports.workspaceSchemaPath = void 0;
29
+ exports.isWarningEnabled = exports.getSchematicDefaults = exports.getConfiguredPackageManager = exports.getProjectByCwd = exports.validateWorkspace = exports.getWorkspaceRaw = exports.createGlobalSettings = exports.getWorkspace = exports.AngularWorkspace = exports.workspaceSchemaPath = void 0;
30
30
  const core_1 = require("@angular-devkit/core");
31
31
  const fs_1 = require("fs");
32
32
  const os = __importStar(require("os"));
@@ -139,12 +139,6 @@ class AngularWorkspace {
139
139
  return (project === null || project === void 0 ? void 0 : project.extensions['cli']) || {};
140
140
  }
141
141
  static async load(workspaceFilePath) {
142
- const oldConfigFileNames = ['.angular-cli.json', 'angular-cli.json'];
143
- if (oldConfigFileNames.includes(path.basename(workspaceFilePath))) {
144
- // 1.x file format
145
- // Create an empty workspace to allow update to be used
146
- return new AngularWorkspace({ extensions: {}, projects: new core_1.workspaces.ProjectDefinitionCollection() }, workspaceFilePath);
147
- }
148
142
  const result = await core_1.workspaces.readWorkspace(workspaceFilePath, createWorkspaceHost(), core_1.workspaces.WorkspaceFormat.JSON);
149
143
  return new AngularWorkspace(result.workspace, workspaceFilePath);
150
144
  }
@@ -268,86 +262,24 @@ async function getConfiguredPackageManager() {
268
262
  return value;
269
263
  }
270
264
  }
265
+ return null;
271
266
  };
272
- let result;
267
+ let result = null;
273
268
  const workspace = await getWorkspace('local');
274
269
  if (workspace) {
275
270
  const project = getProjectByCwd(workspace);
276
271
  if (project) {
277
272
  result = getPackageManager((_a = workspace.projects.get(project)) === null || _a === void 0 ? void 0 : _a.extensions['cli']);
278
273
  }
279
- result = result !== null && result !== void 0 ? result : getPackageManager(workspace.extensions['cli']);
274
+ result !== null && result !== void 0 ? result : (result = getPackageManager(workspace.extensions['cli']));
280
275
  }
281
- if (result === undefined) {
276
+ if (!result) {
282
277
  const globalOptions = await getWorkspace('global');
283
278
  result = getPackageManager(globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.extensions['cli']);
284
- if (!workspace && !globalOptions) {
285
- // Only check legacy if updated workspace is not found
286
- result = getLegacyPackageManager();
287
- }
288
279
  }
289
- // Default to null
290
- return result !== null && result !== void 0 ? result : null;
280
+ return result;
291
281
  }
292
282
  exports.getConfiguredPackageManager = getConfiguredPackageManager;
293
- function migrateLegacyGlobalConfig() {
294
- const homeDir = os.homedir();
295
- if (homeDir) {
296
- const legacyGlobalConfigPath = path.join(homeDir, '.angular-cli.json');
297
- if ((0, fs_1.existsSync)(legacyGlobalConfigPath)) {
298
- const legacy = (0, json_file_1.readAndParseJson)(legacyGlobalConfigPath);
299
- if (!isJsonObject(legacy)) {
300
- return false;
301
- }
302
- const cli = {};
303
- if (legacy.packageManager &&
304
- typeof legacy.packageManager == 'string' &&
305
- legacy.packageManager !== 'default') {
306
- cli['packageManager'] = legacy.packageManager;
307
- }
308
- if (isJsonObject(legacy.defaults) &&
309
- isJsonObject(legacy.defaults.schematics) &&
310
- typeof legacy.defaults.schematics.collection == 'string') {
311
- cli['defaultCollection'] = legacy.defaults.schematics.collection;
312
- }
313
- if (isJsonObject(legacy.warnings)) {
314
- const warnings = {};
315
- if (typeof legacy.warnings.versionMismatch == 'boolean') {
316
- warnings['versionMismatch'] = legacy.warnings.versionMismatch;
317
- }
318
- if (Object.getOwnPropertyNames(warnings).length > 0) {
319
- cli['warnings'] = warnings;
320
- }
321
- }
322
- if (Object.getOwnPropertyNames(cli).length > 0) {
323
- const globalPath = path.join(homeDir, globalFileName);
324
- (0, fs_1.writeFileSync)(globalPath, JSON.stringify({ version: 1, cli }, null, 2));
325
- return true;
326
- }
327
- }
328
- }
329
- return false;
330
- }
331
- exports.migrateLegacyGlobalConfig = migrateLegacyGlobalConfig;
332
- // Fallback, check for packageManager in config file in v1.* global config.
333
- function getLegacyPackageManager() {
334
- const homeDir = os.homedir();
335
- if (homeDir) {
336
- const legacyGlobalConfigPath = path.join(homeDir, '.angular-cli.json');
337
- if ((0, fs_1.existsSync)(legacyGlobalConfigPath)) {
338
- const legacy = (0, json_file_1.readAndParseJson)(legacyGlobalConfigPath);
339
- if (!isJsonObject(legacy)) {
340
- return null;
341
- }
342
- if (legacy.packageManager &&
343
- typeof legacy.packageManager === 'string' &&
344
- legacy.packageManager !== 'default') {
345
- return legacy.packageManager;
346
- }
347
- }
348
- }
349
- return null;
350
- }
351
283
  async function getSchematicDefaults(collection, schematic, project) {
352
284
  var _a;
353
285
  const result = {};
@@ -6,8 +6,6 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { PackageManager } from '../lib/config/workspace-schema';
9
- export declare function supportsYarn(): boolean;
10
- export declare function supportsNpm(): boolean;
11
9
  export declare function getPackageManager(root: string): Promise<PackageManager>;
12
10
  /**
13
11
  * Checks if the npm version is a supported 7.x version. If not, display a warning.
@@ -7,54 +7,77 @@
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ensureCompatibleNpm = exports.getPackageManager = exports.supportsNpm = exports.supportsYarn = void 0;
10
+ exports.ensureCompatibleNpm = exports.getPackageManager = void 0;
11
11
  const child_process_1 = require("child_process");
12
12
  const fs_1 = require("fs");
13
13
  const path_1 = require("path");
14
14
  const semver_1 = require("semver");
15
+ const util_1 = require("util");
15
16
  const workspace_schema_1 = require("../lib/config/workspace-schema");
16
17
  const config_1 = require("./config");
17
- function supports(name) {
18
+ const exec = (0, util_1.promisify)(child_process_1.exec);
19
+ async function supports(name) {
18
20
  try {
19
- (0, child_process_1.execSync)(`${name} --version`, { stdio: 'ignore' });
21
+ await exec(`${name} --version`);
20
22
  return true;
21
23
  }
22
24
  catch {
23
25
  return false;
24
26
  }
25
27
  }
26
- function supportsYarn() {
27
- return supports('yarn');
28
- }
29
- exports.supportsYarn = supportsYarn;
30
- function supportsNpm() {
31
- return supports('npm');
28
+ async function hasLockfile(root, packageManager) {
29
+ try {
30
+ let lockfileName;
31
+ switch (packageManager) {
32
+ case workspace_schema_1.PackageManager.Yarn:
33
+ lockfileName = 'yarn.lock';
34
+ break;
35
+ case workspace_schema_1.PackageManager.Pnpm:
36
+ lockfileName = 'pnpm-lock.yaml';
37
+ break;
38
+ case workspace_schema_1.PackageManager.Npm:
39
+ default:
40
+ lockfileName = 'package-lock.json';
41
+ break;
42
+ }
43
+ await fs_1.promises.access((0, path_1.join)(root, lockfileName), fs_1.constants.F_OK);
44
+ return true;
45
+ }
46
+ catch {
47
+ return false;
48
+ }
32
49
  }
33
- exports.supportsNpm = supportsNpm;
34
50
  async function getPackageManager(root) {
35
- let packageManager = (await (0, config_1.getConfiguredPackageManager)());
51
+ const packageManager = await (0, config_1.getConfiguredPackageManager)();
36
52
  if (packageManager) {
37
53
  return packageManager;
38
54
  }
39
- const hasYarn = supportsYarn();
40
- const hasYarnLock = (0, fs_1.existsSync)((0, path_1.join)(root, 'yarn.lock'));
41
- const hasNpm = supportsNpm();
42
- const hasNpmLock = (0, fs_1.existsSync)((0, path_1.join)(root, 'package-lock.json'));
55
+ const [hasYarnLock, hasNpmLock, hasPnpmLock] = await Promise.all([
56
+ hasLockfile(root, workspace_schema_1.PackageManager.Yarn),
57
+ hasLockfile(root, workspace_schema_1.PackageManager.Npm),
58
+ hasLockfile(root, workspace_schema_1.PackageManager.Pnpm),
59
+ ]);
60
+ const hasYarn = await supports(workspace_schema_1.PackageManager.Yarn);
43
61
  if (hasYarn && hasYarnLock && !hasNpmLock) {
44
- packageManager = workspace_schema_1.PackageManager.Yarn;
62
+ return workspace_schema_1.PackageManager.Yarn;
63
+ }
64
+ const hasPnpm = await supports(workspace_schema_1.PackageManager.Pnpm);
65
+ if (hasPnpm && hasPnpmLock && !hasNpmLock) {
66
+ return workspace_schema_1.PackageManager.Pnpm;
45
67
  }
46
- else if (hasNpm && hasNpmLock && !hasYarnLock) {
47
- packageManager = workspace_schema_1.PackageManager.Npm;
68
+ const hasNpm = await supports(workspace_schema_1.PackageManager.Npm);
69
+ if (hasNpm && hasNpmLock && !hasYarnLock && !hasPnpmLock) {
70
+ return workspace_schema_1.PackageManager.Npm;
48
71
  }
49
- else if (hasYarn && !hasNpm) {
50
- packageManager = workspace_schema_1.PackageManager.Yarn;
72
+ if (hasYarn && !hasNpm && !hasPnpm) {
73
+ return workspace_schema_1.PackageManager.Yarn;
51
74
  }
52
- else if (hasNpm && !hasYarn) {
53
- packageManager = workspace_schema_1.PackageManager.Npm;
75
+ if (hasPnpm && !hasYarn && !hasNpm) {
76
+ return workspace_schema_1.PackageManager.Pnpm;
54
77
  }
55
78
  // TODO: This should eventually inform the user of ambiguous package manager usage.
56
79
  // Potentially with a prompt to choose and optionally set as the default.
57
- return packageManager || workspace_schema_1.PackageManager.Npm;
80
+ return workspace_schema_1.PackageManager.Npm;
58
81
  }
59
82
  exports.getPackageManager = getPackageManager;
60
83
  /**
@@ -33,12 +33,7 @@ const os = __importStar(require("os"));
33
33
  const path = __importStar(require("path"));
34
34
  const find_up_1 = require("./find-up");
35
35
  function findWorkspaceFile(currentDirectory = process.cwd()) {
36
- const possibleConfigFiles = [
37
- 'angular.json',
38
- '.angular.json',
39
- 'angular-cli.json',
40
- '.angular-cli.json',
41
- ];
36
+ const possibleConfigFiles = ['angular.json', '.angular.json'];
42
37
  const configFilePath = (0, find_up_1.findUp)(possibleConfigFiles, currentDirectory);
43
38
  if (configFilePath === null) {
44
39
  return null;