@angular/cli 14.0.0-next.7 → 14.0.0-next.8
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/package.json +13 -13
- package/src/command-builder/architect-base-command-module.d.ts +8 -1
- package/src/command-builder/architect-base-command-module.js +58 -2
- package/src/command-builder/architect-command-module.d.ts +0 -1
- package/src/command-builder/architect-command-module.js +11 -5
- package/src/command-builder/command-module.d.ts +0 -1
- package/src/command-builder/command-module.js +14 -7
- package/src/command-builder/schematics-command-module.d.ts +0 -3
- package/src/command-builder/schematics-command-module.js +20 -20
- package/src/commands/deploy/cli.d.ts +2 -1
- package/src/commands/deploy/cli.js +27 -13
- package/src/commands/e2e/cli.d.ts +2 -1
- package/src/commands/e2e/cli.js +14 -13
- package/src/commands/lint/cli.d.ts +2 -1
- package/src/commands/lint/cli.js +6 -9
- package/src/commands/new/cli.js +7 -2
- package/src/commands/update/cli.js +3 -2
- package/src/utilities/memoize.d.ts +15 -0
- package/src/utilities/memoize.js +69 -0
- package/src/utilities/package-manager.js +13 -2
- package/src/utilities/prompt.d.ts +2 -0
- package/src/utilities/prompt.js +18 -1
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.8",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/angular/angular-cli",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@angular-devkit/architect": "0.1400.0-next.
|
|
29
|
-
"@angular-devkit/core": "14.0.0-next.
|
|
30
|
-
"@angular-devkit/schematics": "14.0.0-next.
|
|
31
|
-
"@schematics/angular": "14.0.0-next.
|
|
28
|
+
"@angular-devkit/architect": "0.1400.0-next.8",
|
|
29
|
+
"@angular-devkit/core": "14.0.0-next.8",
|
|
30
|
+
"@angular-devkit/schematics": "14.0.0-next.8",
|
|
31
|
+
"@schematics/angular": "14.0.0-next.8",
|
|
32
32
|
"@yarnpkg/lockfile": "1.1.0",
|
|
33
33
|
"ansi-colors": "4.1.1",
|
|
34
34
|
"debug": "4.3.4",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"inquirer": "8.2.2",
|
|
37
37
|
"jsonc-parser": "3.0.0",
|
|
38
38
|
"npm-package-arg": "9.0.2",
|
|
39
|
-
"npm-pick-manifest": "7.0.
|
|
39
|
+
"npm-pick-manifest": "7.0.1",
|
|
40
40
|
"open": "8.4.0",
|
|
41
41
|
"ora": "5.4.1",
|
|
42
|
-
"pacote": "13.0
|
|
42
|
+
"pacote": "13.1.0",
|
|
43
43
|
"resolve": "1.22.0",
|
|
44
44
|
"semver": "7.3.5",
|
|
45
45
|
"symbol-observable": "4.0.0",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"ng-update": {
|
|
50
50
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
51
51
|
"packageGroup": {
|
|
52
|
-
"@angular/cli": "14.0.0-next.
|
|
53
|
-
"@angular-devkit/architect": "0.1400.0-next.
|
|
54
|
-
"@angular-devkit/build-angular": "14.0.0-next.
|
|
55
|
-
"@angular-devkit/build-webpack": "0.1400.0-next.
|
|
56
|
-
"@angular-devkit/core": "14.0.0-next.
|
|
57
|
-
"@angular-devkit/schematics": "14.0.0-next.
|
|
52
|
+
"@angular/cli": "14.0.0-next.8",
|
|
53
|
+
"@angular-devkit/architect": "0.1400.0-next.8",
|
|
54
|
+
"@angular-devkit/build-angular": "14.0.0-next.8",
|
|
55
|
+
"@angular-devkit/build-webpack": "0.1400.0-next.8",
|
|
56
|
+
"@angular-devkit/core": "14.0.0-next.8",
|
|
57
|
+
"@angular-devkit/schematics": "14.0.0-next.8"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
@@ -9,10 +9,14 @@ import { Architect, Target } from '@angular-devkit/architect';
|
|
|
9
9
|
import { WorkspaceNodeModulesArchitectHost } from '@angular-devkit/architect/node';
|
|
10
10
|
import { CommandModule, CommandModuleImplementation, CommandScope, OtherOptions } from './command-module';
|
|
11
11
|
import { Option } from './utilities/json-schema';
|
|
12
|
+
export interface MissingTargetChoice {
|
|
13
|
+
name: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
12
16
|
export declare abstract class ArchitectBaseCommandModule<T> extends CommandModule<T> implements CommandModuleImplementation<T> {
|
|
13
17
|
static scope: CommandScope;
|
|
14
18
|
protected shouldReportAnalytics: boolean;
|
|
15
|
-
protected readonly
|
|
19
|
+
protected readonly missingTargetChoices: MissingTargetChoice[] | undefined;
|
|
16
20
|
protected runSingleTarget(target: Target, options: OtherOptions): Promise<number>;
|
|
17
21
|
private _architectHost;
|
|
18
22
|
protected getArchitectHost(): WorkspaceNodeModulesArchitectHost;
|
|
@@ -20,4 +24,7 @@ export declare abstract class ArchitectBaseCommandModule<T> extends CommandModul
|
|
|
20
24
|
protected getArchitect(): Architect;
|
|
21
25
|
protected getArchitectTargetOptions(target: Target): Promise<Option[]>;
|
|
22
26
|
private warnOnMissingNodeModules;
|
|
27
|
+
protected getArchitectTarget(): string;
|
|
28
|
+
protected onMissingTarget(defaultMessage: string): Promise<1>;
|
|
29
|
+
private getMissingTargetPackageToInstall;
|
|
23
30
|
}
|
|
@@ -11,9 +11,12 @@ exports.ArchitectBaseCommandModule = void 0;
|
|
|
11
11
|
const architect_1 = require("@angular-devkit/architect");
|
|
12
12
|
const node_1 = require("@angular-devkit/architect/node");
|
|
13
13
|
const core_1 = require("@angular-devkit/core");
|
|
14
|
+
const child_process_1 = require("child_process");
|
|
14
15
|
const fs_1 = require("fs");
|
|
15
16
|
const path_1 = require("path");
|
|
16
17
|
const analytics_1 = require("../analytics/analytics");
|
|
18
|
+
const prompt_1 = require("../utilities/prompt");
|
|
19
|
+
const tty_1 = require("../utilities/tty");
|
|
17
20
|
const command_module_1 = require("./command-module");
|
|
18
21
|
const json_schema_1 = require("./utilities/json-schema");
|
|
19
22
|
class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
@@ -22,14 +25,13 @@ class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
|
22
25
|
this.shouldReportAnalytics = false;
|
|
23
26
|
}
|
|
24
27
|
async runSingleTarget(target, options) {
|
|
25
|
-
var _a;
|
|
26
28
|
const architectHost = await this.getArchitectHost();
|
|
27
29
|
let builderName;
|
|
28
30
|
try {
|
|
29
31
|
builderName = await architectHost.getBuilderNameForTarget(target);
|
|
30
32
|
}
|
|
31
33
|
catch (e) {
|
|
32
|
-
|
|
34
|
+
return this.onMissingTarget(e.message);
|
|
33
35
|
}
|
|
34
36
|
await this.reportAnalytics({
|
|
35
37
|
...(await architectHost.getOptionsForTarget(target)),
|
|
@@ -98,6 +100,60 @@ class ArchitectBaseCommandModule extends command_module_1.CommandModule {
|
|
|
98
100
|
}
|
|
99
101
|
this.context.logger.warn(`Node packages may not be installed. Try installing with '${this.context.packageManager} install'.`);
|
|
100
102
|
}
|
|
103
|
+
getArchitectTarget() {
|
|
104
|
+
return this.commandName;
|
|
105
|
+
}
|
|
106
|
+
async onMissingTarget(defaultMessage) {
|
|
107
|
+
const { logger } = this.context;
|
|
108
|
+
const choices = this.missingTargetChoices;
|
|
109
|
+
if (!(choices === null || choices === void 0 ? void 0 : choices.length)) {
|
|
110
|
+
logger.error(defaultMessage);
|
|
111
|
+
return 1;
|
|
112
|
+
}
|
|
113
|
+
const missingTargetMessage = `Cannot find "${this.getArchitectTarget()}" target for the specified project.\n` +
|
|
114
|
+
`You can add a package that implements these capabilities.\n\n` +
|
|
115
|
+
`For example:\n` +
|
|
116
|
+
choices.map(({ name, value }) => ` ${name}: ng add ${value}`).join('\n') +
|
|
117
|
+
'\n';
|
|
118
|
+
if ((0, tty_1.isTTY)()) {
|
|
119
|
+
// Use prompts to ask the user if they'd like to install a package.
|
|
120
|
+
logger.warn(missingTargetMessage);
|
|
121
|
+
const packageToInstall = await this.getMissingTargetPackageToInstall(choices);
|
|
122
|
+
if (packageToInstall) {
|
|
123
|
+
// Example run: `ng add @angular-eslint/schematics`.
|
|
124
|
+
const binPath = (0, path_1.resolve)(__dirname, '../../bin/ng.js');
|
|
125
|
+
const { error } = (0, child_process_1.spawnSync)(process.execPath, [binPath, 'add', packageToInstall], {
|
|
126
|
+
stdio: 'inherit',
|
|
127
|
+
});
|
|
128
|
+
if (error) {
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
// Non TTY display error message.
|
|
135
|
+
logger.error(missingTargetMessage);
|
|
136
|
+
}
|
|
137
|
+
return 1;
|
|
138
|
+
}
|
|
139
|
+
async getMissingTargetPackageToInstall(choices) {
|
|
140
|
+
if (choices.length === 1) {
|
|
141
|
+
// Single choice
|
|
142
|
+
const { name, value } = choices[0];
|
|
143
|
+
if (await (0, prompt_1.askConfirmation)(`Would you like to add ${name} now?`, true, false)) {
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
// Multiple choice
|
|
149
|
+
return (0, prompt_1.askQuestion)(`Would you like to add a package with "${this.getArchitectTarget()}" capabilities now?`, [
|
|
150
|
+
{
|
|
151
|
+
name: 'No',
|
|
152
|
+
value: null,
|
|
153
|
+
},
|
|
154
|
+
...choices,
|
|
155
|
+
], 0, null);
|
|
156
|
+
}
|
|
101
157
|
}
|
|
102
158
|
exports.ArchitectBaseCommandModule = ArchitectBaseCommandModule;
|
|
103
159
|
ArchitectBaseCommandModule.scope = command_module_1.CommandScope.In;
|
|
@@ -17,6 +17,5 @@ export declare abstract class ArchitectCommandModule extends ArchitectBaseComman
|
|
|
17
17
|
builder(argv: Argv): Promise<Argv<ArchitectCommandArgs>>;
|
|
18
18
|
run(options: Options<ArchitectCommandArgs> & OtherOptions): Promise<number | void>;
|
|
19
19
|
private getArchitectProject;
|
|
20
|
-
private getArchitectTarget;
|
|
21
20
|
private getProjectNamesByTarget;
|
|
22
21
|
}
|
|
@@ -6,9 +6,16 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
9
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
16
|
exports.ArchitectCommandModule = void 0;
|
|
11
17
|
const config_1 = require("../utilities/config");
|
|
18
|
+
const memoize_1 = require("../utilities/memoize");
|
|
12
19
|
const architect_base_command_module_1 = require("./architect-base-command-module");
|
|
13
20
|
const command_module_1 = require("./command-module");
|
|
14
21
|
class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBaseCommandModule {
|
|
@@ -39,7 +46,6 @@ class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBa
|
|
|
39
46
|
return this.addSchemaOptionsToCommand(localYargs, schemaOptions);
|
|
40
47
|
}
|
|
41
48
|
async run(options) {
|
|
42
|
-
var _a;
|
|
43
49
|
const target = this.getArchitectTarget();
|
|
44
50
|
const { configuration = '', project, ...architectOptions } = options;
|
|
45
51
|
if (!project) {
|
|
@@ -48,7 +54,7 @@ class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBa
|
|
|
48
54
|
let result = 0;
|
|
49
55
|
const projectNames = this.getProjectNamesByTarget(target);
|
|
50
56
|
if (!projectNames) {
|
|
51
|
-
|
|
57
|
+
return this.onMissingTarget('Cannot determine project or target for command.');
|
|
52
58
|
}
|
|
53
59
|
for (const project of projectNames) {
|
|
54
60
|
result |= await this.runSingleTarget({ configuration, target, project }, architectOptions);
|
|
@@ -75,9 +81,6 @@ class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBa
|
|
|
75
81
|
const projectFromTarget = this.getProjectNamesByTarget(target);
|
|
76
82
|
return (projectFromTarget === null || projectFromTarget === void 0 ? void 0 : projectFromTarget.length) ? projectFromTarget[0] : undefined;
|
|
77
83
|
}
|
|
78
|
-
getArchitectTarget() {
|
|
79
|
-
return this.commandName;
|
|
80
|
-
}
|
|
81
84
|
getProjectNamesByTarget(target) {
|
|
82
85
|
const workspace = this.getWorkspaceOrThrow();
|
|
83
86
|
const allProjectsForTargetName = [];
|
|
@@ -105,4 +108,7 @@ class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBa
|
|
|
105
108
|
return undefined;
|
|
106
109
|
}
|
|
107
110
|
}
|
|
111
|
+
__decorate([
|
|
112
|
+
memoize_1.memoize
|
|
113
|
+
], ArchitectCommandModule.prototype, "getProjectNamesByTarget", null);
|
|
108
114
|
exports.ArchitectCommandModule = ArchitectCommandModule;
|
|
@@ -72,7 +72,6 @@ export declare abstract class CommandModule<T extends {} = {}> implements Comman
|
|
|
72
72
|
abstract run(options: Options<T> & OtherOptions): Promise<number | void> | number | void;
|
|
73
73
|
handler(args: ArgumentsCamelCase<T> & OtherOptions): Promise<void>;
|
|
74
74
|
reportAnalytics(options: (Options<T> & OtherOptions) | OtherOptions, paths?: string[], dimensions?: (boolean | number | string)[]): Promise<void>;
|
|
75
|
-
private _analytics;
|
|
76
75
|
protected getAnalytics(): Promise<analytics.Analytics>;
|
|
77
76
|
/**
|
|
78
77
|
* Adds schema options to a command also this keeps track of options that are required for analytics.
|
|
@@ -22,6 +22,12 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
22
22
|
}) : function(o, v) {
|
|
23
23
|
o["default"] = v;
|
|
24
24
|
});
|
|
25
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
26
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
27
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
28
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
29
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
30
|
+
};
|
|
25
31
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
32
|
if (mod && mod.__esModule) return mod;
|
|
27
33
|
var result = {};
|
|
@@ -36,6 +42,7 @@ const fs_1 = require("fs");
|
|
|
36
42
|
const path = __importStar(require("path"));
|
|
37
43
|
const helpers_1 = require("yargs/helpers");
|
|
38
44
|
const analytics_1 = require("../analytics/analytics");
|
|
45
|
+
const memoize_1 = require("../utilities/memoize");
|
|
39
46
|
var CommandScope;
|
|
40
47
|
(function (CommandScope) {
|
|
41
48
|
/** Command can only run inside an Angular workspace. */
|
|
@@ -124,13 +131,10 @@ class CommandModule {
|
|
|
124
131
|
metrics: [],
|
|
125
132
|
});
|
|
126
133
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return this._analytics;
|
|
130
|
-
}
|
|
131
|
-
return (this._analytics = await (0, analytics_1.createAnalytics)(!!this.context.workspace,
|
|
134
|
+
getAnalytics() {
|
|
135
|
+
return (0, analytics_1.createAnalytics)(!!this.context.workspace,
|
|
132
136
|
// Don't prompt for `ng update` and `ng analytics` commands.
|
|
133
|
-
['update', 'analytics'].includes(this.commandName))
|
|
137
|
+
['update', 'analytics'].includes(this.commandName));
|
|
134
138
|
}
|
|
135
139
|
/**
|
|
136
140
|
* Adds schema options to a command also this keeps track of options that are required for analytics.
|
|
@@ -180,8 +184,11 @@ class CommandModule {
|
|
|
180
184
|
return workspace;
|
|
181
185
|
}
|
|
182
186
|
}
|
|
183
|
-
exports.CommandModule = CommandModule;
|
|
184
187
|
CommandModule.scope = CommandScope.Both;
|
|
188
|
+
__decorate([
|
|
189
|
+
memoize_1.memoize
|
|
190
|
+
], CommandModule.prototype, "getAnalytics", null);
|
|
191
|
+
exports.CommandModule = CommandModule;
|
|
185
192
|
/**
|
|
186
193
|
* Creates an known command module error.
|
|
187
194
|
* This is used so during executation we can filter between known validation error and real non handled errors.
|
|
@@ -27,11 +27,8 @@ export declare abstract class SchematicsCommandModule extends CommandModule<Sche
|
|
|
27
27
|
builder(argv: Argv): Promise<Argv<SchematicsCommandArgs>>;
|
|
28
28
|
/** Get schematic schema options.*/
|
|
29
29
|
protected getSchematicOptions(collection: Collection<FileSystemCollectionDescription, FileSystemSchematicDescription>, schematicName: string, workflow: NodeWorkflow): Promise<Option[]>;
|
|
30
|
-
private _workflowForBuilder;
|
|
31
30
|
protected getOrCreateWorkflowForBuilder(collectionName: string): NodeWorkflow;
|
|
32
|
-
private _workflowForExecution;
|
|
33
31
|
protected getOrCreateWorkflowForExecution(collectionName: string, options: SchematicsExecutionOptions): Promise<NodeWorkflow>;
|
|
34
|
-
private _schematicCollections;
|
|
35
32
|
protected getSchematicCollections(): Promise<Set<string>>;
|
|
36
33
|
protected parseSchematicInfo(schematic: string | undefined): [collectionName: string | undefined, schematicName: string | undefined];
|
|
37
34
|
protected runSchematic(options: {
|
|
@@ -22,6 +22,12 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
22
22
|
}) : function(o, v) {
|
|
23
23
|
o["default"] = v;
|
|
24
24
|
});
|
|
25
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
26
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
27
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
28
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
29
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
30
|
+
};
|
|
25
31
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
32
|
if (mod && mod.__esModule) return mod;
|
|
27
33
|
var result = {};
|
|
@@ -35,6 +41,7 @@ const core_1 = require("@angular-devkit/core");
|
|
|
35
41
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
36
42
|
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
37
43
|
const config_1 = require("../utilities/config");
|
|
44
|
+
const memoize_1 = require("../utilities/memoize");
|
|
38
45
|
const tty_1 = require("../utilities/tty");
|
|
39
46
|
const command_module_1 = require("./command-module");
|
|
40
47
|
const json_schema_1 = require("./utilities/json-schema");
|
|
@@ -46,7 +53,6 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
46
53
|
super(...arguments);
|
|
47
54
|
this.allowPrivateSchematics = false;
|
|
48
55
|
this.shouldReportAnalytics = false;
|
|
49
|
-
this._workflowForBuilder = new Map();
|
|
50
56
|
this.defaultProjectDeprecationWarningShown = false;
|
|
51
57
|
}
|
|
52
58
|
async builder(argv) {
|
|
@@ -83,21 +89,12 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
83
89
|
return (0, json_schema_1.parseJsonSchemaToOptions)(workflow.registry, schemaJson);
|
|
84
90
|
}
|
|
85
91
|
getOrCreateWorkflowForBuilder(collectionName) {
|
|
86
|
-
|
|
87
|
-
if (cached) {
|
|
88
|
-
return cached;
|
|
89
|
-
}
|
|
90
|
-
const workflow = new tools_1.NodeWorkflow(this.context.root, {
|
|
92
|
+
return new tools_1.NodeWorkflow(this.context.root, {
|
|
91
93
|
resolvePaths: this.getResolvePaths(collectionName),
|
|
92
94
|
engineHostCreator: (options) => new schematic_engine_host_1.SchematicEngineHost(options.resolvePaths),
|
|
93
95
|
});
|
|
94
|
-
this._workflowForBuilder.set(collectionName, workflow);
|
|
95
|
-
return workflow;
|
|
96
96
|
}
|
|
97
97
|
async getOrCreateWorkflowForExecution(collectionName, options) {
|
|
98
|
-
if (this._workflowForExecution) {
|
|
99
|
-
return this._workflowForExecution;
|
|
100
|
-
}
|
|
101
98
|
const { logger, root, packageManager } = this.context;
|
|
102
99
|
const { force, dryRun, packageRegistry } = options;
|
|
103
100
|
const workflow = new tools_1.NodeWorkflow(root, {
|
|
@@ -210,13 +207,10 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
210
207
|
}
|
|
211
208
|
});
|
|
212
209
|
}
|
|
213
|
-
return
|
|
210
|
+
return workflow;
|
|
214
211
|
}
|
|
215
212
|
async getSchematicCollections() {
|
|
216
213
|
var _a;
|
|
217
|
-
if (this._schematicCollections) {
|
|
218
|
-
return this._schematicCollections;
|
|
219
|
-
}
|
|
220
214
|
const getSchematicCollections = (configSection) => {
|
|
221
215
|
if (!configSection) {
|
|
222
216
|
return undefined;
|
|
@@ -236,18 +230,15 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
236
230
|
if (project) {
|
|
237
231
|
const value = getSchematicCollections(workspace.getProjectCli(project));
|
|
238
232
|
if (value) {
|
|
239
|
-
this._schematicCollections = value;
|
|
240
233
|
return value;
|
|
241
234
|
}
|
|
242
235
|
}
|
|
243
236
|
}
|
|
244
237
|
const value = (_a = getSchematicCollections(workspace === null || workspace === void 0 ? void 0 : workspace.getCli())) !== null && _a !== void 0 ? _a : getSchematicCollections(globalConfiguration === null || globalConfiguration === void 0 ? void 0 : globalConfiguration.getCli());
|
|
245
238
|
if (value) {
|
|
246
|
-
this._schematicCollections = value;
|
|
247
239
|
return value;
|
|
248
240
|
}
|
|
249
|
-
|
|
250
|
-
return this._schematicCollections;
|
|
241
|
+
return new Set([exports.DEFAULT_SCHEMATICS_COLLECTION]);
|
|
251
242
|
}
|
|
252
243
|
parseSchematicInfo(schematic) {
|
|
253
244
|
if (schematic === null || schematic === void 0 ? void 0 : schematic.includes(':')) {
|
|
@@ -331,5 +322,14 @@ class SchematicsCommandModule extends command_module_1.CommandModule {
|
|
|
331
322
|
[__dirname, process.cwd()];
|
|
332
323
|
}
|
|
333
324
|
}
|
|
334
|
-
exports.SchematicsCommandModule = SchematicsCommandModule;
|
|
335
325
|
SchematicsCommandModule.scope = command_module_1.CommandScope.In;
|
|
326
|
+
__decorate([
|
|
327
|
+
memoize_1.memoize
|
|
328
|
+
], SchematicsCommandModule.prototype, "getOrCreateWorkflowForBuilder", null);
|
|
329
|
+
__decorate([
|
|
330
|
+
memoize_1.memoize
|
|
331
|
+
], SchematicsCommandModule.prototype, "getOrCreateWorkflowForExecution", null);
|
|
332
|
+
__decorate([
|
|
333
|
+
memoize_1.memoize
|
|
334
|
+
], SchematicsCommandModule.prototype, "getSchematicCollections", null);
|
|
335
|
+
exports.SchematicsCommandModule = SchematicsCommandModule;
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
+
import { MissingTargetChoice } from '../../command-builder/architect-base-command-module';
|
|
8
9
|
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
|
9
10
|
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
|
10
11
|
export declare class DeployCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
|
11
|
-
|
|
12
|
+
missingTargetChoices: MissingTargetChoice[];
|
|
12
13
|
multiTarget: boolean;
|
|
13
14
|
command: string;
|
|
14
15
|
longDescriptionPath: string;
|
|
@@ -8,24 +8,38 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.DeployCommandModule = void 0;
|
|
11
|
-
const core_1 = require("@angular-devkit/core");
|
|
12
11
|
const path_1 = require("path");
|
|
13
12
|
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
|
14
13
|
class DeployCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
|
15
14
|
constructor() {
|
|
16
15
|
super(...arguments);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
// The below choices should be kept in sync with the list in https://angular.io/guide/deployment
|
|
17
|
+
this.missingTargetChoices = [
|
|
18
|
+
{
|
|
19
|
+
name: 'Amazon S3',
|
|
20
|
+
value: '@jefiozie/ngx-aws-deploy',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Azure',
|
|
24
|
+
value: '@azure/ng-deploy',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'Firebase',
|
|
28
|
+
value: '@angular/fire',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'Netlify',
|
|
32
|
+
value: '@netlify-builder/deploy',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'NPM',
|
|
36
|
+
value: 'ngx-deploy-npm',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'GitHub Pages',
|
|
40
|
+
value: 'angular-cli-ghpages',
|
|
41
|
+
},
|
|
42
|
+
];
|
|
29
43
|
this.multiTarget = false;
|
|
30
44
|
this.command = 'deploy [project]';
|
|
31
45
|
this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
+
import { MissingTargetChoice } from '../../command-builder/architect-base-command-module';
|
|
8
9
|
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
|
9
10
|
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
|
10
11
|
export declare class E2eCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
|
12
|
+
missingTargetChoices: MissingTargetChoice[];
|
|
11
13
|
multiTarget: boolean;
|
|
12
|
-
missingErrorTarget: string;
|
|
13
14
|
command: string;
|
|
14
15
|
aliases: string[];
|
|
15
16
|
describe: string;
|
package/src/commands/e2e/cli.js
CHANGED
|
@@ -8,24 +8,25 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.E2eCommandModule = void 0;
|
|
11
|
-
const core_1 = require("@angular-devkit/core");
|
|
12
11
|
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
|
13
12
|
class E2eCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
|
14
13
|
constructor() {
|
|
15
14
|
super(...arguments);
|
|
15
|
+
this.missingTargetChoices = [
|
|
16
|
+
{
|
|
17
|
+
name: 'Cypress',
|
|
18
|
+
value: '@cypress/schematic',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'Nightwatch',
|
|
22
|
+
value: '@nightwatch/schematics',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'WebdriverIO',
|
|
26
|
+
value: '@wdio/schematics',
|
|
27
|
+
},
|
|
28
|
+
];
|
|
16
29
|
this.multiTarget = true;
|
|
17
|
-
this.missingErrorTarget = core_1.tags.stripIndents `
|
|
18
|
-
Cannot find "e2e" target for the specified project.
|
|
19
|
-
|
|
20
|
-
You should add a package that implements end-to-end testing capabilities.
|
|
21
|
-
|
|
22
|
-
For example:
|
|
23
|
-
Cypress: ng add @cypress/schematic
|
|
24
|
-
Nightwatch: ng add @nightwatch/schematics
|
|
25
|
-
WebdriverIO: ng add @wdio/schematics
|
|
26
|
-
|
|
27
|
-
More options will be added to the list as they become available.
|
|
28
|
-
`;
|
|
29
30
|
this.command = 'e2e [project]';
|
|
30
31
|
this.aliases = ['e'];
|
|
31
32
|
this.describe = 'Builds and serves an Angular application, then runs end-to-end tests.';
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
+
import { MissingTargetChoice } from '../../command-builder/architect-base-command-module';
|
|
8
9
|
import { ArchitectCommandModule } from '../../command-builder/architect-command-module';
|
|
9
10
|
import { CommandModuleImplementation } from '../../command-builder/command-module';
|
|
10
11
|
export declare class LintCommandModule extends ArchitectCommandModule implements CommandModuleImplementation {
|
|
11
|
-
|
|
12
|
+
missingTargetChoices: MissingTargetChoice[];
|
|
12
13
|
multiTarget: boolean;
|
|
13
14
|
command: string;
|
|
14
15
|
longDescriptionPath: string;
|
package/src/commands/lint/cli.js
CHANGED
|
@@ -8,20 +8,17 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.LintCommandModule = void 0;
|
|
11
|
-
const core_1 = require("@angular-devkit/core");
|
|
12
11
|
const path_1 = require("path");
|
|
13
12
|
const architect_command_module_1 = require("../../command-builder/architect-command-module");
|
|
14
13
|
class LintCommandModule extends architect_command_module_1.ArchitectCommandModule {
|
|
15
14
|
constructor() {
|
|
16
15
|
super(...arguments);
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
ng add @angular-eslint/schematics
|
|
24
|
-
`;
|
|
16
|
+
this.missingTargetChoices = [
|
|
17
|
+
{
|
|
18
|
+
name: 'ESLint',
|
|
19
|
+
value: '@angular-eslint/schematics',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
25
22
|
this.multiTarget = true;
|
|
26
23
|
this.command = 'lint [project]';
|
|
27
24
|
this.longDescriptionPath = (0, path_1.join)(__dirname, 'long-description.md');
|
package/src/commands/new/cli.js
CHANGED
|
@@ -39,9 +39,14 @@ class NewCommandModule extends schematics_command_module_1.SchematicsCommandModu
|
|
|
39
39
|
var _a;
|
|
40
40
|
// Register the version of the CLI in the registry.
|
|
41
41
|
const collectionName = (_a = options.collection) !== null && _a !== void 0 ? _a : (await this.getCollectionFromConfig());
|
|
42
|
-
const workflow = await this.getOrCreateWorkflowForExecution(collectionName, options);
|
|
43
|
-
workflow.registry.addSmartDefaultProvider('ng-cli-version', () => version_1.VERSION.full);
|
|
44
42
|
const { dryRun, force, interactive, defaults, collection, ...schematicOptions } = options;
|
|
43
|
+
const workflow = await this.getOrCreateWorkflowForExecution(collectionName, {
|
|
44
|
+
dryRun,
|
|
45
|
+
force,
|
|
46
|
+
interactive,
|
|
47
|
+
defaults,
|
|
48
|
+
});
|
|
49
|
+
workflow.registry.addSmartDefaultProvider('ng-cli-version', () => version_1.VERSION.full);
|
|
45
50
|
// Compatibility check for NPM 7
|
|
46
51
|
if (collectionName === '@schematics/angular' &&
|
|
47
52
|
!schematicOptions.skipInstall &&
|
|
@@ -67,7 +67,8 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
67
67
|
return localYargs
|
|
68
68
|
.positional('packages', {
|
|
69
69
|
description: 'The names of package(s) to update.',
|
|
70
|
-
|
|
70
|
+
type: 'string',
|
|
71
|
+
array: true,
|
|
71
72
|
})
|
|
72
73
|
.option('force', {
|
|
73
74
|
description: 'Ignore peer dependency version mismatches. ' +
|
|
@@ -656,7 +657,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
|
|
|
656
657
|
* @returns the version to install or null when there is no update to install.
|
|
657
658
|
*/
|
|
658
659
|
async checkCLIVersion(packagesToUpdate, verbose = false, next = false) {
|
|
659
|
-
const { version } = await (0, package_metadata_1.fetchPackageManifest)(`@angular/cli@${this.getCLIUpdateRunnerVersion(
|
|
660
|
+
const { version } = await (0, package_metadata_1.fetchPackageManifest)(`@angular/cli@${this.getCLIUpdateRunnerVersion(packagesToUpdate, next)}`, this.context.logger, {
|
|
660
661
|
verbose,
|
|
661
662
|
usingYarn: this.context.packageManager.name === workspace_schema_1.PackageManager.Yarn,
|
|
662
663
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* A decorator that memoizes methods and getters.
|
|
10
|
+
*
|
|
11
|
+
* **Note**: Be cautious where and how to use this decorator as the size of the cache will grow unbounded.
|
|
12
|
+
*
|
|
13
|
+
* @see https://en.wikipedia.org/wiki/Memoization
|
|
14
|
+
*/
|
|
15
|
+
export declare function memoize<T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
|
@@ -0,0 +1,69 @@
|
|
|
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.memoize = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* A decorator that memoizes methods and getters.
|
|
13
|
+
*
|
|
14
|
+
* **Note**: Be cautious where and how to use this decorator as the size of the cache will grow unbounded.
|
|
15
|
+
*
|
|
16
|
+
* @see https://en.wikipedia.org/wiki/Memoization
|
|
17
|
+
*/
|
|
18
|
+
function memoize(target, propertyKey, descriptor) {
|
|
19
|
+
const descriptorPropertyName = descriptor.get ? 'get' : 'value';
|
|
20
|
+
const originalMethod = descriptor[descriptorPropertyName];
|
|
21
|
+
if (typeof originalMethod !== 'function') {
|
|
22
|
+
throw new Error('Memoize decorator can only be used on methods or get accessors.');
|
|
23
|
+
}
|
|
24
|
+
const cache = new Map();
|
|
25
|
+
return {
|
|
26
|
+
...descriptor,
|
|
27
|
+
[descriptorPropertyName]: function (...args) {
|
|
28
|
+
for (const arg of args) {
|
|
29
|
+
if (!isJSONSerializable(arg)) {
|
|
30
|
+
throw new Error(`Argument ${isNonPrimitive(arg) ? arg.toString() : arg} is JSON serializable.`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const key = JSON.stringify(args);
|
|
34
|
+
if (cache.has(key)) {
|
|
35
|
+
return cache.get(key);
|
|
36
|
+
}
|
|
37
|
+
const result = originalMethod.apply(this, args);
|
|
38
|
+
cache.set(key, result);
|
|
39
|
+
return result;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.memoize = memoize;
|
|
44
|
+
/** Method to check if value is a non primitive. */
|
|
45
|
+
function isNonPrimitive(value) {
|
|
46
|
+
return ((value !== null && typeof value === 'object') ||
|
|
47
|
+
typeof value === 'function' ||
|
|
48
|
+
typeof value === 'symbol');
|
|
49
|
+
}
|
|
50
|
+
/** Method to check if the values are JSON serializable */
|
|
51
|
+
function isJSONSerializable(value) {
|
|
52
|
+
if (!isNonPrimitive(value)) {
|
|
53
|
+
// Can be seralized since it's a primitive.
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
let nestedValues;
|
|
57
|
+
if (Array.isArray(value)) {
|
|
58
|
+
// It's an array, check each item.
|
|
59
|
+
nestedValues = value;
|
|
60
|
+
}
|
|
61
|
+
else if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
62
|
+
// It's a plain object, check each value.
|
|
63
|
+
nestedValues = Object.values(value);
|
|
64
|
+
}
|
|
65
|
+
if (!nestedValues || nestedValues.some((v) => !isJSONSerializable(v))) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
9
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
16
|
exports.PackageManagerUtils = void 0;
|
|
11
17
|
const core_1 = require("@angular-devkit/core");
|
|
@@ -16,6 +22,7 @@ const path_1 = require("path");
|
|
|
16
22
|
const semver_1 = require("semver");
|
|
17
23
|
const workspace_schema_1 = require("../../lib/config/workspace-schema");
|
|
18
24
|
const config_1 = require("./config");
|
|
25
|
+
const memoize_1 = require("./memoize");
|
|
19
26
|
const spinner_1 = require("./spinner");
|
|
20
27
|
class PackageManagerUtils {
|
|
21
28
|
constructor(context) {
|
|
@@ -168,7 +175,6 @@ class PackageManagerUtils {
|
|
|
168
175
|
(_b = childProcess.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => bufferedOutput.push({ stream: process.stderr, data: data }));
|
|
169
176
|
});
|
|
170
177
|
}
|
|
171
|
-
// TODO(alan-agius4): use the memoize decorator when it's merged.
|
|
172
178
|
getVersion(name) {
|
|
173
179
|
try {
|
|
174
180
|
return (0, child_process_1.execSync)(`${name} --version`, {
|
|
@@ -186,7 +192,6 @@ class PackageManagerUtils {
|
|
|
186
192
|
return undefined;
|
|
187
193
|
}
|
|
188
194
|
}
|
|
189
|
-
// TODO(alan-agius4): use the memoize decorator when it's merged.
|
|
190
195
|
getName() {
|
|
191
196
|
const packageManager = this.getConfiguredPackageManager();
|
|
192
197
|
if (packageManager) {
|
|
@@ -273,4 +278,10 @@ class PackageManagerUtils {
|
|
|
273
278
|
return result;
|
|
274
279
|
}
|
|
275
280
|
}
|
|
281
|
+
__decorate([
|
|
282
|
+
memoize_1.memoize
|
|
283
|
+
], PackageManagerUtils.prototype, "getVersion", null);
|
|
284
|
+
__decorate([
|
|
285
|
+
memoize_1.memoize
|
|
286
|
+
], PackageManagerUtils.prototype, "getName", null);
|
|
276
287
|
exports.PackageManagerUtils = PackageManagerUtils;
|
|
@@ -5,4 +5,6 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
+
import type { ListChoiceOptions } from 'inquirer';
|
|
8
9
|
export declare function askConfirmation(message: string, defaultResponse: boolean, noTTYResponse?: boolean): Promise<boolean>;
|
|
10
|
+
export declare function askQuestion(message: string, choices: ListChoiceOptions[], defaultResponseIndex: number, noTTYResponse: null | string): Promise<string | null>;
|
package/src/utilities/prompt.js
CHANGED
|
@@ -30,7 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.askConfirmation = void 0;
|
|
33
|
+
exports.askQuestion = exports.askConfirmation = void 0;
|
|
34
34
|
const tty_1 = require("./tty");
|
|
35
35
|
async function askConfirmation(message, defaultResponse, noTTYResponse) {
|
|
36
36
|
if (!(0, tty_1.isTTY)()) {
|
|
@@ -48,3 +48,20 @@ async function askConfirmation(message, defaultResponse, noTTYResponse) {
|
|
|
48
48
|
return answers['confirmation'];
|
|
49
49
|
}
|
|
50
50
|
exports.askConfirmation = askConfirmation;
|
|
51
|
+
async function askQuestion(message, choices, defaultResponseIndex, noTTYResponse) {
|
|
52
|
+
if (!(0, tty_1.isTTY)()) {
|
|
53
|
+
return noTTYResponse;
|
|
54
|
+
}
|
|
55
|
+
const question = {
|
|
56
|
+
type: 'list',
|
|
57
|
+
name: 'answer',
|
|
58
|
+
prefix: '',
|
|
59
|
+
message,
|
|
60
|
+
choices,
|
|
61
|
+
default: defaultResponseIndex,
|
|
62
|
+
};
|
|
63
|
+
const { prompt } = await Promise.resolve().then(() => __importStar(require('inquirer')));
|
|
64
|
+
const answers = await prompt([question]);
|
|
65
|
+
return answers['answer'];
|
|
66
|
+
}
|
|
67
|
+
exports.askQuestion = askQuestion;
|