@angular/cli 14.0.0-next.6 → 14.0.0-next.7
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.
- package/lib/cli/index.d.ts +0 -1
- package/lib/cli/index.js +3 -30
- package/lib/config/schema.json +22 -3
- package/lib/config/workspace-schema.d.ts +5 -0
- package/lib/init.js +2 -5
- package/package.json +15 -18
- package/src/analytics/analytics-collector.js +2 -0
- package/src/analytics/analytics.js +17 -16
- package/src/command-builder/architect-command-module.js +3 -3
- package/src/command-builder/command-module.d.ts +3 -2
- package/src/command-builder/command-runner.d.ts +1 -2
- package/src/command-builder/command-runner.js +50 -33
- package/src/command-builder/schematics-command-module.d.ts +4 -2
- package/src/command-builder/schematics-command-module.js +81 -41
- package/src/commands/add/cli.js +14 -14
- package/src/commands/add/long-description.md +1 -4
- package/src/commands/analytics/cli.d.ts +1 -1
- package/src/commands/analytics/info/cli.d.ts +1 -1
- package/src/commands/analytics/settings/cli.d.ts +1 -1
- package/src/commands/cache/clean/cli.d.ts +17 -0
- package/src/commands/cache/clean/cli.js +32 -0
- package/src/commands/cache/cli.d.ts +17 -0
- package/src/commands/cache/cli.js +38 -0
- package/src/commands/cache/info/cli.d.ts +20 -0
- package/src/commands/cache/info/cli.js +82 -0
- package/src/commands/cache/long-description.md +53 -0
- package/src/commands/cache/settings/cli.d.ts +27 -0
- package/src/commands/cache/settings/cli.js +42 -0
- package/src/commands/cache/utilities.d.ts +11 -0
- package/src/commands/cache/utilities.js +50 -0
- package/src/commands/config/cli.d.ts +1 -1
- package/src/commands/config/cli.js +2 -2
- package/src/commands/doc/cli.d.ts +1 -1
- package/src/commands/e2e/cli.d.ts +1 -1
- package/src/commands/e2e/cli.js +3 -3
- package/src/commands/generate/cli.d.ts +11 -1
- package/src/commands/generate/cli.js +54 -23
- package/src/commands/new/cli.d.ts +2 -0
- package/src/commands/new/cli.js +15 -4
- package/src/commands/update/cli.d.ts +1 -0
- package/src/commands/update/cli.js +50 -21
- package/src/commands/update/schematic/index.js +27 -18
- package/src/commands/version/cli.d.ts +0 -1
- package/src/commands/version/cli.js +4 -23
- package/src/typings-bazel.d.ts +14 -0
- package/src/typings.d.ts +0 -13
- package/src/utilities/config.d.ts +1 -2
- package/src/utilities/config.js +18 -41
- package/src/{analytics/analytics-environment-options.d.ts → utilities/environment-options.d.ts} +3 -0
- package/src/utilities/environment-options.js +24 -0
- package/src/utilities/package-manager.d.ts +33 -5
- package/src/utilities/package-manager.js +241 -71
- package/src/utilities/package-metadata.d.ts +15 -37
- package/src/utilities/package-metadata.js +10 -26
- package/src/utilities/package-tree.d.ts +2 -2
- package/src/utilities/prompt.js +2 -2
- package/bin/postinstall/analytics-prompt.js +0 -27
- package/bin/postinstall/script.js +0 -16
- package/src/analytics/analytics-environment-options.js +0 -20
- package/src/utilities/install-package.d.ts +0 -16
- package/src/utilities/install-package.js +0 -193
- package/src/utilities/package-json.d.ts +0 -249
- package/src/utilities/package-json.js +0 -9
package/lib/cli/index.d.ts
CHANGED
package/lib/cli/index.js
CHANGED
|
@@ -13,13 +13,10 @@ const util_1 = require("util");
|
|
|
13
13
|
const command_module_1 = require("../../src/command-builder/command-module");
|
|
14
14
|
const command_runner_1 = require("../../src/command-builder/command-runner");
|
|
15
15
|
const color_1 = require("../../src/utilities/color");
|
|
16
|
-
const
|
|
16
|
+
const environment_options_1 = require("../../src/utilities/environment-options");
|
|
17
17
|
const log_file_1 = require("../../src/utilities/log-file");
|
|
18
|
-
const project_1 = require("../../src/utilities/project");
|
|
19
18
|
var version_1 = require("../../src/utilities/version");
|
|
20
19
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
21
|
-
const debugEnv = process.env['NG_DEBUG'];
|
|
22
|
-
const isDebug = debugEnv !== undefined && debugEnv !== '0' && debugEnv.toLowerCase() !== 'false';
|
|
23
20
|
/* eslint-disable no-console */
|
|
24
21
|
async function default_1(options) {
|
|
25
22
|
// This node version check ensures that the requirements of the project instance of the CLI are met
|
|
@@ -30,7 +27,7 @@ async function default_1(options) {
|
|
|
30
27
|
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n');
|
|
31
28
|
return 3;
|
|
32
29
|
}
|
|
33
|
-
const logger = (0, node_1.createConsoleLogger)(
|
|
30
|
+
const logger = (0, node_1.createConsoleLogger)(environment_options_1.ngDebug, process.stdout, process.stderr, {
|
|
34
31
|
info: (s) => (color_1.colors.enabled ? s : (0, color_1.removeColor)(s)),
|
|
35
32
|
debug: (s) => (color_1.colors.enabled ? s : (0, color_1.removeColor)(s)),
|
|
36
33
|
warn: (s) => (color_1.colors.enabled ? color_1.colors.bold.yellow(s) : (0, color_1.removeColor)(s)),
|
|
@@ -47,27 +44,8 @@ async function default_1(options) {
|
|
|
47
44
|
console.error = function (...args) {
|
|
48
45
|
logger.error((0, util_1.format)(...args));
|
|
49
46
|
};
|
|
50
|
-
let workspace;
|
|
51
|
-
const workspaceFile = (0, project_1.findWorkspaceFile)();
|
|
52
|
-
if (workspaceFile === null) {
|
|
53
|
-
const [, localPath] = (0, config_1.getWorkspaceRaw)('local');
|
|
54
|
-
if (localPath !== null) {
|
|
55
|
-
logger.fatal(`An invalid configuration file was found ['${localPath}'].` +
|
|
56
|
-
' Please delete the file before running the command.');
|
|
57
|
-
return 1;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
try {
|
|
62
|
-
workspace = await config_1.AngularWorkspace.load(workspaceFile);
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
logger.fatal(`Unable to read workspace file '${workspaceFile}': ${e.message}`);
|
|
66
|
-
return 1;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
47
|
try {
|
|
70
|
-
return await (0, command_runner_1.runCommand)(options.cliArgs, logger
|
|
48
|
+
return await (0, command_runner_1.runCommand)(options.cliArgs, logger);
|
|
71
49
|
}
|
|
72
50
|
catch (err) {
|
|
73
51
|
if (err instanceof command_module_1.CommandModuleError) {
|
|
@@ -97,11 +75,6 @@ async function default_1(options) {
|
|
|
97
75
|
else {
|
|
98
76
|
logger.fatal('An unexpected error occurred: ' + JSON.stringify(err));
|
|
99
77
|
}
|
|
100
|
-
if (options.testing) {
|
|
101
|
-
// eslint-disable-next-line no-debugger
|
|
102
|
-
debugger;
|
|
103
|
-
throw err;
|
|
104
|
-
}
|
|
105
78
|
return 1;
|
|
106
79
|
}
|
|
107
80
|
}
|
package/lib/config/schema.json
CHANGED
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"defaultProject": {
|
|
24
24
|
"type": "string",
|
|
25
|
-
"description": "Default project name used in commands."
|
|
25
|
+
"description": "Default project name used in commands.",
|
|
26
|
+
"x-deprecated": "The project to use will be determined from the current working directory."
|
|
26
27
|
},
|
|
27
28
|
"projects": {
|
|
28
29
|
"type": "object",
|
|
@@ -44,7 +45,16 @@
|
|
|
44
45
|
"properties": {
|
|
45
46
|
"defaultCollection": {
|
|
46
47
|
"description": "The default schematics collection to use.",
|
|
47
|
-
"type": "string"
|
|
48
|
+
"type": "string",
|
|
49
|
+
"x-deprecated": "Use 'schematicCollections' instead."
|
|
50
|
+
},
|
|
51
|
+
"schematicCollections": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"description": "The list of schematic collections to use.",
|
|
54
|
+
"items": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"uniqueItems": true
|
|
57
|
+
}
|
|
48
58
|
},
|
|
49
59
|
"packageManager": {
|
|
50
60
|
"description": "Specify which package manager tool to use.",
|
|
@@ -175,7 +185,16 @@
|
|
|
175
185
|
"cli": {
|
|
176
186
|
"defaultCollection": {
|
|
177
187
|
"description": "The default schematics collection to use.",
|
|
178
|
-
"type": "string"
|
|
188
|
+
"type": "string",
|
|
189
|
+
"x-deprecated": "Use 'schematicCollections' instead."
|
|
190
|
+
},
|
|
191
|
+
"schematicCollections": {
|
|
192
|
+
"type": "array",
|
|
193
|
+
"description": "The list of schematic collections to use.",
|
|
194
|
+
"items": {
|
|
195
|
+
"type": "string",
|
|
196
|
+
"uniqueItems": true
|
|
197
|
+
}
|
|
179
198
|
}
|
|
180
199
|
},
|
|
181
200
|
"schematics": {
|
|
@@ -3,6 +3,7 @@ export interface Schema {
|
|
|
3
3
|
cli?: CliOptions;
|
|
4
4
|
/**
|
|
5
5
|
* Default project name used in commands.
|
|
6
|
+
* @deprecated The project to use will be determined from the current working directory.
|
|
6
7
|
*/
|
|
7
8
|
defaultProject?: string;
|
|
8
9
|
/**
|
|
@@ -31,6 +32,10 @@ export interface CliOptions {
|
|
|
31
32
|
* Specify which package manager tool to use.
|
|
32
33
|
*/
|
|
33
34
|
packageManager?: PackageManager;
|
|
35
|
+
/**
|
|
36
|
+
* The list of schematic collections to use.
|
|
37
|
+
*/
|
|
38
|
+
schematicCollections?: string[];
|
|
34
39
|
/**
|
|
35
40
|
* Control CLI specific console warnings
|
|
36
41
|
*/
|
package/lib/init.js
CHANGED
|
@@ -37,6 +37,7 @@ const path = __importStar(require("path"));
|
|
|
37
37
|
const semver_1 = require("semver");
|
|
38
38
|
const color_1 = require("../src/utilities/color");
|
|
39
39
|
const config_1 = require("../src/utilities/config");
|
|
40
|
+
const environment_options_1 = require("../src/utilities/environment-options");
|
|
40
41
|
const version_1 = require("../src/utilities/version");
|
|
41
42
|
(async () => {
|
|
42
43
|
var _a;
|
|
@@ -47,15 +48,11 @@ const version_1 = require("../src/utilities/version");
|
|
|
47
48
|
* See: https://github.com/browserslist/browserslist/blob/819c4337456996d19db6ba953014579329e9c6e1/node.js#L324
|
|
48
49
|
*/
|
|
49
50
|
process.env.BROWSERSLIST_IGNORE_OLD_DATA = '1';
|
|
50
|
-
const disableVersionCheckEnv = process.env['NG_DISABLE_VERSION_CHECK'];
|
|
51
51
|
/**
|
|
52
52
|
* Disable CLI version mismatch checks and forces usage of the invoked CLI
|
|
53
53
|
* instead of invoking the local installed version.
|
|
54
54
|
*/
|
|
55
|
-
|
|
56
|
-
disableVersionCheckEnv !== '0' &&
|
|
57
|
-
disableVersionCheckEnv.toLowerCase() !== 'false';
|
|
58
|
-
if (disableVersionCheck) {
|
|
55
|
+
if (environment_options_1.disableVersionCheck) {
|
|
59
56
|
return (await Promise.resolve().then(() => __importStar(require('./cli')))).default;
|
|
60
57
|
}
|
|
61
58
|
let cli;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "14.0.0-next.
|
|
3
|
+
"version": "14.0.0-next.7",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -14,9 +14,6 @@
|
|
|
14
14
|
"Angular DevKit",
|
|
15
15
|
"angular-cli"
|
|
16
16
|
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"postinstall": "node ./bin/postinstall/script.js"
|
|
19
|
-
},
|
|
20
17
|
"repository": {
|
|
21
18
|
"type": "git",
|
|
22
19
|
"url": "https://github.com/angular/angular-cli.git"
|
|
@@ -28,17 +25,17 @@
|
|
|
28
25
|
},
|
|
29
26
|
"homepage": "https://github.com/angular/angular-cli",
|
|
30
27
|
"dependencies": {
|
|
31
|
-
"@angular-devkit/architect": "0.1400.0-next.
|
|
32
|
-
"@angular-devkit/core": "14.0.0-next.
|
|
33
|
-
"@angular-devkit/schematics": "14.0.0-next.
|
|
34
|
-
"@schematics/angular": "14.0.0-next.
|
|
28
|
+
"@angular-devkit/architect": "0.1400.0-next.7",
|
|
29
|
+
"@angular-devkit/core": "14.0.0-next.7",
|
|
30
|
+
"@angular-devkit/schematics": "14.0.0-next.7",
|
|
31
|
+
"@schematics/angular": "14.0.0-next.7",
|
|
35
32
|
"@yarnpkg/lockfile": "1.1.0",
|
|
36
33
|
"ansi-colors": "4.1.1",
|
|
37
|
-
"debug": "4.3.
|
|
34
|
+
"debug": "4.3.4",
|
|
38
35
|
"ini": "2.0.0",
|
|
39
|
-
"inquirer": "8.2.
|
|
36
|
+
"inquirer": "8.2.2",
|
|
40
37
|
"jsonc-parser": "3.0.0",
|
|
41
|
-
"npm-package-arg": "9.0.
|
|
38
|
+
"npm-package-arg": "9.0.2",
|
|
42
39
|
"npm-pick-manifest": "7.0.0",
|
|
43
40
|
"open": "8.4.0",
|
|
44
41
|
"ora": "5.4.1",
|
|
@@ -47,17 +44,17 @@
|
|
|
47
44
|
"semver": "7.3.5",
|
|
48
45
|
"symbol-observable": "4.0.0",
|
|
49
46
|
"uuid": "8.3.2",
|
|
50
|
-
"yargs": "17.
|
|
47
|
+
"yargs": "17.4.0"
|
|
51
48
|
},
|
|
52
49
|
"ng-update": {
|
|
53
50
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
54
51
|
"packageGroup": {
|
|
55
|
-
"@angular/cli": "14.0.0-next.
|
|
56
|
-
"@angular-devkit/architect": "0.1400.0-next.
|
|
57
|
-
"@angular-devkit/build-angular": "14.0.0-next.
|
|
58
|
-
"@angular-devkit/build-webpack": "0.1400.0-next.
|
|
59
|
-
"@angular-devkit/core": "14.0.0-next.
|
|
60
|
-
"@angular-devkit/schematics": "14.0.0-next.
|
|
52
|
+
"@angular/cli": "14.0.0-next.7",
|
|
53
|
+
"@angular-devkit/architect": "0.1400.0-next.7",
|
|
54
|
+
"@angular-devkit/build-angular": "14.0.0-next.7",
|
|
55
|
+
"@angular-devkit/build-webpack": "0.1400.0-next.7",
|
|
56
|
+
"@angular-devkit/core": "14.0.0-next.7",
|
|
57
|
+
"@angular-devkit/schematics": "14.0.0-next.7"
|
|
61
58
|
}
|
|
62
59
|
},
|
|
63
60
|
"engines": {
|
|
@@ -72,6 +72,8 @@ class AnalyticsCollector {
|
|
|
72
72
|
this.parameters['cd' + core_1.analytics.NgCliAnalyticsDimensions.CpuSpeed] = Math.floor(os.cpus()[0].speed);
|
|
73
73
|
this.parameters['cd' + core_1.analytics.NgCliAnalyticsDimensions.RamInGigabytes] = Math.round(os.totalmem() / (1024 * 1024 * 1024));
|
|
74
74
|
this.parameters['cd' + core_1.analytics.NgCliAnalyticsDimensions.NodeVersion] = nodeVersion;
|
|
75
|
+
this.parameters['cd' + core_1.analytics.NgCliAnalyticsDimensions.AngularCLIMajorVersion] =
|
|
76
|
+
version_1.VERSION.major;
|
|
75
77
|
}
|
|
76
78
|
event(ec, ea, options = {}) {
|
|
77
79
|
const { label: el, value: ev, metrics, dimensions } = options;
|
|
@@ -36,14 +36,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.getAnalyticsInfoString = exports.createAnalytics = exports.getSharedAnalytics = exports.getAnalytics = exports.promptAnalytics = exports.setAnalyticsConfig = exports.isPackageNameSafeForAnalytics = exports.analyticsPackageSafelist = exports.AnalyticsProperties = void 0;
|
|
37
37
|
const core_1 = require("@angular-devkit/core");
|
|
38
38
|
const debug_1 = __importDefault(require("debug"));
|
|
39
|
-
const inquirer = __importStar(require("inquirer"));
|
|
40
39
|
const uuid_1 = require("uuid");
|
|
41
40
|
const color_1 = require("../utilities/color");
|
|
42
41
|
const config_1 = require("../utilities/config");
|
|
42
|
+
const environment_options_1 = require("../utilities/environment-options");
|
|
43
43
|
const tty_1 = require("../utilities/tty");
|
|
44
44
|
const version_1 = require("../utilities/version");
|
|
45
45
|
const analytics_collector_1 = require("./analytics-collector");
|
|
46
|
-
const analytics_environment_options_1 = require("./analytics-environment-options");
|
|
47
46
|
/* eslint-disable no-console */
|
|
48
47
|
const analyticsDebug = (0, debug_1.default)('ng:analytics'); // Generate analytics, including settings and users.
|
|
49
48
|
let _defaultAngularCliPropertyCache;
|
|
@@ -120,7 +119,8 @@ async function promptAnalytics(global, force = false) {
|
|
|
120
119
|
throw new Error(`Could not find a ${level} workspace. Are you in a project?`);
|
|
121
120
|
}
|
|
122
121
|
if (force || (0, tty_1.isTTY)()) {
|
|
123
|
-
const
|
|
122
|
+
const { prompt } = await Promise.resolve().then(() => __importStar(require('inquirer')));
|
|
123
|
+
const answers = await prompt([
|
|
124
124
|
{
|
|
125
125
|
type: 'confirm',
|
|
126
126
|
name: 'analytics',
|
|
@@ -170,7 +170,7 @@ exports.promptAnalytics = promptAnalytics;
|
|
|
170
170
|
*/
|
|
171
171
|
async function getAnalytics(level) {
|
|
172
172
|
analyticsDebug('getAnalytics');
|
|
173
|
-
if (
|
|
173
|
+
if (environment_options_1.analyticsDisabled) {
|
|
174
174
|
analyticsDebug('NG_CLI_ANALYTICS is false');
|
|
175
175
|
return new core_1.analytics.NoopAnalytics();
|
|
176
176
|
}
|
|
@@ -211,7 +211,7 @@ exports.getAnalytics = getAnalytics;
|
|
|
211
211
|
*/
|
|
212
212
|
async function getSharedAnalytics() {
|
|
213
213
|
analyticsDebug('getSharedAnalytics');
|
|
214
|
-
if (
|
|
214
|
+
if (environment_options_1.analyticsShareDisabled) {
|
|
215
215
|
analyticsDebug('NG_CLI_ANALYTICS is false');
|
|
216
216
|
return undefined;
|
|
217
217
|
}
|
|
@@ -245,25 +245,26 @@ async function createAnalytics(workspace, skipPrompt = false) {
|
|
|
245
245
|
return globalConfig;
|
|
246
246
|
}
|
|
247
247
|
let config = globalConfig;
|
|
248
|
-
// Not disabled globally, check locally
|
|
249
|
-
if (workspace) {
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
// Not disabled globally, check locally or not set globally and command is run outside of workspace example: `ng new`
|
|
249
|
+
if (workspace || globalConfig === undefined) {
|
|
250
|
+
const level = workspace ? 'local' : 'global';
|
|
251
|
+
let localOrGlobalConfig = await getAnalytics(level);
|
|
252
|
+
if (localOrGlobalConfig === undefined) {
|
|
252
253
|
if (!skipPrompt) {
|
|
253
|
-
//
|
|
254
|
+
// config is unset, prompt user.
|
|
254
255
|
// TODO: This should honor the `no-interactive` option.
|
|
255
256
|
// It is currently not an `ng` option but rather only an option for specific commands.
|
|
256
257
|
// The concept of `ng`-wide options are needed to cleanly handle this.
|
|
257
|
-
await promptAnalytics(
|
|
258
|
-
|
|
258
|
+
await promptAnalytics(!workspace /** global */);
|
|
259
|
+
localOrGlobalConfig = await getAnalytics(level);
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
|
-
if (
|
|
262
|
-
return
|
|
262
|
+
if (localOrGlobalConfig instanceof core_1.analytics.NoopAnalytics) {
|
|
263
|
+
return localOrGlobalConfig;
|
|
263
264
|
}
|
|
264
|
-
else if (
|
|
265
|
+
else if (localOrGlobalConfig) {
|
|
265
266
|
// Favor local settings over global when defined.
|
|
266
|
-
config =
|
|
267
|
+
config = localOrGlobalConfig;
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
270
|
// Get shared analytics
|
|
@@ -94,13 +94,13 @@ class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBa
|
|
|
94
94
|
return allProjectsForTargetName;
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
97
|
+
if (allProjectsForTargetName.length === 1) {
|
|
98
|
+
return allProjectsForTargetName;
|
|
99
|
+
}
|
|
97
100
|
const maybeProject = (0, config_1.getProjectByCwd)(workspace);
|
|
98
101
|
if (maybeProject && allProjectsForTargetName.includes(maybeProject)) {
|
|
99
102
|
return [maybeProject];
|
|
100
103
|
}
|
|
101
|
-
if (allProjectsForTargetName.length === 1) {
|
|
102
|
-
return allProjectsForTargetName;
|
|
103
|
-
}
|
|
104
104
|
}
|
|
105
105
|
return undefined;
|
|
106
106
|
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { analytics, logging } from '@angular-devkit/core';
|
|
9
9
|
import { ArgumentsCamelCase, Argv, CamelCaseKey, CommandModule as YargsCommandModule } from 'yargs';
|
|
10
|
-
import { PackageManager } from '../../lib/config/workspace-schema';
|
|
11
10
|
import { AngularWorkspace } from '../utilities/config';
|
|
11
|
+
import { PackageManagerUtils } from '../utilities/package-manager';
|
|
12
12
|
import { Option } from './utilities/json-schema';
|
|
13
13
|
export declare type Options<T> = {
|
|
14
14
|
[key in keyof T as CamelCaseKey<key>]: T[key];
|
|
@@ -25,8 +25,9 @@ export interface CommandContext {
|
|
|
25
25
|
currentDirectory: string;
|
|
26
26
|
root: string;
|
|
27
27
|
workspace?: AngularWorkspace;
|
|
28
|
+
globalConfiguration?: AngularWorkspace;
|
|
28
29
|
logger: logging.Logger;
|
|
29
|
-
packageManager:
|
|
30
|
+
packageManager: PackageManagerUtils;
|
|
30
31
|
/** Arguments parsed in free-from without parser configuration. */
|
|
31
32
|
args: {
|
|
32
33
|
positional: string[];
|
|
@@ -6,5 +6,4 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { logging } from '@angular-devkit/core';
|
|
9
|
-
|
|
10
|
-
export declare function runCommand(args: string[], logger: logging.Logger, workspace: AngularWorkspace | undefined): Promise<number>;
|
|
9
|
+
export declare function runCommand(args: string[], logger: logging.Logger): Promise<number>;
|
|
@@ -16,54 +16,71 @@ const helpers_1 = require("yargs/helpers");
|
|
|
16
16
|
const cli_1 = require("../commands/add/cli");
|
|
17
17
|
const cli_2 = require("../commands/analytics/cli");
|
|
18
18
|
const cli_3 = require("../commands/build/cli");
|
|
19
|
-
const cli_4 = require("../commands/
|
|
20
|
-
const cli_5 = require("../commands/
|
|
21
|
-
const cli_6 = require("../commands/
|
|
22
|
-
const cli_7 = require("../commands/
|
|
23
|
-
const cli_8 = require("../commands/
|
|
24
|
-
const cli_9 = require("../commands/
|
|
25
|
-
const cli_10 = require("../commands/
|
|
26
|
-
const cli_11 = require("../commands/
|
|
27
|
-
const cli_12 = require("../commands/
|
|
28
|
-
const cli_13 = require("../commands/
|
|
29
|
-
const cli_14 = require("../commands/
|
|
30
|
-
const cli_15 = require("../commands/
|
|
31
|
-
const cli_16 = require("../commands/
|
|
32
|
-
const cli_17 = require("../commands/
|
|
19
|
+
const cli_4 = require("../commands/cache/cli");
|
|
20
|
+
const cli_5 = require("../commands/config/cli");
|
|
21
|
+
const cli_6 = require("../commands/deploy/cli");
|
|
22
|
+
const cli_7 = require("../commands/doc/cli");
|
|
23
|
+
const cli_8 = require("../commands/e2e/cli");
|
|
24
|
+
const cli_9 = require("../commands/extract-i18n/cli");
|
|
25
|
+
const cli_10 = require("../commands/generate/cli");
|
|
26
|
+
const cli_11 = require("../commands/lint/cli");
|
|
27
|
+
const cli_12 = require("../commands/make-this-awesome/cli");
|
|
28
|
+
const cli_13 = require("../commands/new/cli");
|
|
29
|
+
const cli_14 = require("../commands/run/cli");
|
|
30
|
+
const cli_15 = require("../commands/serve/cli");
|
|
31
|
+
const cli_16 = require("../commands/test/cli");
|
|
32
|
+
const cli_17 = require("../commands/update/cli");
|
|
33
|
+
const cli_18 = require("../commands/version/cli");
|
|
33
34
|
const color_1 = require("../utilities/color");
|
|
35
|
+
const config_1 = require("../utilities/config");
|
|
34
36
|
const package_manager_1 = require("../utilities/package-manager");
|
|
35
37
|
const command_module_1 = require("./command-module");
|
|
36
38
|
const command_1 = require("./utilities/command");
|
|
37
39
|
const json_help_1 = require("./utilities/json-help");
|
|
38
40
|
const COMMANDS = [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
cli_18.VersionCommandModule,
|
|
42
|
+
cli_7.DocCommandModule,
|
|
43
|
+
cli_12.AwesomeCommandModule,
|
|
44
|
+
cli_5.ConfigCommandModule,
|
|
43
45
|
cli_2.AnalyticsCommandModule,
|
|
44
46
|
cli_1.AddCommandModule,
|
|
45
|
-
|
|
47
|
+
cli_10.GenerateCommandModule,
|
|
46
48
|
cli_3.BuildCommandModule,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
cli_8.E2eCommandModule,
|
|
50
|
+
cli_16.TestCommandModule,
|
|
51
|
+
cli_15.ServeCommandModule,
|
|
52
|
+
cli_9.ExtractI18nCommandModule,
|
|
53
|
+
cli_6.DeployCommandModule,
|
|
54
|
+
cli_11.LintCommandModule,
|
|
55
|
+
cli_13.NewCommandModule,
|
|
56
|
+
cli_17.UpdateCommandModule,
|
|
57
|
+
cli_14.RunCommandModule,
|
|
58
|
+
cli_4.CacheCommandModule,
|
|
56
59
|
].sort(); // Will be sorted by class name.
|
|
57
60
|
const yargsParser = helpers_1.Parser;
|
|
58
|
-
async function runCommand(args, logger
|
|
59
|
-
var _a, _b
|
|
61
|
+
async function runCommand(args, logger) {
|
|
62
|
+
var _a, _b;
|
|
60
63
|
const { $0, _: positional, help = false, jsonHelp = false, ...rest } = yargsParser(args, { boolean: ['help', 'json-help'], alias: { 'collection': 'c' } });
|
|
64
|
+
let workspace;
|
|
65
|
+
let globalConfiguration;
|
|
66
|
+
try {
|
|
67
|
+
[workspace, globalConfiguration] = await Promise.all([
|
|
68
|
+
(0, config_1.getWorkspace)('local'),
|
|
69
|
+
(0, config_1.getWorkspace)('global'),
|
|
70
|
+
]);
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
logger.fatal(e.message);
|
|
74
|
+
return 1;
|
|
75
|
+
}
|
|
76
|
+
const root = (_a = workspace === null || workspace === void 0 ? void 0 : workspace.basePath) !== null && _a !== void 0 ? _a : process.cwd();
|
|
61
77
|
const context = {
|
|
78
|
+
globalConfiguration,
|
|
62
79
|
workspace,
|
|
63
80
|
logger,
|
|
64
81
|
currentDirectory: process.cwd(),
|
|
65
|
-
root
|
|
66
|
-
packageManager:
|
|
82
|
+
root,
|
|
83
|
+
packageManager: new package_manager_1.PackageManagerUtils({ globalConfiguration, workspace, root }),
|
|
67
84
|
args: {
|
|
68
85
|
positional: positional.map((v) => v.toString()),
|
|
69
86
|
options: {
|
|
@@ -130,6 +147,6 @@ async function runCommand(args, logger, workspace) {
|
|
|
130
147
|
})
|
|
131
148
|
.wrap(yargs_1.default.terminalWidth())
|
|
132
149
|
.parseAsync();
|
|
133
|
-
return (
|
|
150
|
+
return (_b = process.exitCode) !== null && _b !== void 0 ? _b : 0;
|
|
134
151
|
}
|
|
135
152
|
exports.runCommand = runCommand;
|
|
@@ -10,6 +10,7 @@ import { FileSystemCollectionDescription, FileSystemSchematicDescription, NodeWo
|
|
|
10
10
|
import { Argv } from 'yargs';
|
|
11
11
|
import { CommandModule, CommandModuleImplementation, CommandScope, Options, OtherOptions } from './command-module';
|
|
12
12
|
import { Option } from './utilities/json-schema';
|
|
13
|
+
export declare const DEFAULT_SCHEMATICS_COLLECTION = "@schematics/angular";
|
|
13
14
|
export interface SchematicsCommandArgs {
|
|
14
15
|
interactive: boolean;
|
|
15
16
|
force: boolean;
|
|
@@ -30,8 +31,8 @@ export declare abstract class SchematicsCommandModule extends CommandModule<Sche
|
|
|
30
31
|
protected getOrCreateWorkflowForBuilder(collectionName: string): NodeWorkflow;
|
|
31
32
|
private _workflowForExecution;
|
|
32
33
|
protected getOrCreateWorkflowForExecution(collectionName: string, options: SchematicsExecutionOptions): Promise<NodeWorkflow>;
|
|
33
|
-
private
|
|
34
|
-
protected
|
|
34
|
+
private _schematicCollections;
|
|
35
|
+
protected getSchematicCollections(): Promise<Set<string>>;
|
|
35
36
|
protected parseSchematicInfo(schematic: string | undefined): [collectionName: string | undefined, schematicName: string | undefined];
|
|
36
37
|
protected runSchematic(options: {
|
|
37
38
|
executionOptions: SchematicsExecutionOptions;
|
|
@@ -39,6 +40,7 @@ export declare abstract class SchematicsCommandModule extends CommandModule<Sche
|
|
|
39
40
|
collectionName: string;
|
|
40
41
|
schematicName: string;
|
|
41
42
|
}): Promise<number>;
|
|
43
|
+
private defaultProjectDeprecationWarningShown;
|
|
42
44
|
private getProjectName;
|
|
43
45
|
private getResolvePaths;
|
|
44
46
|
}
|