@angular/cli 14.0.0-next.1 → 14.0.0-next.12
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/bin/ng.js +3 -5
- package/lib/cli/index.d.ts +1 -2
- package/lib/cli/index.js +16 -45
- package/lib/config/schema.json +48 -15
- package/lib/config/workspace-schema.d.ts +18 -1
- package/lib/init.js +10 -9
- package/package.json +21 -23
- package/{models → src/analytics}/analytics-collector.d.ts +0 -0
- package/{models → src/analytics}/analytics-collector.js +8 -2
- package/src/analytics/analytics.d.ts +47 -0
- package/src/analytics/analytics.js +306 -0
- package/src/command-builder/architect-base-command-module.d.ts +30 -0
- package/src/command-builder/architect-base-command-module.js +165 -0
- package/src/command-builder/architect-command-module.d.ts +25 -0
- package/src/command-builder/architect-command-module.js +134 -0
- package/src/command-builder/command-module.d.ts +89 -0
- package/src/command-builder/command-module.js +198 -0
- package/{utilities/package-json.js → src/command-builder/command-runner.d.ts} +2 -2
- package/src/command-builder/command-runner.js +168 -0
- package/src/command-builder/schematics-command-module.d.ts +43 -0
- package/src/command-builder/schematics-command-module.js +333 -0
- package/src/command-builder/utilities/command.d.ts +13 -0
- package/src/command-builder/utilities/command.js +27 -0
- package/src/command-builder/utilities/json-help.d.ts +36 -0
- package/src/command-builder/utilities/json-help.js +94 -0
- package/src/command-builder/utilities/json-schema.d.ts +40 -0
- package/{utilities → src/command-builder/utilities}/json-schema.js +20 -121
- package/src/command-builder/utilities/normalize-options-middleware.d.ts +18 -0
- package/src/command-builder/utilities/normalize-options-middleware.js +59 -0
- package/{models → src/command-builder/utilities}/schematic-engine-host.d.ts +2 -2
- package/{models → src/command-builder/utilities}/schematic-engine-host.js +33 -18
- package/src/command-builder/utilities/schematic-workflow.d.ts +14 -0
- package/src/command-builder/utilities/schematic-workflow.js +68 -0
- package/src/commands/add/cli.d.ts +33 -0
- package/{commands/add-impl.js → src/commands/add/cli.js} +108 -80
- package/src/commands/add/long-description.md +7 -0
- package/src/commands/analytics/cli.d.ts +16 -0
- package/src/commands/analytics/cli.js +35 -0
- package/src/commands/analytics/info/cli.d.ts +16 -0
- package/src/commands/analytics/info/cli.js +26 -0
- package/src/commands/analytics/settings/cli.d.ts +35 -0
- package/src/commands/analytics/settings/cli.js +61 -0
- package/src/commands/build/cli.d.ts +16 -0
- package/src/commands/build/cli.js +23 -0
- package/{commands/build-long.md → src/commands/build/long-description.md} +0 -0
- 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 +49 -0
- package/src/commands/completion/cli.d.ts +16 -0
- package/src/commands/completion/cli.js +31 -0
- package/src/commands/completion/long-description.md +1 -0
- package/src/commands/config/cli.d.ts +24 -0
- package/{commands/config-impl.js → src/commands/config/cli.js} +102 -89
- package/{commands/config-long.md → src/commands/config/long-description.md} +2 -2
- package/src/commands/deploy/cli.d.ts +17 -0
- package/src/commands/deploy/cli.js +49 -0
- package/{commands/deploy-long.md → src/commands/deploy/long-description.md} +0 -0
- package/src/commands/doc/cli.d.ts +23 -0
- package/{commands/doc-impl.js → src/commands/doc/cli.js} +41 -12
- package/src/commands/e2e/cli.d.ts +18 -0
- package/src/commands/e2e/cli.js +35 -0
- package/src/commands/extract-i18n/cli.d.ts +15 -0
- package/src/commands/extract-i18n/cli.js +20 -0
- package/src/commands/generate/cli.d.ts +39 -0
- package/src/commands/generate/cli.js +145 -0
- package/src/commands/lint/cli.d.ts +17 -0
- package/src/commands/lint/cli.js +28 -0
- package/{commands/lint-long.md → src/commands/lint/long-description.md} +0 -0
- package/src/commands/make-this-awesome/cli.d.ts +17 -0
- package/{commands/easter-egg-impl.js → src/commands/make-this-awesome/cli.js} +17 -10
- package/src/commands/new/cli.d.ts +27 -0
- package/src/commands/new/cli.js +82 -0
- package/src/commands/run/cli.d.ts +25 -0
- package/src/commands/run/cli.js +83 -0
- package/{commands/run-long.md → src/commands/run/long-description.md} +0 -0
- package/src/commands/serve/cli.d.ts +16 -0
- package/src/commands/serve/cli.js +21 -0
- package/src/commands/test/cli.d.ts +16 -0
- package/src/commands/test/cli.js +23 -0
- package/{commands/test-long.md → src/commands/test/long-description.md} +0 -0
- package/{commands/update-impl.d.ts → src/commands/update/cli.d.ts} +26 -9
- package/{commands/update-impl.js → src/commands/update/cli.js} +363 -316
- package/{commands/update-long.md → src/commands/update/long-description.md} +0 -0
- package/src/commands/update/schematic/index.js +33 -20
- package/src/commands/version/cli.d.ts +18 -0
- package/{commands/version-impl.js → src/commands/version/cli.js} +56 -74
- package/src/typings-bazel.d.ts +14 -0
- package/src/typings.d.ts +1 -14
- package/{utilities → src/utilities}/color.d.ts +0 -0
- package/{utilities → src/utilities}/color.js +5 -1
- package/{utilities → src/utilities}/config.d.ts +6 -5
- package/{utilities → src/utilities}/config.js +33 -19
- package/src/utilities/environment-options.d.ts +12 -0
- package/src/utilities/environment-options.js +24 -0
- package/{utilities → src/utilities}/find-up.d.ts +0 -0
- package/{utilities → src/utilities}/find-up.js +5 -1
- package/{utilities → src/utilities}/json-file.d.ts +0 -0
- package/{utilities → src/utilities}/json-file.js +1 -0
- package/{utilities → src/utilities}/log-file.d.ts +0 -0
- package/{utilities → src/utilities}/log-file.js +0 -0
- package/src/utilities/memoize.d.ts +15 -0
- package/src/utilities/memoize.js +69 -0
- package/src/utilities/package-manager.d.ts +41 -0
- package/src/utilities/package-manager.js +287 -0
- package/{utilities → src/utilities}/package-metadata.d.ts +15 -37
- package/{utilities → src/utilities}/package-metadata.js +15 -27
- package/{utilities → src/utilities}/package-tree.d.ts +2 -2
- package/{utilities → src/utilities}/package-tree.js +5 -1
- package/{utilities → src/utilities}/project.d.ts +0 -0
- package/{utilities → src/utilities}/project.js +5 -1
- package/{utilities → src/utilities}/prompt.d.ts +2 -0
- package/{utilities → src/utilities}/prompt.js +25 -4
- package/{utilities → src/utilities}/spinner.d.ts +0 -0
- package/{utilities → src/utilities}/spinner.js +0 -0
- package/{utilities → src/utilities}/tty.d.ts +0 -0
- package/{utilities → src/utilities}/tty.js +0 -0
- package/{models → src/utilities}/version.d.ts +2 -1
- package/{models → src/utilities}/version.js +6 -6
- package/bin/postinstall/analytics-prompt.js +0 -27
- package/bin/postinstall/script.js +0 -16
- package/commands/add-impl.d.ts +0 -21
- package/commands/add.d.ts +0 -42
- package/commands/add.js +0 -10
- package/commands/add.json +0 -54
- package/commands/add.md +0 -10
- package/commands/analytics-impl.d.ts +0 -13
- package/commands/analytics-impl.js +0 -80
- package/commands/analytics-long.md +0 -8
- package/commands/analytics.d.ts +0 -46
- package/commands/analytics.js +0 -31
- package/commands/analytics.json +0 -37
- package/commands/build-impl.d.ts +0 -14
- package/commands/build-impl.js +0 -21
- package/commands/build.d.ts +0 -30
- package/commands/build.js +0 -10
- package/commands/build.json +0 -16
- package/commands/config-impl.d.ts +0 -15
- package/commands/config.d.ts +0 -34
- package/commands/config.js +0 -10
- package/commands/config.json +0 -43
- package/commands/definitions.json +0 -66
- package/commands/deploy-impl.d.ts +0 -15
- package/commands/deploy-impl.js +0 -36
- package/commands/deploy.d.ts +0 -30
- package/commands/deploy.js +0 -10
- package/commands/deploy.json +0 -34
- package/commands/doc-impl.d.ts +0 -13
- package/commands/doc.d.ts +0 -39
- package/commands/doc.js +0 -14
- package/commands/doc.json +0 -46
- package/commands/e2e-impl.d.ts +0 -16
- package/commands/e2e-impl.js +0 -36
- package/commands/e2e-long.md +0 -4
- package/commands/e2e.d.ts +0 -29
- package/commands/e2e.js +0 -10
- package/commands/e2e.json +0 -17
- package/commands/easter-egg-impl.d.ts +0 -12
- package/commands/easter-egg.d.ts +0 -14
- package/commands/easter-egg.js +0 -10
- package/commands/easter-egg.json +0 -12
- package/commands/extract-i18n-impl.d.ts +0 -14
- package/commands/extract-i18n-impl.js +0 -32
- package/commands/extract-i18n.d.ts +0 -29
- package/commands/extract-i18n.js +0 -10
- package/commands/extract-i18n.json +0 -17
- package/commands/generate-impl.d.ts +0 -18
- package/commands/generate-impl.js +0 -89
- package/commands/generate.d.ts +0 -37
- package/commands/generate.js +0 -10
- package/commands/generate.json +0 -31
- package/commands/help-impl.d.ts +0 -12
- package/commands/help-impl.js +0 -26
- package/commands/help-long.md +0 -7
- package/commands/help.d.ts +0 -17
- package/commands/help.js +0 -10
- package/commands/help.json +0 -13
- package/commands/lint-impl.d.ts +0 -16
- package/commands/lint-impl.js +0 -69
- package/commands/lint.d.ts +0 -29
- package/commands/lint.js +0 -10
- package/commands/lint.json +0 -36
- package/commands/new-impl.d.ts +0 -16
- package/commands/new-impl.js +0 -37
- package/commands/new.d.ts +0 -41
- package/commands/new.js +0 -10
- package/commands/new.json +0 -34
- package/commands/new.md +0 -16
- package/commands/run-impl.d.ts +0 -13
- package/commands/run-impl.js +0 -22
- package/commands/run.d.ts +0 -30
- package/commands/run.js +0 -10
- package/commands/run.json +0 -36
- package/commands/serve-impl.d.ts +0 -15
- package/commands/serve-impl.js +0 -24
- package/commands/serve.d.ts +0 -29
- package/commands/serve.js +0 -10
- package/commands/serve.json +0 -17
- package/commands/test-impl.d.ts +0 -15
- package/commands/test-impl.js +0 -22
- package/commands/test.d.ts +0 -29
- package/commands/test.js +0 -10
- package/commands/test.json +0 -17
- package/commands/update.d.ts +0 -61
- package/commands/update.js +0 -10
- package/commands/update.json +0 -78
- package/commands/version-impl.d.ts +0 -17
- package/commands/version.d.ts +0 -17
- package/commands/version.js +0 -10
- package/commands/version.json +0 -13
- package/commands.json +0 -20
- package/models/analytics.d.ts +0 -58
- package/models/analytics.js +0 -358
- package/models/architect-command.d.ts +0 -35
- package/models/architect-command.js +0 -364
- package/models/command-runner.d.ts +0 -24
- package/models/command-runner.js +0 -241
- package/models/command.d.ts +0 -34
- package/models/command.js +0 -143
- package/models/interface.d.ts +0 -196
- package/models/interface.js +0 -31
- package/models/parser.d.ts +0 -39
- package/models/parser.js +0 -349
- package/models/schematic-command.d.ts +0 -55
- package/models/schematic-command.js +0 -485
- package/utilities/INITIAL_COMMIT_MESSAGE.txt +0 -8
- package/utilities/install-package.d.ts +0 -16
- package/utilities/install-package.js +0 -193
- package/utilities/json-schema.d.ts +0 -17
- package/utilities/package-json.d.ts +0 -249
- package/utilities/package-manager.d.ts +0 -13
- package/utilities/package-manager.js +0 -106
|
@@ -10,22 +10,20 @@ 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.
|
|
13
|
+
exports.AddCommandModule = void 0;
|
|
14
14
|
const core_1 = require("@angular-devkit/core");
|
|
15
15
|
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
16
16
|
const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
|
|
17
17
|
const path_1 = require("path");
|
|
18
18
|
const semver_1 = require("semver");
|
|
19
|
-
const workspace_schema_1 = require("
|
|
20
|
-
const analytics_1 = require("
|
|
21
|
-
const
|
|
22
|
-
const color_1 = require("
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const spinner_1 = require("../utilities/spinner");
|
|
28
|
-
const tty_1 = require("../utilities/tty");
|
|
19
|
+
const workspace_schema_1 = require("../../../lib/config/workspace-schema");
|
|
20
|
+
const analytics_1 = require("../../analytics/analytics");
|
|
21
|
+
const schematics_command_module_1 = require("../../command-builder/schematics-command-module");
|
|
22
|
+
const color_1 = require("../../utilities/color");
|
|
23
|
+
const package_metadata_1 = require("../../utilities/package-metadata");
|
|
24
|
+
const prompt_1 = require("../../utilities/prompt");
|
|
25
|
+
const spinner_1 = require("../../utilities/spinner");
|
|
26
|
+
const tty_1 = require("../../utilities/tty");
|
|
29
27
|
/**
|
|
30
28
|
* The set of packages that should have certain versions excluded from consideration
|
|
31
29
|
* when attempting to find a compatible version for a package.
|
|
@@ -35,34 +33,64 @@ const packageVersionExclusions = {
|
|
|
35
33
|
// @angular/localize@9.x versions do not have peer dependencies setup
|
|
36
34
|
'@angular/localize': '9.x',
|
|
37
35
|
};
|
|
38
|
-
class
|
|
36
|
+
class AddCommandModule extends schematics_command_module_1.SchematicsCommandModule {
|
|
39
37
|
constructor() {
|
|
40
38
|
super(...arguments);
|
|
39
|
+
this.command = 'add <collection>';
|
|
40
|
+
this.describe = 'Adds support for an external library to your project.';
|
|
41
|
+
this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
|
41
42
|
this.allowPrivateSchematics = true;
|
|
43
|
+
this.schematicName = 'ng-add';
|
|
42
44
|
}
|
|
43
|
-
async
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
async builder(argv) {
|
|
46
|
+
const localYargs = (await super.builder(argv))
|
|
47
|
+
.positional('collection', {
|
|
48
|
+
description: 'The package to be added.',
|
|
49
|
+
type: 'string',
|
|
50
|
+
demandOption: true,
|
|
51
|
+
})
|
|
52
|
+
.option('registry', { description: 'The NPM registry to use.', type: 'string' })
|
|
53
|
+
.option('verbose', {
|
|
54
|
+
description: 'Display additional details about internal operations during execution.',
|
|
55
|
+
type: 'boolean',
|
|
56
|
+
default: false,
|
|
57
|
+
})
|
|
58
|
+
.option('skip-confirmation', {
|
|
59
|
+
description: 'Skip asking a confirmation prompt before installing and executing the package. ' +
|
|
60
|
+
'Ensure package name is correct prior to using this option.',
|
|
61
|
+
type: 'boolean',
|
|
62
|
+
default: false,
|
|
63
|
+
})
|
|
64
|
+
// Prior to downloading we don't know the full schema and therefore we cannot be strict on the options.
|
|
65
|
+
// Possibly in the future update the logic to use the following syntax:
|
|
66
|
+
// `ng add @angular/localize -- --package-options`.
|
|
67
|
+
.strict(false);
|
|
68
|
+
const collectionName = await this.getCollectionName();
|
|
69
|
+
const workflow = await this.getOrCreateWorkflowForBuilder(collectionName);
|
|
70
|
+
try {
|
|
71
|
+
const collection = workflow.engine.createCollection(collectionName);
|
|
72
|
+
const options = await this.getSchematicOptions(collection, this.schematicName, workflow);
|
|
73
|
+
return this.addSchemaOptionsToCommand(localYargs, options);
|
|
46
74
|
}
|
|
47
|
-
|
|
48
|
-
|
|
75
|
+
catch (error) {
|
|
76
|
+
// During `ng add` prior to the downloading of the package
|
|
77
|
+
// we are not able to resolve and create a collection.
|
|
78
|
+
// Or when the the collection value is a path to a tarball.
|
|
49
79
|
}
|
|
80
|
+
return localYargs;
|
|
50
81
|
}
|
|
51
82
|
// eslint-disable-next-line max-lines-per-function
|
|
52
83
|
async run(options) {
|
|
53
84
|
var _a;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
`${color_1.colors.yellow('ng add [name] ')}. For more details, use "ng help".`);
|
|
58
|
-
return 1;
|
|
59
|
-
}
|
|
85
|
+
const { logger, packageManager } = this.context;
|
|
86
|
+
const { verbose, registry, collection, skipConfirmation } = options;
|
|
87
|
+
packageManager.ensureCompatibility();
|
|
60
88
|
let packageIdentifier;
|
|
61
89
|
try {
|
|
62
|
-
packageIdentifier = (0, npm_package_arg_1.default)(
|
|
90
|
+
packageIdentifier = (0, npm_package_arg_1.default)(collection);
|
|
63
91
|
}
|
|
64
92
|
catch (e) {
|
|
65
|
-
|
|
93
|
+
logger.error(e.message);
|
|
66
94
|
return 1;
|
|
67
95
|
}
|
|
68
96
|
if (packageIdentifier.name &&
|
|
@@ -71,29 +99,28 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
71
99
|
const validVersion = await this.isProjectVersionValid(packageIdentifier);
|
|
72
100
|
if (validVersion) {
|
|
73
101
|
// Already installed so just run schematic
|
|
74
|
-
|
|
75
|
-
return this.executeSchematic(packageIdentifier.name
|
|
102
|
+
logger.info('Skipping installation: Package already installed');
|
|
103
|
+
return this.executeSchematic({ ...options, collection: packageIdentifier.name });
|
|
76
104
|
}
|
|
77
105
|
}
|
|
78
106
|
const spinner = new spinner_1.Spinner();
|
|
79
107
|
spinner.start('Determining package manager...');
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
spinner.info(`Using package manager: ${color_1.colors.grey(packageManager)}`);
|
|
108
|
+
const usingYarn = packageManager.name === workspace_schema_1.PackageManager.Yarn;
|
|
109
|
+
spinner.info(`Using package manager: ${color_1.colors.grey(packageManager.name)}`);
|
|
83
110
|
if (packageIdentifier.name && packageIdentifier.type === 'tag' && !packageIdentifier.rawSpec) {
|
|
84
111
|
// only package name provided; search for viable version
|
|
85
112
|
// plus special cases for packages that did not have peer deps setup
|
|
86
113
|
spinner.start('Searching for compatible package version...');
|
|
87
114
|
let packageMetadata;
|
|
88
115
|
try {
|
|
89
|
-
packageMetadata = await (0, package_metadata_1.fetchPackageMetadata)(packageIdentifier.name,
|
|
90
|
-
registry
|
|
116
|
+
packageMetadata = await (0, package_metadata_1.fetchPackageMetadata)(packageIdentifier.name, logger, {
|
|
117
|
+
registry,
|
|
91
118
|
usingYarn,
|
|
92
|
-
verbose
|
|
119
|
+
verbose,
|
|
93
120
|
});
|
|
94
121
|
}
|
|
95
122
|
catch (e) {
|
|
96
|
-
spinner.fail(
|
|
123
|
+
spinner.fail(`Unable to load package information from registry: ${e.message}`);
|
|
97
124
|
return 1;
|
|
98
125
|
}
|
|
99
126
|
// Start with the version tagged as `latest` if it exists
|
|
@@ -102,16 +129,8 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
102
129
|
packageIdentifier = npm_package_arg_1.default.resolve(latestManifest.name, latestManifest.version);
|
|
103
130
|
}
|
|
104
131
|
// Adjust the version based on name and peer dependencies
|
|
105
|
-
if (latestManifest
|
|
106
|
-
|
|
107
|
-
const version = await this.findProjectVersion('@angular/cli');
|
|
108
|
-
const semverOptions = { includePrerelease: true };
|
|
109
|
-
if (version &&
|
|
110
|
-
(((0, semver_1.validRange)(version) && (0, semver_1.intersects)(version, '7', semverOptions)) ||
|
|
111
|
-
((0, semver_1.valid)(version) && (0, semver_1.satisfies)(version, '7', semverOptions)))) {
|
|
112
|
-
packageIdentifier = npm_package_arg_1.default.resolve('@angular/pwa', '0.12');
|
|
113
|
-
}
|
|
114
|
-
}
|
|
132
|
+
if ((latestManifest === null || latestManifest === void 0 ? void 0 : latestManifest.peerDependencies) &&
|
|
133
|
+
Object.keys(latestManifest.peerDependencies).length === 0) {
|
|
115
134
|
spinner.succeed(`Found compatible package version: ${color_1.colors.grey(packageIdentifier.toString())}.`);
|
|
116
135
|
}
|
|
117
136
|
else if (!latestManifest || (await this.hasMismatchedPeer(latestManifest))) {
|
|
@@ -132,7 +151,7 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
132
151
|
}
|
|
133
152
|
return true;
|
|
134
153
|
});
|
|
135
|
-
versionManifests.sort((a, b) => (0, semver_1.
|
|
154
|
+
versionManifests.sort((a, b) => (0, semver_1.compare)(a.version, b.version, true));
|
|
136
155
|
let newIdentifier;
|
|
137
156
|
for (const versionManifest of versionManifests) {
|
|
138
157
|
if (!(await this.hasMismatchedPeer(versionManifest))) {
|
|
@@ -156,9 +175,9 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
156
175
|
let savePackage;
|
|
157
176
|
try {
|
|
158
177
|
spinner.start('Loading package information from registry...');
|
|
159
|
-
const manifest = await (0, package_metadata_1.fetchPackageManifest)(packageIdentifier.toString(),
|
|
160
|
-
registry
|
|
161
|
-
verbose
|
|
178
|
+
const manifest = await (0, package_metadata_1.fetchPackageManifest)(packageIdentifier.toString(), logger, {
|
|
179
|
+
registry,
|
|
180
|
+
verbose,
|
|
162
181
|
usingYarn,
|
|
163
182
|
});
|
|
164
183
|
savePackage = (_a = manifest['ng-add']) === null || _a === void 0 ? void 0 : _a.save;
|
|
@@ -174,38 +193,38 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
174
193
|
spinner.fail(`Unable to fetch package information for '${packageIdentifier}': ${e.message}`);
|
|
175
194
|
return 1;
|
|
176
195
|
}
|
|
177
|
-
if (!
|
|
196
|
+
if (!skipConfirmation) {
|
|
178
197
|
const confirmationResponse = await (0, prompt_1.askConfirmation)(`\nThe package ${color_1.colors.blue(packageIdentifier.raw)} will be installed and executed.\n` +
|
|
179
198
|
'Would you like to proceed?', true, false);
|
|
180
199
|
if (!confirmationResponse) {
|
|
181
200
|
if (!(0, tty_1.isTTY)()) {
|
|
182
|
-
|
|
201
|
+
logger.error('No terminal detected. ' +
|
|
183
202
|
`'--skip-confirmation' can be used to bypass installation confirmation. ` +
|
|
184
203
|
`Ensure package name is correct prior to '--skip-confirmation' option usage.`);
|
|
185
204
|
}
|
|
186
|
-
|
|
205
|
+
logger.error('Command aborted.');
|
|
187
206
|
return 1;
|
|
188
207
|
}
|
|
189
208
|
}
|
|
190
209
|
if (savePackage === false) {
|
|
191
210
|
// Temporary packages are located in a different directory
|
|
192
211
|
// Hence we need to resolve them using the temp path
|
|
193
|
-
const {
|
|
212
|
+
const { success, tempNodeModules } = await packageManager.installTemp(packageIdentifier.raw, registry ? [`--registry="${registry}"`] : undefined);
|
|
194
213
|
const resolvedCollectionPath = require.resolve((0, path_1.join)(collectionName, 'package.json'), {
|
|
195
214
|
paths: [tempNodeModules],
|
|
196
215
|
});
|
|
197
|
-
if (
|
|
198
|
-
return
|
|
216
|
+
if (!success) {
|
|
217
|
+
return 1;
|
|
199
218
|
}
|
|
200
219
|
collectionName = (0, path_1.dirname)(resolvedCollectionPath);
|
|
201
220
|
}
|
|
202
221
|
else {
|
|
203
|
-
const
|
|
204
|
-
if (
|
|
205
|
-
return
|
|
222
|
+
const success = await packageManager.install(packageIdentifier.raw, savePackage, registry ? [`--registry="${registry}"`] : undefined);
|
|
223
|
+
if (!success) {
|
|
224
|
+
return 1;
|
|
206
225
|
}
|
|
207
226
|
}
|
|
208
|
-
return this.executeSchematic(
|
|
227
|
+
return this.executeSchematic({ ...options, collection: collectionName });
|
|
209
228
|
}
|
|
210
229
|
async isProjectVersionValid(packageIdentifier) {
|
|
211
230
|
if (!packageIdentifier.name) {
|
|
@@ -228,16 +247,18 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
228
247
|
}
|
|
229
248
|
return validVersion;
|
|
230
249
|
}
|
|
231
|
-
async reportAnalytics(
|
|
232
|
-
const collection =
|
|
250
|
+
async reportAnalytics(options, paths) {
|
|
251
|
+
const collection = await this.getCollectionName();
|
|
252
|
+
const dimensions = [];
|
|
233
253
|
// Add the collection if it's safe listed.
|
|
234
254
|
if (collection && (0, analytics_1.isPackageNameSafeForAnalytics)(collection)) {
|
|
235
255
|
dimensions[core_1.analytics.NgCliAnalyticsDimensions.NgAddCollection] = collection;
|
|
236
256
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
257
|
+
return super.reportAnalytics(options, paths, dimensions);
|
|
258
|
+
}
|
|
259
|
+
async getCollectionName() {
|
|
260
|
+
const [, collectionName] = this.context.args.positional;
|
|
261
|
+
return collectionName;
|
|
241
262
|
}
|
|
242
263
|
isPackageInstalled(name) {
|
|
243
264
|
try {
|
|
@@ -251,20 +272,25 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
251
272
|
}
|
|
252
273
|
return false;
|
|
253
274
|
}
|
|
254
|
-
async executeSchematic(
|
|
255
|
-
const runOptions = {
|
|
256
|
-
schematicOptions: options,
|
|
257
|
-
collectionName,
|
|
258
|
-
schematicName: 'ng-add',
|
|
259
|
-
dryRun: false,
|
|
260
|
-
force: false,
|
|
261
|
-
};
|
|
275
|
+
async executeSchematic(options) {
|
|
262
276
|
try {
|
|
263
|
-
|
|
277
|
+
const { verbose, skipConfirmation, interactive, force, dryRun, registry, defaults, collection: collectionName, ...schematicOptions } = options;
|
|
278
|
+
return await this.runSchematic({
|
|
279
|
+
schematicOptions,
|
|
280
|
+
schematicName: this.schematicName,
|
|
281
|
+
collectionName,
|
|
282
|
+
executionOptions: {
|
|
283
|
+
interactive,
|
|
284
|
+
force,
|
|
285
|
+
dryRun,
|
|
286
|
+
defaults,
|
|
287
|
+
packageRegistry: registry,
|
|
288
|
+
},
|
|
289
|
+
});
|
|
264
290
|
}
|
|
265
291
|
catch (e) {
|
|
266
292
|
if (e instanceof tools_1.NodePackageDoesNotSupportSchematics) {
|
|
267
|
-
this.logger.error(core_1.tags.oneLine `
|
|
293
|
+
this.context.logger.error(core_1.tags.oneLine `
|
|
268
294
|
The package that you are trying to add does not support schematics. You can try using
|
|
269
295
|
a different version of the package or contact the package author to add ng-add support.
|
|
270
296
|
`);
|
|
@@ -274,27 +300,29 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
274
300
|
}
|
|
275
301
|
}
|
|
276
302
|
async findProjectVersion(name) {
|
|
303
|
+
var _a, _b;
|
|
304
|
+
const { logger, root } = this.context;
|
|
277
305
|
let installedPackage;
|
|
278
306
|
try {
|
|
279
307
|
installedPackage = require.resolve((0, path_1.join)(name, 'package.json'), {
|
|
280
|
-
paths: [
|
|
308
|
+
paths: [root],
|
|
281
309
|
});
|
|
282
310
|
}
|
|
283
311
|
catch { }
|
|
284
312
|
if (installedPackage) {
|
|
285
313
|
try {
|
|
286
|
-
const installed = await (0, package_metadata_1.fetchPackageManifest)((0, path_1.dirname)(installedPackage),
|
|
314
|
+
const installed = await (0, package_metadata_1.fetchPackageManifest)((0, path_1.dirname)(installedPackage), logger);
|
|
287
315
|
return installed.version;
|
|
288
316
|
}
|
|
289
317
|
catch { }
|
|
290
318
|
}
|
|
291
319
|
let projectManifest;
|
|
292
320
|
try {
|
|
293
|
-
projectManifest = await (0, package_metadata_1.fetchPackageManifest)(
|
|
321
|
+
projectManifest = await (0, package_metadata_1.fetchPackageManifest)(root, logger);
|
|
294
322
|
}
|
|
295
323
|
catch { }
|
|
296
324
|
if (projectManifest) {
|
|
297
|
-
const version = projectManifest.dependencies[name] || projectManifest.devDependencies[name];
|
|
325
|
+
const version = ((_a = projectManifest.dependencies) === null || _a === void 0 ? void 0 : _a[name]) || ((_b = projectManifest.devDependencies) === null || _b === void 0 ? void 0 : _b[name]);
|
|
298
326
|
if (version) {
|
|
299
327
|
return version;
|
|
300
328
|
}
|
|
@@ -308,7 +336,7 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
308
336
|
peerIdentifier = npm_package_arg_1.default.resolve(peer, manifest.peerDependencies[peer]);
|
|
309
337
|
}
|
|
310
338
|
catch {
|
|
311
|
-
this.logger.warn(`Invalid peer dependency ${peer} found in package.`);
|
|
339
|
+
this.context.logger.warn(`Invalid peer dependency ${peer} found in package.`);
|
|
312
340
|
continue;
|
|
313
341
|
}
|
|
314
342
|
if (peerIdentifier.type === 'version' || peerIdentifier.type === 'range') {
|
|
@@ -336,4 +364,4 @@ class AddCommand extends schematic_command_1.SchematicCommand {
|
|
|
336
364
|
return false;
|
|
337
365
|
}
|
|
338
366
|
}
|
|
339
|
-
exports.
|
|
367
|
+
exports.AddCommandModule = AddCommandModule;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Adds the npm package for a published library to your workspace, and configures
|
|
2
|
+
the project in the current working directory to use that library, as specified by the library's schematic.
|
|
3
|
+
For example, adding `@angular/pwa` configures your project for PWA support:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
ng add @angular/pwa
|
|
7
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { Argv } from 'yargs';
|
|
9
|
+
import { CommandModule, CommandModuleImplementation, Options } from '../../command-builder/command-module';
|
|
10
|
+
export declare class AnalyticsCommandModule extends CommandModule implements CommandModuleImplementation {
|
|
11
|
+
command: string;
|
|
12
|
+
describe: string;
|
|
13
|
+
longDescriptionPath?: string;
|
|
14
|
+
builder(localYargs: Argv): Argv;
|
|
15
|
+
run(_options: Options<{}>): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AnalyticsCommandModule = void 0;
|
|
11
|
+
const command_module_1 = require("../../command-builder/command-module");
|
|
12
|
+
const command_1 = require("../../command-builder/utilities/command");
|
|
13
|
+
const cli_1 = require("./info/cli");
|
|
14
|
+
const cli_2 = require("./settings/cli");
|
|
15
|
+
class AnalyticsCommandModule extends command_module_1.CommandModule {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.command = 'analytics';
|
|
19
|
+
this.describe = 'Configures the gathering of Angular CLI usage metrics. See https://angular.io/cli/usage-analytics-gathering';
|
|
20
|
+
}
|
|
21
|
+
builder(localYargs) {
|
|
22
|
+
const subcommands = [
|
|
23
|
+
cli_1.AnalyticsInfoCommandModule,
|
|
24
|
+
cli_2.AnalyticsDisableModule,
|
|
25
|
+
cli_2.AnalyticsEnableModule,
|
|
26
|
+
cli_2.AnalyticsPromptModule,
|
|
27
|
+
].sort(); // sort by class name.
|
|
28
|
+
for (const module of subcommands) {
|
|
29
|
+
localYargs = (0, command_1.addCommandModuleToYargs)(localYargs, module, this.context);
|
|
30
|
+
}
|
|
31
|
+
return localYargs.demandCommand(1, command_1.demandCommandFailureMessage).strict();
|
|
32
|
+
}
|
|
33
|
+
run(_options) { }
|
|
34
|
+
}
|
|
35
|
+
exports.AnalyticsCommandModule = AnalyticsCommandModule;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { Argv } from 'yargs';
|
|
9
|
+
import { CommandModule, CommandModuleImplementation, Options } from '../../../command-builder/command-module';
|
|
10
|
+
export declare class AnalyticsInfoCommandModule extends CommandModule implements CommandModuleImplementation {
|
|
11
|
+
command: string;
|
|
12
|
+
describe: string;
|
|
13
|
+
longDescriptionPath?: string;
|
|
14
|
+
builder(localYargs: Argv): Argv;
|
|
15
|
+
run(_options: Options<{}>): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AnalyticsInfoCommandModule = void 0;
|
|
11
|
+
const analytics_1 = require("../../../analytics/analytics");
|
|
12
|
+
const command_module_1 = require("../../../command-builder/command-module");
|
|
13
|
+
class AnalyticsInfoCommandModule extends command_module_1.CommandModule {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.command = 'info';
|
|
17
|
+
this.describe = 'Prints analytics gathering and reporting configuration in the console.';
|
|
18
|
+
}
|
|
19
|
+
builder(localYargs) {
|
|
20
|
+
return localYargs.strict();
|
|
21
|
+
}
|
|
22
|
+
async run(_options) {
|
|
23
|
+
this.context.logger.info(await (0, analytics_1.getAnalyticsInfoString)());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.AnalyticsInfoCommandModule = AnalyticsInfoCommandModule;
|
|
@@ -0,0 +1,35 @@
|
|
|
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, Options } from '../../../command-builder/command-module';
|
|
10
|
+
interface AnalyticsCommandArgs {
|
|
11
|
+
global: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare abstract class AnalyticsSettingModule extends CommandModule<AnalyticsCommandArgs> implements CommandModuleImplementation<AnalyticsCommandArgs> {
|
|
14
|
+
longDescriptionPath?: string;
|
|
15
|
+
builder(localYargs: Argv): Argv<AnalyticsCommandArgs>;
|
|
16
|
+
abstract run({ global }: Options<AnalyticsCommandArgs>): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare class AnalyticsDisableModule extends AnalyticsSettingModule implements CommandModuleImplementation<AnalyticsCommandArgs> {
|
|
19
|
+
command: string;
|
|
20
|
+
aliases: string;
|
|
21
|
+
describe: string;
|
|
22
|
+
run({ global }: Options<AnalyticsCommandArgs>): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export declare class AnalyticsEnableModule extends AnalyticsSettingModule implements CommandModuleImplementation<AnalyticsCommandArgs> {
|
|
25
|
+
command: string;
|
|
26
|
+
aliases: string;
|
|
27
|
+
describe: string;
|
|
28
|
+
run({ global }: Options<AnalyticsCommandArgs>): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export declare class AnalyticsPromptModule extends AnalyticsSettingModule implements CommandModuleImplementation<AnalyticsCommandArgs> {
|
|
31
|
+
command: string;
|
|
32
|
+
describe: string;
|
|
33
|
+
run({ global }: Options<AnalyticsCommandArgs>): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AnalyticsPromptModule = exports.AnalyticsEnableModule = exports.AnalyticsDisableModule = void 0;
|
|
11
|
+
const analytics_1 = require("../../../analytics/analytics");
|
|
12
|
+
const command_module_1 = require("../../../command-builder/command-module");
|
|
13
|
+
class AnalyticsSettingModule extends command_module_1.CommandModule {
|
|
14
|
+
builder(localYargs) {
|
|
15
|
+
return localYargs
|
|
16
|
+
.option('global', {
|
|
17
|
+
description: `Configure analytics gathering and reporting globally in the caller's home directory.`,
|
|
18
|
+
alias: ['g'],
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
default: false,
|
|
21
|
+
})
|
|
22
|
+
.strict();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
class AnalyticsDisableModule extends AnalyticsSettingModule {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this.command = 'disable';
|
|
29
|
+
this.aliases = 'off';
|
|
30
|
+
this.describe = 'Disables analytics gathering and reporting for the user.';
|
|
31
|
+
}
|
|
32
|
+
async run({ global }) {
|
|
33
|
+
await (0, analytics_1.setAnalyticsConfig)(global, false);
|
|
34
|
+
process.stderr.write(await (0, analytics_1.getAnalyticsInfoString)());
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.AnalyticsDisableModule = AnalyticsDisableModule;
|
|
38
|
+
class AnalyticsEnableModule extends AnalyticsSettingModule {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
this.command = 'enable';
|
|
42
|
+
this.aliases = 'on';
|
|
43
|
+
this.describe = 'Enables analytics gathering and reporting for the user.';
|
|
44
|
+
}
|
|
45
|
+
async run({ global }) {
|
|
46
|
+
await (0, analytics_1.setAnalyticsConfig)(global, true);
|
|
47
|
+
process.stderr.write(await (0, analytics_1.getAnalyticsInfoString)());
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.AnalyticsEnableModule = AnalyticsEnableModule;
|
|
51
|
+
class AnalyticsPromptModule extends AnalyticsSettingModule {
|
|
52
|
+
constructor() {
|
|
53
|
+
super(...arguments);
|
|
54
|
+
this.command = 'prompt';
|
|
55
|
+
this.describe = 'Prompts the user to set the analytics gathering status interactively.';
|
|
56
|
+
}
|
|
57
|
+
async run({ global }) {
|
|
58
|
+
await (0, analytics_1.promptAnalytics)(global, true);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.AnalyticsPromptModule = AnalyticsPromptModule;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
|
9
|
+
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
|
10
|
+
export declare class BuildCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
|
11
|
+
multiTarget: boolean;
|
|
12
|
+
command: string;
|
|
13
|
+
aliases: string[];
|
|
14
|
+
describe: string;
|
|
15
|
+
longDescriptionPath: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.BuildCommandModule = void 0;
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
|
13
|
+
class BuildCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.multiTarget = false;
|
|
17
|
+
this.command = 'build [project]';
|
|
18
|
+
this.aliases = ['b'];
|
|
19
|
+
this.describe = 'Compiles an Angular application or library into an output directory named dist/ at the given output path.';
|
|
20
|
+
this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.BuildCommandModule = BuildCommandModule;
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
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, CommandScope } from '../../../command-builder/command-module';
|
|
10
|
+
export declare class CacheCleanModule extends CommandModule implements CommandModuleImplementation {
|
|
11
|
+
command: string;
|
|
12
|
+
describe: string;
|
|
13
|
+
longDescriptionPath: string | undefined;
|
|
14
|
+
static scope: CommandScope.In;
|
|
15
|
+
builder(localYargs: Argv): Argv;
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CacheCleanModule = void 0;
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const command_module_1 = require("../../../command-builder/command-module");
|
|
13
|
+
const utilities_1 = require("../utilities");
|
|
14
|
+
class CacheCleanModule extends command_module_1.CommandModule {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.command = 'clean';
|
|
18
|
+
this.describe = 'Deletes persistent disk cache from disk.';
|
|
19
|
+
}
|
|
20
|
+
builder(localYargs) {
|
|
21
|
+
return localYargs.strict();
|
|
22
|
+
}
|
|
23
|
+
run() {
|
|
24
|
+
const { path } = (0, utilities_1.getCacheConfig)(this.context.workspace);
|
|
25
|
+
return fs_1.promises.rm(path, {
|
|
26
|
+
force: true,
|
|
27
|
+
recursive: true,
|
|
28
|
+
maxRetries: 3,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.CacheCleanModule = CacheCleanModule;
|