@hubspot/cli 7.7.18-experimental.0 → 7.7.19-experimental.1
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/commands/mcp/setup.js +0 -1
- package/commands/mcp/start.d.ts +1 -4
- package/commands/mcp/start.js +3 -10
- package/commands/open.js +14 -12
- package/commands/project/dev/unifiedFlow.js +1 -1
- package/commands/testAccount/create.js +11 -24
- package/lang/en.d.ts +43 -5
- package/lang/en.js +43 -5
- package/lib/app/migrate.js +2 -6
- package/lib/buildAccount.d.ts +7 -1
- package/lib/buildAccount.js +54 -4
- package/lib/mcp/setup.js +3 -8
- package/lib/projects/create/v3.d.ts +3 -2
- package/lib/projects/create/v3.js +2 -2
- package/lib/projects/localDev/helpers.d.ts +1 -1
- package/lib/projects/localDev/helpers.js +2 -2
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +9 -10
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +86 -47
- package/lib/prompts/createModulePrompt.js +1 -2
- package/lib/prompts/projectAddPrompt.d.ts +2 -1
- package/lib/prompts/projectAddPrompt.js +2 -1
- package/lib/prompts/promptUtils.d.ts +2 -2
- package/lib/prompts/promptUtils.js +161 -35
- package/lib/prompts/selectProjectTemplatePrompt.d.ts +2 -1
- package/lib/prompts/selectProjectTemplatePrompt.js +2 -1
- package/lib/usageTracking.d.ts +5 -5
- package/lib/usageTracking.js +79 -71
- package/mcp-server/tools/project/CreateProjectTool.d.ts +2 -2
- package/mcp-server/tools/project/UploadProjectTools.js +1 -1
- package/mcp-server/utils/project.js +0 -3
- package/package.json +3 -3
- package/types/Prompts.d.ts +4 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createDeveloperTestAccountConfigPrompt = createDeveloperTestAccountConfigPrompt;
|
|
4
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
4
5
|
const en_1 = require("../../lang/en");
|
|
5
6
|
const promptUtils_1 = require("./promptUtils");
|
|
6
7
|
const hubs = {
|
|
@@ -10,32 +11,43 @@ const hubs = {
|
|
|
10
11
|
SALES: 'salesLevel',
|
|
11
12
|
CONTENT: 'contentLevel',
|
|
12
13
|
};
|
|
14
|
+
const AccountTiers = {
|
|
15
|
+
FREE: 'FREE',
|
|
16
|
+
STARTER: 'STARTER',
|
|
17
|
+
PROFESSIONAL: 'PROFESSIONAL',
|
|
18
|
+
ENTERPRISE: 'ENTERPRISE',
|
|
19
|
+
};
|
|
20
|
+
const makeHubTiers = (hubKey) => {
|
|
21
|
+
const langKey = hubKey.toLowerCase();
|
|
22
|
+
const langObj = en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.tiers[langKey];
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
name: langObj.free,
|
|
26
|
+
value: `${hubKey.toUpperCase()}:${AccountTiers.FREE}`,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: langObj.starter,
|
|
30
|
+
value: `${hubKey.toUpperCase()}:${AccountTiers.STARTER}`,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: langObj.professional,
|
|
34
|
+
value: `${hubKey.toUpperCase()}:${AccountTiers.PROFESSIONAL}`,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
};
|
|
13
38
|
const TEST_ACCOUNT_TIERS = [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
promptUtils_1.Separator,
|
|
25
|
-
{ name: 'Service STARTER', value: 'SERVICE:STARTER' },
|
|
26
|
-
{ name: 'Service PROFESSIONAL', value: 'SERVICE:PROFESSIONAL' },
|
|
27
|
-
{ name: 'Service ENTERPRISE', value: 'SERVICE:ENTERPRISE' },
|
|
28
|
-
promptUtils_1.Separator,
|
|
29
|
-
{ name: 'Sales STARTER', value: 'SALES:STARTER' },
|
|
30
|
-
{ name: 'Sales PROFESSIONAL', value: 'SALES:PROFESSIONAL' },
|
|
31
|
-
{ name: 'Sales ENTERPRISE', value: 'SALES:ENTERPRISE' },
|
|
32
|
-
promptUtils_1.Separator,
|
|
33
|
-
{ name: 'Content STARTER', value: 'CONTENT:STARTER' },
|
|
34
|
-
{ name: 'Content PROFESSIONAL', value: 'CONTENT:PROFESSIONAL' },
|
|
35
|
-
{ name: 'Content ENTERPRISE', value: 'CONTENT:ENTERPRISE' },
|
|
36
|
-
promptUtils_1.Separator,
|
|
39
|
+
...makeHubTiers('MARKETING'),
|
|
40
|
+
new prompts_1.Separator(),
|
|
41
|
+
...makeHubTiers('OPS'),
|
|
42
|
+
new prompts_1.Separator(),
|
|
43
|
+
...makeHubTiers('SERVICE'),
|
|
44
|
+
new prompts_1.Separator(),
|
|
45
|
+
...makeHubTiers('SALES'),
|
|
46
|
+
new prompts_1.Separator(),
|
|
47
|
+
...makeHubTiers('CONTENT'),
|
|
48
|
+
new prompts_1.Separator(),
|
|
37
49
|
];
|
|
38
|
-
async function createDeveloperTestAccountConfigPrompt(args = {}) {
|
|
50
|
+
async function createDeveloperTestAccountConfigPrompt(args = {}, supportFlags = true) {
|
|
39
51
|
const { name, description, tiers } = args;
|
|
40
52
|
let accountName = name;
|
|
41
53
|
let accountDescription = description;
|
|
@@ -43,7 +55,7 @@ async function createDeveloperTestAccountConfigPrompt(args = {}) {
|
|
|
43
55
|
if (!accountName) {
|
|
44
56
|
const namePromptResult = await (0, promptUtils_1.promptUser)({
|
|
45
57
|
name: 'accountName',
|
|
46
|
-
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.namePrompt,
|
|
58
|
+
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.namePrompt(supportFlags),
|
|
47
59
|
type: 'input',
|
|
48
60
|
});
|
|
49
61
|
accountName = namePromptResult.accountName;
|
|
@@ -51,43 +63,70 @@ async function createDeveloperTestAccountConfigPrompt(args = {}) {
|
|
|
51
63
|
if (!accountDescription) {
|
|
52
64
|
const descriptionPromptResult = await (0, promptUtils_1.promptUser)({
|
|
53
65
|
name: 'description',
|
|
54
|
-
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.descriptionPrompt,
|
|
66
|
+
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.descriptionPrompt(supportFlags),
|
|
55
67
|
type: 'input',
|
|
56
68
|
});
|
|
57
69
|
accountDescription = descriptionPromptResult.description;
|
|
58
70
|
}
|
|
59
71
|
if (!accountLevelsArray) {
|
|
60
|
-
const
|
|
61
|
-
name: '
|
|
62
|
-
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
const useDefaultAccountLevelsPromptResult = await (0, promptUtils_1.promptUser)({
|
|
73
|
+
name: 'useDefaultAccountLevels',
|
|
74
|
+
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt
|
|
75
|
+
.useDefaultAccountLevelsPrompt.message,
|
|
76
|
+
type: 'list',
|
|
77
|
+
choices: [
|
|
78
|
+
{
|
|
79
|
+
name: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt
|
|
80
|
+
.useDefaultAccountLevelsPrompt.default,
|
|
81
|
+
value: 'default',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt
|
|
85
|
+
.useDefaultAccountLevelsPrompt.manual,
|
|
86
|
+
value: 'manual',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
});
|
|
90
|
+
if (useDefaultAccountLevelsPromptResult.useDefaultAccountLevels === 'manual') {
|
|
91
|
+
const accountLevelsPromptResult = await (0, promptUtils_1.promptUser)({
|
|
92
|
+
name: 'testAccountLevels',
|
|
93
|
+
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.tiersPrompt(supportFlags),
|
|
94
|
+
pageSize: 10,
|
|
95
|
+
type: 'checkbox',
|
|
96
|
+
choices: TEST_ACCOUNT_TIERS,
|
|
97
|
+
validate: choices => {
|
|
98
|
+
if (choices?.length > 1) {
|
|
99
|
+
const hubMap = {};
|
|
100
|
+
for (const choice of choices) {
|
|
101
|
+
const hub = choice.value.split(':')[0];
|
|
102
|
+
if (hubMap[hub]) {
|
|
103
|
+
return en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.errors
|
|
104
|
+
.tiersError;
|
|
105
|
+
}
|
|
106
|
+
hubMap[hub] = true;
|
|
73
107
|
}
|
|
74
|
-
hubMap[hub] = true;
|
|
75
108
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
109
|
+
return true;
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
accountLevelsArray = accountLevelsPromptResult.testAccountLevels;
|
|
113
|
+
}
|
|
81
114
|
}
|
|
82
115
|
if (!accountLevelsArray) {
|
|
83
116
|
accountLevelsArray = [];
|
|
84
117
|
}
|
|
85
118
|
const accountLevels = accountLevelsArray.reduce((acc, level) => {
|
|
86
|
-
const [
|
|
87
|
-
const hubLevel = hubs[
|
|
119
|
+
const [hubKey, hubTier] = level.split(':');
|
|
120
|
+
const hubLevel = hubs[hubKey];
|
|
88
121
|
acc[hubLevel] = hubTier;
|
|
89
122
|
return acc;
|
|
90
123
|
}, {});
|
|
124
|
+
Object.values(hubs).forEach(hubLevel => {
|
|
125
|
+
if (!accountLevels[hubLevel]) {
|
|
126
|
+
accountLevels[hubLevel] = AccountTiers.ENTERPRISE;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
console.log('accountLevels', accountLevels);
|
|
91
130
|
return {
|
|
92
131
|
accountName: accountName,
|
|
93
132
|
description: accountDescription,
|
|
@@ -26,9 +26,8 @@ const CONTENT_TYPES_PROMPT = {
|
|
|
26
26
|
type: 'checkbox',
|
|
27
27
|
name: 'contentTypes',
|
|
28
28
|
message: (0, lang_1.i18n)(`lib.prompts.createModulePrompt.selectContentType`),
|
|
29
|
-
default: ['ANY'],
|
|
30
29
|
choices: [
|
|
31
|
-
{ name: 'Any', value: 'ANY' },
|
|
30
|
+
{ name: 'Any', value: 'ANY', checked: true },
|
|
32
31
|
{ name: 'Landing page', value: 'LANDING_PAGE' },
|
|
33
32
|
{ name: 'Site page', value: 'SITE_PAGE' },
|
|
34
33
|
{ name: 'Blog post', value: 'BLOG_POST' },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Separator } from '@inquirer/prompts';
|
|
1
2
|
import { ComponentTemplate, ComponentTemplateChoice } from '../../types/Projects';
|
|
2
3
|
type ProjectAddPromptResponse = {
|
|
3
4
|
componentTemplate: ComponentTemplate;
|
|
@@ -10,5 +11,5 @@ export declare function projectAddPrompt(components: ComponentTemplate[], prompt
|
|
|
10
11
|
name?: string;
|
|
11
12
|
type?: string;
|
|
12
13
|
}): Promise<ProjectAddPromptResponse>;
|
|
13
|
-
export declare function projectAddPromptV3(components: ComponentTemplateChoice[], selectedFeatures: string[] | undefined): Promise<ProjectAddPromptResponseV3>;
|
|
14
|
+
export declare function projectAddPromptV3(components: (ComponentTemplateChoice | Separator)[], selectedFeatures: string[] | undefined): Promise<ProjectAddPromptResponseV3>;
|
|
14
15
|
export {};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.projectAddPrompt = projectAddPrompt;
|
|
4
4
|
exports.projectAddPromptV3 = projectAddPromptV3;
|
|
5
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
5
6
|
const promptUtils_1 = require("./promptUtils");
|
|
6
7
|
const en_1 = require("../../lang/en");
|
|
7
8
|
function findComponentByPathOrLabel(components, componentPathOrLabel) {
|
|
@@ -51,7 +52,7 @@ async function projectAddPromptV3(components, selectedFeatures) {
|
|
|
51
52
|
const selectedComponents = [];
|
|
52
53
|
if (selectedFeatures) {
|
|
53
54
|
components.forEach(template => {
|
|
54
|
-
if (!template.value) {
|
|
55
|
+
if (template instanceof prompts_1.Separator || !template.value) {
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
58
|
if (selectedFeatures?.includes(template.value.type)) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { Separator as _Separator } from '@inquirer/prompts';
|
|
1
2
|
import { PromptConfig, GenericPromptResponse, PromptWhen, PromptChoices } from '../../types/Prompts';
|
|
2
|
-
export declare const Separator:
|
|
3
|
+
export declare const Separator: _Separator;
|
|
3
4
|
export declare function promptUser<T extends GenericPromptResponse>(config: PromptConfig<T> | PromptConfig<T>[]): Promise<T>;
|
|
4
5
|
export declare function confirmPrompt(message: string, options?: {
|
|
5
6
|
defaultAnswer?: boolean;
|
|
6
|
-
when?: PromptWhen;
|
|
7
7
|
}): Promise<boolean>;
|
|
8
8
|
export declare function listPrompt<T = string>(message: string, { choices, when, defaultAnswer, validate, }: {
|
|
9
9
|
choices: PromptChoices<T>;
|
|
@@ -5,49 +5,175 @@ exports.promptUser = promptUser;
|
|
|
5
5
|
exports.confirmPrompt = confirmPrompt;
|
|
6
6
|
exports.listPrompt = listPrompt;
|
|
7
7
|
exports.inputPrompt = inputPrompt;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
9
|
+
exports.Separator = new prompts_1.Separator();
|
|
10
|
+
function mapPromptChoicesToChoices(choices) {
|
|
11
|
+
return (choices?.map(choice => {
|
|
12
|
+
if (typeof choice === 'string') {
|
|
13
|
+
return { value: choice, name: choice };
|
|
14
|
+
}
|
|
15
|
+
else if (choice instanceof prompts_1.Separator) {
|
|
16
|
+
return choice;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
value: choice.value,
|
|
20
|
+
name: choice.name,
|
|
21
|
+
disabled: choice.disabled,
|
|
22
|
+
checked: choice.checked,
|
|
23
|
+
};
|
|
24
|
+
}) || []);
|
|
25
|
+
}
|
|
26
|
+
function handleArrayConfig(config) {
|
|
27
|
+
return (async () => {
|
|
28
|
+
const result = {};
|
|
29
|
+
for (const prompt of config) {
|
|
30
|
+
if (prompt.when !== undefined) {
|
|
31
|
+
const shouldPrompt = typeof prompt.when === 'function'
|
|
32
|
+
? prompt.when()
|
|
33
|
+
: (prompt.when ?? true);
|
|
34
|
+
if (!shouldPrompt) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (typeof prompt.message === 'function') {
|
|
39
|
+
prompt.message = prompt.message(result);
|
|
40
|
+
}
|
|
41
|
+
// Pass the accumulated results to each prompt
|
|
42
|
+
const promptWithAnswers = {
|
|
43
|
+
...prompt,
|
|
44
|
+
default: typeof prompt.default === 'function'
|
|
45
|
+
? (answers) => {
|
|
46
|
+
const mergedAnswers = { ...answers, ...result };
|
|
47
|
+
return prompt.default(mergedAnswers);
|
|
48
|
+
}
|
|
49
|
+
: prompt.default,
|
|
50
|
+
};
|
|
51
|
+
const response = await promptUser(promptWithAnswers);
|
|
52
|
+
Object.assign(result, response);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
})();
|
|
56
|
+
}
|
|
11
57
|
function promptUser(config) {
|
|
12
|
-
|
|
58
|
+
if (Array.isArray(config)) {
|
|
59
|
+
return handleArrayConfig(config);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (config.when !== undefined) {
|
|
63
|
+
const shouldPrompt = typeof config.when === 'function'
|
|
64
|
+
? config.when()
|
|
65
|
+
: (config.when ?? true);
|
|
66
|
+
if (!shouldPrompt) {
|
|
67
|
+
return Promise.resolve({});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
switch (config.type) {
|
|
72
|
+
case 'list':
|
|
73
|
+
return handleSelectPrompt(config);
|
|
74
|
+
case 'input':
|
|
75
|
+
return handleInputPrompt(config);
|
|
76
|
+
case 'confirm':
|
|
77
|
+
return handleConfirmPrompt(config);
|
|
78
|
+
case 'checkbox':
|
|
79
|
+
return handleCheckboxPrompt(config);
|
|
80
|
+
case 'password':
|
|
81
|
+
return handlePasswordPrompt(config);
|
|
82
|
+
case 'number':
|
|
83
|
+
return handleNumberPrompt(config);
|
|
84
|
+
case 'rawlist':
|
|
85
|
+
return handleRawListPrompt(config);
|
|
86
|
+
default:
|
|
87
|
+
return handleInputPrompt(config);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function handleRawListPrompt(config) {
|
|
91
|
+
const choices = mapPromptChoicesToChoices(config.choices);
|
|
92
|
+
choices.map((choice, index) => {
|
|
93
|
+
if (!(choice instanceof prompts_1.Separator)) {
|
|
94
|
+
choice.name = `${index + 1}) ${choice.name}`;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return (0, prompts_1.select)({
|
|
98
|
+
message: config.message,
|
|
99
|
+
choices: choices,
|
|
100
|
+
pageSize: config.pageSize,
|
|
101
|
+
default: config.default,
|
|
102
|
+
}).then(resp => ({ [config.name]: resp }));
|
|
103
|
+
}
|
|
104
|
+
function handleNumberPrompt(config) {
|
|
105
|
+
return (0, prompts_1.number)({
|
|
106
|
+
message: config.message,
|
|
107
|
+
default: config.default,
|
|
108
|
+
validate: config.validate,
|
|
109
|
+
}).then(resp => ({ [config.name]: resp }));
|
|
110
|
+
}
|
|
111
|
+
function handlePasswordPrompt(config) {
|
|
112
|
+
return (0, prompts_1.password)({
|
|
113
|
+
message: config.message,
|
|
114
|
+
mask: '*',
|
|
115
|
+
validate: config.validate,
|
|
116
|
+
}).then(resp => ({ [config.name]: resp }));
|
|
117
|
+
}
|
|
118
|
+
function handleCheckboxPrompt(config) {
|
|
119
|
+
const choices = mapPromptChoicesToChoices(config.choices);
|
|
120
|
+
return (0, prompts_1.checkbox)({
|
|
121
|
+
message: config.message,
|
|
122
|
+
choices: choices,
|
|
123
|
+
pageSize: config.pageSize,
|
|
124
|
+
validate: config.validate,
|
|
125
|
+
}).then(resp => ({ [config.name]: resp }));
|
|
126
|
+
}
|
|
127
|
+
function handleConfirmPrompt(config) {
|
|
128
|
+
return confirmPrompt(config.message, {
|
|
129
|
+
defaultAnswer: config.default,
|
|
130
|
+
}).then(resp => ({ [config.name]: resp }));
|
|
131
|
+
}
|
|
132
|
+
function handleInputPrompt(config) {
|
|
133
|
+
return (0, prompts_1.input)({
|
|
134
|
+
message: config.message,
|
|
135
|
+
default: config.default,
|
|
136
|
+
validate: config.validate,
|
|
137
|
+
transformer: config.transformer,
|
|
138
|
+
}).then(resp => ({ [config.name]: resp }));
|
|
139
|
+
}
|
|
140
|
+
function handleSelectPrompt(config) {
|
|
141
|
+
const choices = mapPromptChoicesToChoices(config.choices);
|
|
142
|
+
return (0, prompts_1.select)({
|
|
143
|
+
message: config.message,
|
|
144
|
+
choices: choices,
|
|
145
|
+
default: config.default,
|
|
146
|
+
pageSize: config.pageSize,
|
|
147
|
+
}).then(resp => ({ [config.name]: resp }));
|
|
13
148
|
}
|
|
14
149
|
async function confirmPrompt(message, options = {}) {
|
|
15
|
-
const { defaultAnswer = true
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
message,
|
|
21
|
-
default: defaultAnswer,
|
|
22
|
-
when,
|
|
23
|
-
},
|
|
24
|
-
]);
|
|
150
|
+
const { defaultAnswer = true } = options;
|
|
151
|
+
const choice = await (0, prompts_1.confirm)({
|
|
152
|
+
message,
|
|
153
|
+
default: defaultAnswer,
|
|
154
|
+
});
|
|
25
155
|
return choice;
|
|
26
156
|
}
|
|
27
157
|
async function listPrompt(message, { choices, when, defaultAnswer, validate, }) {
|
|
28
|
-
const { choice } = await promptUser(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
]);
|
|
158
|
+
const { choice } = await promptUser({
|
|
159
|
+
name: 'choice',
|
|
160
|
+
type: 'list',
|
|
161
|
+
message,
|
|
162
|
+
choices,
|
|
163
|
+
when,
|
|
164
|
+
default: defaultAnswer,
|
|
165
|
+
validate,
|
|
166
|
+
});
|
|
39
167
|
return choice;
|
|
40
168
|
}
|
|
41
169
|
async function inputPrompt(message, { when, validate, defaultAnswer, } = {}) {
|
|
42
|
-
const { input } = await promptUser(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
]);
|
|
170
|
+
const { input } = await promptUser({
|
|
171
|
+
name: 'input',
|
|
172
|
+
type: 'input',
|
|
173
|
+
default: defaultAnswer,
|
|
174
|
+
message,
|
|
175
|
+
when,
|
|
176
|
+
validate,
|
|
177
|
+
});
|
|
52
178
|
return input;
|
|
53
179
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Separator } from '@inquirer/prompts';
|
|
1
2
|
import { ComponentTemplate, ComponentTemplateChoice, ProjectTemplate } from '../../types/Projects';
|
|
2
3
|
export type SelectProjectTemplatePromptResponse = {
|
|
3
4
|
projectTemplate?: ProjectTemplate;
|
|
@@ -22,5 +23,5 @@ export type PromptOptionsArg = {
|
|
|
22
23
|
features?: string[];
|
|
23
24
|
};
|
|
24
25
|
export declare function selectProjectTemplatePrompt(promptOptions: PromptOptionsArg, projectTemplates?: ProjectTemplate[], componentTemplates?: undefined): Promise<SelectProjectTemplatePromptResponseProjectTemplate>;
|
|
25
|
-
export declare function selectProjectTemplatePrompt(promptOptions: PromptOptionsArg, projectTemplates?: undefined, componentTemplates?: ComponentTemplateChoice[]): Promise<SelectProjectTemplatePromptResponseComponentTemplates>;
|
|
26
|
+
export declare function selectProjectTemplatePrompt(promptOptions: PromptOptionsArg, projectTemplates?: undefined, componentTemplates?: (ComponentTemplateChoice | Separator)[]): Promise<SelectProjectTemplatePromptResponseComponentTemplates>;
|
|
26
27
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.selectProjectTemplatePrompt = selectProjectTemplatePrompt;
|
|
4
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
4
5
|
const promptUtils_1 = require("./promptUtils");
|
|
5
6
|
const en_1 = require("../../lang/en");
|
|
6
7
|
function findTemplateByNameOrLabel(projectTemplates, templateNameOrLabel) {
|
|
@@ -12,7 +13,7 @@ async function selectProjectTemplatePrompt(promptOptions, projectTemplates, comp
|
|
|
12
13
|
const selectedComponents = [];
|
|
13
14
|
if (createProjectFromComponents && promptOptions.features) {
|
|
14
15
|
componentTemplates.forEach(template => {
|
|
15
|
-
if (!template.value) {
|
|
16
|
+
if (template instanceof prompts_1.Separator || !template.value) {
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
19
|
if (promptOptions.features?.includes(template.value.type)) {
|
package/lib/usageTracking.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ type Meta = {
|
|
|
13
13
|
file?: boolean;
|
|
14
14
|
successful?: boolean;
|
|
15
15
|
};
|
|
16
|
-
export declare function trackCommandUsage(command: string, meta?: Meta, accountId?: number): void
|
|
17
|
-
export declare function trackHelpUsage(command: string): void
|
|
18
|
-
export declare function trackConvertFieldsUsage(command: string): void
|
|
19
|
-
export declare function trackAuthAction(command: string, authType: string, step: string, accountId?: number): void
|
|
20
|
-
export declare function trackCommandMetadataUsage(command: string, meta?: Meta, accountId?: number): void
|
|
16
|
+
export declare function trackCommandUsage(command: string, meta?: Meta, accountId?: number): Promise<void>;
|
|
17
|
+
export declare function trackHelpUsage(command: string): Promise<void>;
|
|
18
|
+
export declare function trackConvertFieldsUsage(command: string): Promise<void>;
|
|
19
|
+
export declare function trackAuthAction(command: string, authType: string, step: string, accountId?: number): Promise<void>;
|
|
20
|
+
export declare function trackCommandMetadataUsage(command: string, meta?: Meta, accountId?: number): Promise<void>;
|
|
21
21
|
export {};
|