@hubspot/cli 7.8.11-experimental.0 → 7.8.12-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/bin/cli.js +31 -25
- package/commands/__tests__/auth.test.js +5 -0
- package/commands/__tests__/doctor.test.js +16 -16
- package/commands/account/clean.js +18 -27
- package/commands/account/createOverride.js +13 -31
- package/commands/account/info.js +20 -31
- package/commands/account/list.js +16 -22
- package/commands/account/remove.js +12 -20
- package/commands/account/removeOverride.js +11 -21
- package/commands/account/rename.js +6 -9
- package/commands/account/use.js +12 -26
- package/commands/account.js +2 -2
- package/commands/app/__tests__/migrate.test.js +5 -5
- package/commands/app/migrate.js +13 -18
- package/commands/auth.d.ts +1 -0
- package/commands/auth.js +16 -7
- package/commands/cms/convertFields.js +7 -9
- package/commands/cms/getReactModule.js +9 -14
- package/commands/cms/lighthouseScore.js +33 -36
- package/commands/cms.js +2 -2
- package/commands/completion.js +3 -3
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +64 -36
- package/commands/config.js +2 -2
- package/commands/create.js +2 -2
- package/commands/customObject/create.js +10 -12
- package/commands/customObject/schema/create.js +9 -11
- package/commands/customObject/schema/delete.js +16 -16
- package/commands/customObject/schema/fetch-all.js +12 -11
- package/commands/customObject/schema/fetch.js +15 -15
- package/commands/customObject/schema/list.js +4 -4
- package/commands/customObject/schema/update.js +13 -13
- package/commands/customObject/schema.js +2 -2
- package/commands/customObject.js +6 -7
- package/commands/doctor.js +8 -11
- package/commands/feedback.js +6 -11
- package/commands/fetch.js +8 -8
- package/commands/filemanager/fetch.js +7 -7
- package/commands/filemanager/upload.js +15 -34
- package/commands/filemanager.js +2 -2
- package/commands/function/deploy.js +11 -29
- package/commands/function/list.js +8 -8
- package/commands/function/server.js +9 -11
- package/commands/function.d.ts +1 -1
- package/commands/function.js +2 -2
- package/commands/getStarted.js +2 -2
- package/commands/hubdb/clear.js +7 -15
- package/commands/hubdb/create.js +9 -15
- package/commands/hubdb/delete.js +8 -15
- package/commands/hubdb/fetch.js +6 -9
- package/commands/hubdb.d.ts +1 -1
- package/commands/hubdb.js +2 -2
- package/commands/init.js +2 -3
- package/commands/lint.js +16 -16
- package/commands/list.js +8 -14
- package/commands/logs.js +14 -20
- package/commands/mv.js +6 -17
- package/commands/open.js +5 -5
- package/commands/project/__tests__/add.test.js +4 -2
- package/commands/project/__tests__/deploy.test.js +3 -4
- package/commands/project/__tests__/installDeps.test.js +8 -8
- package/commands/project/__tests__/logs.test.js +1 -1
- package/commands/project/__tests__/migrate.test.js +5 -5
- package/commands/project/__tests__/migrateApp.test.js +2 -5
- package/commands/project/__tests__/validate.test.js +98 -0
- package/commands/project/add.js +3 -3
- package/commands/project/cloneApp.js +14 -19
- package/commands/project/create.js +0 -1
- package/commands/project/deploy.js +3 -3
- package/commands/project/dev/deprecatedFlow.js +7 -16
- package/commands/project/dev/index.js +14 -12
- package/commands/project/dev/unifiedFlow.js +3 -1
- package/commands/project/download.js +10 -13
- package/commands/project/installDeps.js +8 -8
- package/commands/project/listBuilds.js +11 -20
- package/commands/project/logs.js +21 -24
- package/commands/project/migrate.js +14 -16
- package/commands/project/migrateApp.js +9 -15
- package/commands/project/open.js +6 -13
- package/commands/project/upload.js +16 -25
- package/commands/project/validate.js +6 -6
- package/commands/project/watch.js +13 -22
- package/commands/project.js +2 -2
- package/commands/sandbox/__tests__/create.test.js +5 -5
- package/commands/sandbox/create.js +22 -32
- package/commands/sandbox/delete.js +38 -63
- package/commands/sandbox.js +2 -2
- package/commands/secret/addSecret.js +7 -17
- package/commands/secret/deleteSecret.js +10 -20
- package/commands/secret/listSecret.js +8 -10
- package/commands/secret/updateSecret.js +9 -17
- package/commands/secret.js +2 -2
- package/commands/testAccount/__tests__/delete.test.js +2 -4
- package/commands/testAccount/delete.d.ts +4 -3
- package/commands/testAccount/delete.js +155 -14
- package/commands/theme/preview.js +1 -4
- package/lang/en.d.ts +310 -102
- package/lang/en.js +351 -147
- package/lang/en.lyaml +2 -2
- package/lib/__tests__/buildAccount.test.js +2 -1
- package/lib/__tests__/commonOpts.test.js +1 -1
- package/lib/__tests__/dependencyManagement.test.js +1 -1
- package/lib/__tests__/developerTestAccounts.test.js +3 -3
- package/lib/__tests__/npm.test.js +1 -1
- package/lib/__tests__/oauth.test.js +4 -4
- package/lib/__tests__/process.test.js +10 -5
- package/lib/__tests__/sandboxSync.test.js +8 -8
- package/lib/__tests__/sandboxes.test.js +8 -8
- package/lib/__tests__/serverlessLogs.test.js +1 -1
- package/lib/__tests__/usageTracking.test.js +5 -5
- package/lib/__tests__/validation.test.js +2 -1
- package/lib/__tests__/yargsUtils.test.js +83 -9
- package/lib/app/__tests__/migrate.test.js +5 -5
- package/lib/app/__tests__/migrate_legacy.test.js +1 -1
- package/lib/app/migrate.js +1 -1
- package/lib/app/migrate_legacy.js +20 -24
- package/lib/buildAccount.js +25 -57
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +25 -22
- package/lib/configOptions.js +7 -0
- package/lib/constants.d.ts +6 -1
- package/lib/constants.js +10 -1
- package/lib/dependencyManagement.js +9 -27
- package/lib/developerTestAccounts.js +9 -23
- package/lib/doctor/Diagnosis.js +11 -23
- package/lib/doctor/DiagnosticInfoBuilder.js +12 -11
- package/lib/doctor/Doctor.js +42 -90
- package/lib/doctor/__tests__/Doctor.test.js +4 -4
- package/lib/errorHandlers/index.js +12 -20
- package/lib/errorHandlers/suppressError.js +11 -18
- package/lib/lang.js +6 -5
- package/lib/links.js +4 -4
- package/lib/middleware/__test__/commandTargetingUtils.test.d.ts +1 -0
- package/lib/middleware/__test__/commandTargetingUtils.test.js +99 -0
- package/lib/middleware/__test__/configMiddleware.test.js +11 -11
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +6 -8
- package/lib/middleware/commandTargetingUtils.d.ts +8 -0
- package/lib/middleware/commandTargetingUtils.js +78 -0
- package/lib/middleware/configMiddleware.d.ts +1 -1
- package/lib/middleware/configMiddleware.js +21 -81
- package/lib/middleware/fireAlarmMiddleware.js +15 -17
- package/lib/middleware/gitMiddleware.js +5 -1
- package/lib/middleware/notificationsMiddleware.js +5 -11
- package/lib/middleware/yargsChecksMiddleware.js +6 -9
- package/lib/npm.js +2 -2
- package/lib/oauth.js +5 -5
- package/lib/process.js +5 -4
- package/lib/projects/__tests__/AppDevModeInterface.test.js +14 -34
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +70 -39
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +2 -0
- package/lib/projects/__tests__/platformVersion.test.js +8 -8
- package/lib/projects/__tests__/projects.test.js +12 -12
- package/lib/projects/__tests__/structure.test.js +3 -3
- package/lib/projects/__tests__/upload.test.d.ts +1 -0
- package/lib/projects/__tests__/upload.test.js +82 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +6 -6
- package/lib/projects/add/__tests__/v3AddComponent.test.js +4 -4
- package/lib/projects/create/__tests__/legacy.test.js +5 -5
- package/lib/projects/create/__tests__/v3.test.js +1 -1
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/v3.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +2 -0
- package/lib/projects/localDev/AppDevModeInterface.js +22 -20
- package/lib/projects/localDev/LocalDevLogger.js +10 -11
- package/lib/projects/localDev/LocalDevManager.js +4 -5
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +0 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +7 -10
- package/lib/projects/localDev/helpers/project.d.ts +1 -0
- package/lib/projects/localDev/helpers/project.js +37 -0
- package/lib/projects/platformVersion.d.ts +1 -1
- package/lib/projects/platformVersion.js +1 -1
- package/lib/projects/structure.js +6 -6
- package/lib/projects/upload.d.ts +1 -1
- package/lib/projects/upload.js +17 -8
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +1 -0
- package/lib/prompts/accountNamePrompt.js +14 -19
- package/lib/prompts/accountsPrompt.js +2 -2
- package/lib/prompts/cmsFieldPrompt.js +2 -2
- package/lib/prompts/createApiSamplePrompt.js +5 -5
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +10 -1
- package/lib/prompts/createFunctionPrompt.js +14 -14
- package/lib/prompts/createModulePrompt.js +9 -9
- package/lib/prompts/createTemplatePrompt.js +2 -2
- package/lib/prompts/downloadProjectPrompt.js +5 -8
- package/lib/prompts/personalAccessKeyPrompt.js +3 -3
- package/lib/prompts/previewPrompt.js +6 -6
- package/lib/prompts/projectAddPrompt.js +6 -0
- package/lib/prompts/projectDevTargetAccountPrompt.js +20 -32
- package/lib/prompts/projectNamePrompt.js +4 -8
- package/lib/prompts/projectsLogsPrompt.js +2 -4
- package/lib/prompts/promptUtils.js +27 -9
- package/lib/prompts/sandboxesPrompt.js +7 -7
- package/lib/prompts/secretPrompt.js +3 -3
- package/lib/prompts/selectAppPrompt.js +3 -3
- package/lib/prompts/selectHubDBTablePrompt.js +9 -13
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +15 -19
- package/lib/prompts/setAsDefaultAccountPrompt.js +4 -8
- package/lib/prompts/uploadPrompt.js +5 -5
- package/lib/sandboxSync.js +24 -41
- package/lib/sandboxes.js +19 -47
- package/lib/schema.js +3 -3
- package/lib/serverlessLogs.js +11 -13
- package/lib/theme/__tests__/migrate.test.js +3 -3
- package/lib/theme/migrate.js +2 -2
- package/lib/ui/SpinniesManager.d.ts +2 -0
- package/lib/ui/SpinniesManager.js +7 -0
- package/lib/ui/boxen.js +1 -2
- package/lib/ui/git.js +13 -10
- package/lib/ui/index.d.ts +4 -0
- package/lib/ui/index.js +47 -38
- package/lib/ui/serverlessFunctionLogs.js +9 -7
- package/lib/ui/uiMessages.d.ts +68 -0
- package/lib/ui/uiMessages.js +71 -0
- package/lib/usageTracking.js +7 -7
- package/lib/validation.js +20 -23
- package/lib/yargsUtils.d.ts +1 -1
- package/lib/yargsUtils.js +12 -5
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +23 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +68 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +11 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.js +49 -0
- package/mcp-server/tools/project/GetConfigValuesTool.js +2 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +169 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +115 -0
- package/mcp-server/utils/toolUsageTracking.js +2 -2
- package/package.json +7 -7
- package/ui/components/BoxWithTitle.d.ts +8 -0
- package/ui/components/BoxWithTitle.js +9 -0
- package/ui/components/HorizontalSelectPrompt.d.ts +8 -0
- package/ui/components/HorizontalSelectPrompt.js +30 -0
- package/ui/components/StatusMessageBoxes.d.ts +12 -0
- package/ui/components/StatusMessageBoxes.js +31 -0
- package/ui/index.d.ts +1 -0
- package/ui/index.js +6 -0
- package/ui/lib/ui-testing-utils.d.ts +9 -0
- package/ui/lib/ui-testing-utils.js +47 -0
- package/ui/lib/useTerminalSize.d.ts +13 -0
- package/ui/lib/useTerminalSize.js +31 -0
- package/ui/styles.d.ts +18 -0
- package/ui/styles.js +18 -0
- package/ui/views/UiSandbox.d.ts +5 -0
- package/ui/views/UiSandbox.js +25 -0
- package/lib/middleware/__test__/utils.test.js +0 -51
- package/lib/middleware/utils.d.ts +0 -8
- package/lib/middleware/utils.js +0 -14
- /package/{lib/middleware/__test__/utils.test.d.ts → commands/project/__tests__/validate.test.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { promptUser } from './promptUtils.js';
|
|
4
|
-
import {
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
5
|
import { escapeRegExp } from '@hubspot/local-dev-lib/escapeRegExp';
|
|
6
6
|
const FIELDS_FILES = ['fields.json', 'fields.js', 'fields.cjs', 'fields.mjs'];
|
|
7
7
|
export async function fieldsJsPrompt(filePath, projectDir, skipFiles = []) {
|
|
@@ -26,7 +26,7 @@ export async function fieldsJsPrompt(filePath, projectDir, skipFiles = []) {
|
|
|
26
26
|
}));
|
|
27
27
|
const promptVal = await promptUser([
|
|
28
28
|
{
|
|
29
|
-
message:
|
|
29
|
+
message: lib.prompts.uploadPrompt.fieldsPrompt(fileDir),
|
|
30
30
|
type: 'list',
|
|
31
31
|
name: 'filePathChoice',
|
|
32
32
|
choices: selection,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
function getSampleTypesPrompt(choices) {
|
|
4
4
|
return {
|
|
5
5
|
type: 'rawlist',
|
|
6
6
|
name: 'sampleType',
|
|
7
|
-
message:
|
|
7
|
+
message: lib.prompts.createApiSamplePrompt.selectApiSampleApp,
|
|
8
8
|
choices: choices.map(choice => ({
|
|
9
9
|
name: `${choice.name} - ${choice.description}`,
|
|
10
10
|
value: choice.id,
|
|
@@ -15,7 +15,7 @@ function getSampleTypesPrompt(choices) {
|
|
|
15
15
|
resolve(true);
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
|
-
reject(
|
|
18
|
+
reject(lib.prompts.createApiSamplePrompt.errors.apiSampleAppRequired);
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
},
|
|
@@ -25,7 +25,7 @@ function getLanguagesPrompt(choices) {
|
|
|
25
25
|
return {
|
|
26
26
|
type: 'rawlist',
|
|
27
27
|
name: 'sampleLanguage',
|
|
28
|
-
message:
|
|
28
|
+
message: lib.prompts.createApiSamplePrompt.selectLanguage,
|
|
29
29
|
choices: choices.map(choice => ({
|
|
30
30
|
name: choice,
|
|
31
31
|
value: choice,
|
|
@@ -35,7 +35,7 @@ function getLanguagesPrompt(choices) {
|
|
|
35
35
|
if (input && input.length > 0) {
|
|
36
36
|
resolve(true);
|
|
37
37
|
}
|
|
38
|
-
reject(
|
|
38
|
+
reject(lib.prompts.createApiSamplePrompt.errors.languageRequired);
|
|
39
39
|
});
|
|
40
40
|
},
|
|
41
41
|
};
|
|
@@ -94,7 +94,16 @@ export async function createDeveloperTestAccountConfigPrompt(args = {}, supportF
|
|
|
94
94
|
},
|
|
95
95
|
],
|
|
96
96
|
});
|
|
97
|
-
if (useDefaultAccountLevelsPromptResult.useDefaultAccountLevels === '
|
|
97
|
+
if (useDefaultAccountLevelsPromptResult.useDefaultAccountLevels === 'default') {
|
|
98
|
+
accountLevelsArray = [
|
|
99
|
+
{ hub: 'MARKETING', tier: AccountTiers.ENTERPRISE },
|
|
100
|
+
{ hub: 'OPS', tier: AccountTiers.ENTERPRISE },
|
|
101
|
+
{ hub: 'SERVICE', tier: AccountTiers.ENTERPRISE },
|
|
102
|
+
{ hub: 'SALES', tier: AccountTiers.ENTERPRISE },
|
|
103
|
+
{ hub: 'CONTENT', tier: AccountTiers.ENTERPRISE },
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
98
107
|
const accountLevelsPromptResult = await promptUser({
|
|
99
108
|
name: 'testAccountLevels',
|
|
100
109
|
message: lib.prompts.createDeveloperTestAccountConfigPrompt.tiersPrompt,
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
const FUNCTIONS_FOLDER_PROMPT = {
|
|
4
4
|
name: 'functionsFolder',
|
|
5
|
-
message:
|
|
5
|
+
message: lib.prompts.createFunctionPrompt.enterFolder,
|
|
6
6
|
validate(val) {
|
|
7
7
|
if (typeof val !== 'string') {
|
|
8
|
-
return
|
|
8
|
+
return lib.prompts.createFunctionPrompt.errors.invalid;
|
|
9
9
|
}
|
|
10
10
|
else if (!val.length) {
|
|
11
|
-
return
|
|
11
|
+
return lib.prompts.createFunctionPrompt.errors.blank;
|
|
12
12
|
}
|
|
13
13
|
else if (val.indexOf(' ') >= 0) {
|
|
14
|
-
return
|
|
14
|
+
return lib.prompts.createFunctionPrompt.errors.space;
|
|
15
15
|
}
|
|
16
16
|
return true;
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
19
|
const FUNCTION_FILENAME_PROMPT = {
|
|
20
20
|
name: 'filename',
|
|
21
|
-
message:
|
|
21
|
+
message: lib.prompts.createFunctionPrompt.enterFilename,
|
|
22
22
|
validate(val) {
|
|
23
23
|
if (typeof val !== 'string') {
|
|
24
|
-
return
|
|
24
|
+
return lib.prompts.createFunctionPrompt.errors.invalid;
|
|
25
25
|
}
|
|
26
26
|
else if (!val.length) {
|
|
27
|
-
return
|
|
27
|
+
return lib.prompts.createFunctionPrompt.errors.blank;
|
|
28
28
|
}
|
|
29
29
|
else if (val.indexOf(' ') >= 0) {
|
|
30
|
-
return
|
|
30
|
+
return lib.prompts.createFunctionPrompt.errors.space;
|
|
31
31
|
}
|
|
32
32
|
return true;
|
|
33
33
|
},
|
|
@@ -35,22 +35,22 @@ const FUNCTION_FILENAME_PROMPT = {
|
|
|
35
35
|
const ENDPOINT_METHOD_PROMPT = {
|
|
36
36
|
type: 'list',
|
|
37
37
|
name: 'endpointMethod',
|
|
38
|
-
message:
|
|
38
|
+
message: lib.prompts.createFunctionPrompt.selectEndpointMethod,
|
|
39
39
|
default: 'GET',
|
|
40
40
|
choices: ['DELETE', 'GET', 'PATCH', 'POST', 'PUT'],
|
|
41
41
|
};
|
|
42
42
|
const ENDPOINT_PATH_PROMPT = {
|
|
43
43
|
name: 'endpointPath',
|
|
44
|
-
message:
|
|
44
|
+
message: lib.prompts.createFunctionPrompt.enterEndpointPath,
|
|
45
45
|
validate(val) {
|
|
46
46
|
if (typeof val !== 'string') {
|
|
47
|
-
return
|
|
47
|
+
return lib.prompts.createFunctionPrompt.errors.invalid;
|
|
48
48
|
}
|
|
49
49
|
else if (!val.length) {
|
|
50
|
-
return
|
|
50
|
+
return lib.prompts.createFunctionPrompt.errors.blank;
|
|
51
51
|
}
|
|
52
52
|
else if (val.indexOf(' ') >= 0) {
|
|
53
|
-
return
|
|
53
|
+
return lib.prompts.createFunctionPrompt.errors.space;
|
|
54
54
|
}
|
|
55
55
|
return true;
|
|
56
56
|
},
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
const MODULE_LABEL_PROMPT = {
|
|
4
4
|
name: 'moduleLabel',
|
|
5
|
-
message:
|
|
5
|
+
message: lib.prompts.createModulePrompt.enterLabel,
|
|
6
6
|
validate(val) {
|
|
7
7
|
if (typeof val !== 'string') {
|
|
8
|
-
return
|
|
8
|
+
return lib.prompts.createModulePrompt.errors.invalidLabel;
|
|
9
9
|
}
|
|
10
10
|
else if (!val.length) {
|
|
11
|
-
return
|
|
11
|
+
return lib.prompts.createModulePrompt.errors.labelRequired;
|
|
12
12
|
}
|
|
13
13
|
return true;
|
|
14
14
|
},
|
|
@@ -16,13 +16,13 @@ const MODULE_LABEL_PROMPT = {
|
|
|
16
16
|
const REACT_TYPE_PROMPT = {
|
|
17
17
|
type: 'confirm',
|
|
18
18
|
name: 'reactType',
|
|
19
|
-
message:
|
|
19
|
+
message: lib.prompts.createModulePrompt.selectReactType,
|
|
20
20
|
default: false,
|
|
21
21
|
};
|
|
22
22
|
const CONTENT_TYPES_PROMPT = {
|
|
23
23
|
type: 'checkbox',
|
|
24
24
|
name: 'contentTypes',
|
|
25
|
-
message:
|
|
25
|
+
message: lib.prompts.createModulePrompt.selectContentType,
|
|
26
26
|
choices: [
|
|
27
27
|
{ name: 'Any', value: 'ANY', checked: true },
|
|
28
28
|
{ name: 'Landing page', value: 'LANDING_PAGE' },
|
|
@@ -42,20 +42,20 @@ const CONTENT_TYPES_PROMPT = {
|
|
|
42
42
|
if (input.length > 0) {
|
|
43
43
|
resolve(true);
|
|
44
44
|
}
|
|
45
|
-
reject(
|
|
45
|
+
reject(lib.prompts.createModulePrompt.errors.contentTypeRequired);
|
|
46
46
|
});
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
49
|
const GLOBAL_PROMPT = {
|
|
50
50
|
type: 'confirm',
|
|
51
51
|
name: 'global',
|
|
52
|
-
message:
|
|
52
|
+
message: lib.prompts.createModulePrompt.confirmGlobal,
|
|
53
53
|
default: false,
|
|
54
54
|
};
|
|
55
55
|
const AVAILABLE_FOR_NEW_CONTENT = {
|
|
56
56
|
type: 'confirm',
|
|
57
57
|
name: 'availableForNewContent',
|
|
58
|
-
message:
|
|
58
|
+
message: lib.prompts.createModulePrompt.availableForNewContent,
|
|
59
59
|
default: true,
|
|
60
60
|
};
|
|
61
61
|
export function createModulePrompt(commandArgs = {}) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
const templateTypeChoices = [
|
|
4
4
|
{ name: 'page', value: 'page-template' },
|
|
5
5
|
{ name: 'email', value: 'email-template' },
|
|
@@ -13,7 +13,7 @@ const templateTypeChoices = [
|
|
|
13
13
|
const TEMPLATE_TYPE_PROMPT = {
|
|
14
14
|
type: 'list',
|
|
15
15
|
name: 'templateType',
|
|
16
|
-
message:
|
|
16
|
+
message: lib.prompts.createTemplatePrompt.selectTemplate,
|
|
17
17
|
default: 'page',
|
|
18
18
|
choices: templateTypeChoices,
|
|
19
19
|
};
|
|
@@ -2,16 +2,16 @@ import { promptUser } from './promptUtils.js';
|
|
|
2
2
|
import { getAccountId } from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import { fetchProjects } from '@hubspot/local-dev-lib/api/projects';
|
|
4
4
|
import { logError, ApiErrorContext } from '../errorHandlers/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from '../ui/logger.js';
|
|
6
6
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
7
|
-
import {
|
|
7
|
+
import { lib } from '../../lang/en.js';
|
|
8
8
|
async function createProjectsList(accountId) {
|
|
9
9
|
try {
|
|
10
10
|
if (accountId) {
|
|
11
11
|
const { data: projects } = await fetchProjects(accountId);
|
|
12
12
|
return projects.results;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
uiLogger.error(lib.prompts.downloadProjectPrompt.errors.accountIdRequired);
|
|
15
15
|
process.exit(EXIT_CODES.ERROR);
|
|
16
16
|
}
|
|
17
17
|
catch (e) {
|
|
@@ -28,11 +28,8 @@ export async function downloadProjectPrompt(promptOptions) {
|
|
|
28
28
|
message: () => {
|
|
29
29
|
return promptOptions.project &&
|
|
30
30
|
!projectsList.find(p => p.name === promptOptions.name)
|
|
31
|
-
?
|
|
32
|
-
|
|
33
|
-
accountId: accountId || '',
|
|
34
|
-
})
|
|
35
|
-
: i18n(`lib.prompts.downloadProjectPrompt.selectProject`);
|
|
31
|
+
? lib.prompts.downloadProjectPrompt.errors.projectNotFound(promptOptions.project, accountId || 0)
|
|
32
|
+
: lib.prompts.downloadProjectPrompt.selectProject;
|
|
36
33
|
},
|
|
37
34
|
when: !promptOptions.project ||
|
|
38
35
|
!projectsList.find(p => p.name === promptOptions.project),
|
|
@@ -2,7 +2,7 @@ import open from 'open';
|
|
|
2
2
|
import { OAUTH_SCOPES, DEFAULT_OAUTH_SCOPES, } from '@hubspot/local-dev-lib/constants/auth';
|
|
3
3
|
import { deleteEmptyConfigFile } from '@hubspot/local-dev-lib/config';
|
|
4
4
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from '../ui/logger.js';
|
|
6
6
|
import { promptUser } from './promptUtils.js';
|
|
7
7
|
import { getCliAccountNamePromptConfig, } from './accountNamePrompt.js';
|
|
8
8
|
import { uiInfoSection } from '../ui/index.js';
|
|
@@ -17,7 +17,7 @@ export async function personalAccessKeyPrompt({ env, account, }) {
|
|
|
17
17
|
let url = `${websiteOrigin}/l/personal-access-key`;
|
|
18
18
|
if (process.env.BROWSER !== 'none') {
|
|
19
19
|
uiInfoSection(lib.prompts.personalAccessKeyPrompt.personalAccessKeySetupTitle, () => {
|
|
20
|
-
|
|
20
|
+
uiLogger.log(lib.prompts.personalAccessKeyPrompt.personalAccessKeyBrowserOpenPrep);
|
|
21
21
|
});
|
|
22
22
|
if (account) {
|
|
23
23
|
url = `${websiteOrigin}/personal-access-key/${account}`;
|
|
@@ -33,7 +33,7 @@ export async function personalAccessKeyPrompt({ env, account, }) {
|
|
|
33
33
|
lib.prompts.personalAccessKeyPrompt.personalAccessKeyPromptChoices
|
|
34
34
|
.OPEN_BROWSER) {
|
|
35
35
|
open(url, { url: true });
|
|
36
|
-
|
|
36
|
+
uiLogger.log(lib.prompts.personalAccessKeyPrompt.logs.openingWebBrowser(url));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
const { personalAccessKey } = await promptUser(PERSONAL_ACCESS_KEY);
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { getCwd } from '@hubspot/local-dev-lib/path';
|
|
3
3
|
import { promptUser } from './promptUtils.js';
|
|
4
|
-
import {
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
5
|
export async function previewPrompt(promptOptions = {}) {
|
|
6
6
|
return promptUser([
|
|
7
7
|
{
|
|
8
8
|
name: 'src',
|
|
9
|
-
message:
|
|
9
|
+
message: lib.prompts.previewPrompt.enterSrc,
|
|
10
10
|
when: !promptOptions.src,
|
|
11
11
|
default: '.',
|
|
12
12
|
validate: (input) => {
|
|
13
13
|
if (!input) {
|
|
14
|
-
return
|
|
14
|
+
return lib.prompts.previewPrompt.errors.srcRequired;
|
|
15
15
|
}
|
|
16
16
|
return true;
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
name: 'dest',
|
|
21
|
-
message:
|
|
21
|
+
message: lib.prompts.previewPrompt.enterDest,
|
|
22
22
|
when: !promptOptions.dest,
|
|
23
23
|
default: path.basename(getCwd()),
|
|
24
24
|
validate: (input) => {
|
|
25
25
|
if (!input) {
|
|
26
|
-
return
|
|
26
|
+
return lib.prompts.previewPrompt.errors.destRequired;
|
|
27
27
|
}
|
|
28
28
|
return true;
|
|
29
29
|
},
|
|
@@ -34,7 +34,7 @@ export async function previewProjectPrompt(themeComponents) {
|
|
|
34
34
|
return promptUser([
|
|
35
35
|
{
|
|
36
36
|
name: 'themeComponentPath',
|
|
37
|
-
message:
|
|
37
|
+
message: lib.prompts.previewPrompt.themeProjectSelect,
|
|
38
38
|
type: 'list',
|
|
39
39
|
choices: themeComponents.map(t => {
|
|
40
40
|
const themeName = path.basename(t.path);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Separator } from '@inquirer/prompts';
|
|
2
2
|
import { promptUser } from './promptUtils.js';
|
|
3
3
|
import { lib } from '../../lang/en.js';
|
|
4
|
+
import { uiLogger } from '../ui/logger.js';
|
|
4
5
|
function findComponentByPathOrLabel(components, componentPathOrLabel) {
|
|
5
6
|
return components.find(c => c.path === componentPathOrLabel || c.label === componentPathOrLabel);
|
|
6
7
|
}
|
|
@@ -59,6 +60,11 @@ export async function projectAddPromptV3(components, selectedFeatures) {
|
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
}
|
|
63
|
+
if (!components?.length) {
|
|
64
|
+
uiLogger.error(lib.prompts.projectAddPrompt.errors.noSelectableChoices);
|
|
65
|
+
uiLogger.log('');
|
|
66
|
+
return { componentTemplate: [] };
|
|
67
|
+
}
|
|
62
68
|
const result = await promptUser([
|
|
63
69
|
{
|
|
64
70
|
name: 'componentTemplate',
|
|
@@ -2,11 +2,11 @@ import { getAccountId } from '@hubspot/local-dev-lib/config';
|
|
|
2
2
|
import { getSandboxUsageLimits } from '@hubspot/local-dev-lib/api/sandboxHubs';
|
|
3
3
|
import { HUBSPOT_ACCOUNT_TYPES, HUBSPOT_ACCOUNT_TYPE_STRINGS, } from '@hubspot/local-dev-lib/constants/config';
|
|
4
4
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
5
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
6
5
|
import { fetchDeveloperTestAccounts } from '@hubspot/local-dev-lib/api/developerTestAccounts';
|
|
7
6
|
import { promptUser } from './promptUtils.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { lib } from '../../lang/en.js';
|
|
8
|
+
import { uiLogger } from '../ui/logger.js';
|
|
9
|
+
import { uiAccountDescription } from '../ui/index.js';
|
|
10
10
|
import { isSandbox } from '../accountTypes.js';
|
|
11
11
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
12
12
|
function mapNestedAccount(accountConfig) {
|
|
@@ -36,12 +36,12 @@ export async function selectSandboxTargetAccountPrompt(accounts, defaultAccountC
|
|
|
36
36
|
sandboxUsage = data.usage;
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
-
|
|
39
|
+
uiLogger.error(lib.prompts.projectDevTargetAccountPrompt.noAccountId);
|
|
40
40
|
process.exit(EXIT_CODES.ERROR);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
catch (err) {
|
|
44
|
-
|
|
44
|
+
uiLogger.debug('Unable to fetch sandbox usage limits: ', err);
|
|
45
45
|
}
|
|
46
46
|
const sandboxAccounts = accounts
|
|
47
47
|
.reverse()
|
|
@@ -49,15 +49,11 @@ export async function selectSandboxTargetAccountPrompt(accounts, defaultAccountC
|
|
|
49
49
|
let disabledMessage = false;
|
|
50
50
|
if (sandboxUsage['DEVELOPER'] && sandboxUsage['DEVELOPER'].available === 0) {
|
|
51
51
|
if (sandboxAccounts.length < sandboxUsage['DEVELOPER'].limit) {
|
|
52
|
-
disabledMessage =
|
|
53
|
-
|
|
54
|
-
limit: sandboxUsage['DEVELOPER'].limit,
|
|
55
|
-
});
|
|
52
|
+
disabledMessage =
|
|
53
|
+
lib.prompts.projectDevTargetAccountPrompt.sandboxLimitWithSuggestion(sandboxUsage['DEVELOPER'].limit);
|
|
56
54
|
}
|
|
57
55
|
else {
|
|
58
|
-
disabledMessage =
|
|
59
|
-
limit: sandboxUsage['DEVELOPER'].limit,
|
|
60
|
-
});
|
|
56
|
+
disabledMessage = lib.prompts.projectDevTargetAccountPrompt.sandboxLimit(sandboxUsage['DEVELOPER'].limit);
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
59
|
// Order choices by Developer Sandbox -> Standard Sandbox
|
|
@@ -69,7 +65,7 @@ export async function selectSandboxTargetAccountPrompt(accounts, defaultAccountC
|
|
|
69
65
|
.filter(a => a.accountType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX)
|
|
70
66
|
.map(mapNestedAccount),
|
|
71
67
|
{
|
|
72
|
-
name:
|
|
68
|
+
name: lib.prompts.projectDevTargetAccountPrompt.createNewSandboxOption,
|
|
73
69
|
value: {
|
|
74
70
|
targetAccountId: null,
|
|
75
71
|
createNestedAccount: true,
|
|
@@ -77,7 +73,8 @@ export async function selectSandboxTargetAccountPrompt(accounts, defaultAccountC
|
|
|
77
73
|
disabled: disabledMessage,
|
|
78
74
|
},
|
|
79
75
|
{
|
|
80
|
-
name:
|
|
76
|
+
name: lib.prompts.projectDevTargetAccountPrompt
|
|
77
|
+
.chooseDefaultAccountOption,
|
|
81
78
|
value: {
|
|
82
79
|
targetAccountId: defaultAccountId,
|
|
83
80
|
createNestedAccount: false,
|
|
@@ -95,21 +92,19 @@ export async function selectDeveloperTestTargetAccountPrompt(accounts, defaultAc
|
|
|
95
92
|
devTestAccountsResponse = data;
|
|
96
93
|
}
|
|
97
94
|
else {
|
|
98
|
-
|
|
95
|
+
uiLogger.error(lib.prompts.projectDevTargetAccountPrompt.noAccountId);
|
|
99
96
|
process.exit(EXIT_CODES.ERROR);
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
catch (err) {
|
|
103
|
-
|
|
100
|
+
uiLogger.debug('Unable to fetch developer test account usage limits: ', err);
|
|
104
101
|
}
|
|
105
102
|
let disabledMessage = false;
|
|
106
103
|
if (devTestAccountsResponse &&
|
|
107
104
|
devTestAccountsResponse.results.length >=
|
|
108
105
|
devTestAccountsResponse.maxTestPortals) {
|
|
109
|
-
disabledMessage =
|
|
110
|
-
|
|
111
|
-
limit: devTestAccountsResponse.maxTestPortals,
|
|
112
|
-
});
|
|
106
|
+
disabledMessage =
|
|
107
|
+
lib.prompts.projectDevTargetAccountPrompt.developerTestAccountLimit(devTestAccountsResponse.maxTestPortals);
|
|
113
108
|
}
|
|
114
109
|
const devTestAccounts = [];
|
|
115
110
|
if (devTestAccountsResponse && devTestAccountsResponse.results) {
|
|
@@ -130,7 +125,8 @@ export async function selectDeveloperTestTargetAccountPrompt(accounts, defaultAc
|
|
|
130
125
|
const choices = [
|
|
131
126
|
...devTestAccounts,
|
|
132
127
|
{
|
|
133
|
-
name:
|
|
128
|
+
name: lib.prompts.projectDevTargetAccountPrompt
|
|
129
|
+
.createNewDeveloperTestAccountOption,
|
|
134
130
|
value: {
|
|
135
131
|
targetAccountId: null,
|
|
136
132
|
createNestedAccount: true,
|
|
@@ -146,10 +142,7 @@ async function selectTargetAccountPrompt(defaultAccountId, accountType, choices)
|
|
|
146
142
|
{
|
|
147
143
|
name: 'targetAccountInfo',
|
|
148
144
|
type: 'list',
|
|
149
|
-
message:
|
|
150
|
-
accountIdentifier: uiAccountDescription(accountId),
|
|
151
|
-
accountType,
|
|
152
|
-
}),
|
|
145
|
+
message: lib.prompts.projectDevTargetAccountPrompt.promptMessage(accountType, uiAccountDescription(accountId)),
|
|
153
146
|
choices,
|
|
154
147
|
loop: false,
|
|
155
148
|
},
|
|
@@ -161,10 +154,7 @@ export async function confirmDefaultAccountPrompt(accountName, accountType) {
|
|
|
161
154
|
{
|
|
162
155
|
name: 'useDefaultAccount',
|
|
163
156
|
type: 'confirm',
|
|
164
|
-
message:
|
|
165
|
-
accountName,
|
|
166
|
-
accountType,
|
|
167
|
-
}),
|
|
157
|
+
message: lib.prompts.projectDevTargetAccountPrompt.confirmDefaultAccount(accountName, accountType),
|
|
168
158
|
},
|
|
169
159
|
]);
|
|
170
160
|
return useDefaultAccount;
|
|
@@ -174,9 +164,7 @@ export async function confirmUseExistingDeveloperTestAccountPrompt(account) {
|
|
|
174
164
|
{
|
|
175
165
|
name: 'confirmUseExistingDeveloperTestAccount',
|
|
176
166
|
type: 'confirm',
|
|
177
|
-
message:
|
|
178
|
-
accountName: getNonConfigDeveloperTestAccountName(account),
|
|
179
|
-
}),
|
|
167
|
+
message: lib.prompts.projectDevTargetAccountPrompt.confirmUseExistingDeveloperTestAccount(getNonConfigDeveloperTestAccountName(account)),
|
|
180
168
|
},
|
|
181
169
|
]);
|
|
182
170
|
return confirmUseExistingDeveloperTestAccount;
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
import { ensureProjectExists } from '../projects/ensureProjectExists.js';
|
|
4
|
-
import { uiAccountDescription } from '../ui/index.js';
|
|
5
4
|
export async function projectNamePrompt(accountId, options = {}) {
|
|
6
5
|
const result = await promptUser({
|
|
7
6
|
name: 'projectName',
|
|
8
|
-
message:
|
|
7
|
+
message: lib.prompts.projectNamePrompt.enterName,
|
|
9
8
|
when: !options.project,
|
|
10
9
|
validate: async (val) => {
|
|
11
10
|
if (typeof val !== 'string' || !val) {
|
|
12
|
-
return
|
|
11
|
+
return lib.prompts.projectNamePrompt.errors.invalidName;
|
|
13
12
|
}
|
|
14
13
|
const { projectExists } = await ensureProjectExists(accountId, val, {
|
|
15
14
|
allowCreate: false,
|
|
16
15
|
noLogs: true,
|
|
17
16
|
});
|
|
18
17
|
if (!projectExists) {
|
|
19
|
-
return
|
|
20
|
-
projectName: val,
|
|
21
|
-
accountIdentifier: uiAccountDescription(accountId),
|
|
22
|
-
});
|
|
18
|
+
return lib.prompts.projectNamePrompt.errors.projectDoesNotExist(val, accountId);
|
|
23
19
|
}
|
|
24
20
|
return true;
|
|
25
21
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lib } from '../../lang/en.js';
|
|
2
2
|
import { promptUser } from './promptUtils.js';
|
|
3
3
|
export async function projectLogsPrompt({ functionChoices, promptOptions, projectName = '', }) {
|
|
4
4
|
if (!functionChoices) {
|
|
@@ -11,9 +11,7 @@ export async function projectLogsPrompt({ functionChoices, promptOptions, projec
|
|
|
11
11
|
{
|
|
12
12
|
name: 'functionName',
|
|
13
13
|
type: 'list',
|
|
14
|
-
message:
|
|
15
|
-
projectName,
|
|
16
|
-
}),
|
|
14
|
+
message: lib.prompts.projectLogsPrompt.functionName(projectName),
|
|
17
15
|
when: () => (!promptOptions || !promptOptions.function) &&
|
|
18
16
|
functionChoices.length > 0,
|
|
19
17
|
choices: functionChoices,
|
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import { confirm, Separator as _Separator, select, input, checkbox, password, number, } from '@inquirer/prompts';
|
|
2
2
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
|
+
import { uiLogger } from '../ui/logger.js';
|
|
4
6
|
export const Separator = new _Separator();
|
|
5
7
|
export const PROMPT_THEME = { prefix: { idle: chalk.green('?') } };
|
|
6
8
|
function isUserCancellationError(error) {
|
|
7
9
|
return error instanceof Error && error.name === 'ExitPromptError';
|
|
8
10
|
}
|
|
11
|
+
function isNoSelectableChoicesError(error) {
|
|
12
|
+
return (error instanceof Error && error.message?.includes('No selectable choices'));
|
|
13
|
+
}
|
|
14
|
+
function handlePromptError(config, error) {
|
|
15
|
+
if (isUserCancellationError(error)) {
|
|
16
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
17
|
+
}
|
|
18
|
+
if (isNoSelectableChoicesError(error)) {
|
|
19
|
+
if (!Array.isArray(config)) {
|
|
20
|
+
uiLogger.log(config.message);
|
|
21
|
+
}
|
|
22
|
+
uiLogger.error(lib.prompts.promptUtils.errors.noSelectableChoices);
|
|
23
|
+
process.exit(EXIT_CODES.ERROR);
|
|
24
|
+
}
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
9
27
|
function mapPromptChoicesToChoices(choices) {
|
|
10
28
|
return (choices?.map(choice => {
|
|
11
29
|
if (typeof choice === 'string') {
|
|
@@ -86,10 +104,7 @@ export async function promptUser(config) {
|
|
|
86
104
|
}
|
|
87
105
|
}
|
|
88
106
|
catch (error) {
|
|
89
|
-
|
|
90
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
91
|
-
}
|
|
92
|
-
throw error;
|
|
107
|
+
handlePromptError(config, error);
|
|
93
108
|
}
|
|
94
109
|
}
|
|
95
110
|
function handleRawListPrompt(config) {
|
|
@@ -139,8 +154,10 @@ function handleCheckboxPrompt(config) {
|
|
|
139
154
|
}).then(resp => ({ [config.name]: resp }));
|
|
140
155
|
}
|
|
141
156
|
function handleConfirmPrompt(config) {
|
|
142
|
-
return
|
|
143
|
-
|
|
157
|
+
return confirm({
|
|
158
|
+
message: config.message,
|
|
159
|
+
default: config.default,
|
|
160
|
+
theme: PROMPT_THEME,
|
|
144
161
|
}).then(resp => ({ [config.name]: resp }));
|
|
145
162
|
}
|
|
146
163
|
function handleInputPrompt(config) {
|
|
@@ -165,12 +182,13 @@ function handleSelectPrompt(config) {
|
|
|
165
182
|
}
|
|
166
183
|
export async function confirmPrompt(message, options = {}) {
|
|
167
184
|
const { defaultAnswer = true } = options;
|
|
168
|
-
const
|
|
185
|
+
const { confirm: result } = await promptUser({
|
|
186
|
+
name: 'confirm',
|
|
187
|
+
type: 'confirm',
|
|
169
188
|
message,
|
|
170
189
|
default: defaultAnswer,
|
|
171
|
-
theme: PROMPT_THEME,
|
|
172
190
|
});
|
|
173
|
-
return
|
|
191
|
+
return result;
|
|
174
192
|
}
|
|
175
193
|
export async function listPrompt(message, { choices, when, defaultAnswer, validate, loop, }) {
|
|
176
194
|
const { choice } = await promptUser({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
import { uiAccountDescription } from '../ui/index.js';
|
|
4
4
|
import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
|
|
5
5
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
@@ -25,15 +25,15 @@ export async function sandboxTypePrompt() {
|
|
|
25
25
|
return promptUser([
|
|
26
26
|
{
|
|
27
27
|
name: 'type',
|
|
28
|
-
message:
|
|
28
|
+
message: lib.prompts.sandboxesPrompt.type.message,
|
|
29
29
|
type: 'list',
|
|
30
30
|
choices: [
|
|
31
31
|
{
|
|
32
|
-
name:
|
|
32
|
+
name: lib.prompts.sandboxesPrompt.type.developer,
|
|
33
33
|
value: HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX,
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
name:
|
|
36
|
+
name: lib.prompts.sandboxesPrompt.type.standard,
|
|
37
37
|
value: HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX,
|
|
38
38
|
},
|
|
39
39
|
],
|
|
@@ -52,9 +52,9 @@ export function deleteSandboxPrompt(promptParentAccount = false) {
|
|
|
52
52
|
return promptUser([
|
|
53
53
|
{
|
|
54
54
|
name: 'account',
|
|
55
|
-
message:
|
|
56
|
-
?
|
|
57
|
-
:
|
|
55
|
+
message: promptParentAccount
|
|
56
|
+
? lib.prompts.sandboxesPrompt.selectParentAccountName
|
|
57
|
+
: lib.prompts.sandboxesPrompt.selectAccountName,
|
|
58
58
|
type: 'list',
|
|
59
59
|
pageSize: 20,
|
|
60
60
|
choices,
|