Skip to content

Commit ffdb932

Browse files
Merge pull request #594 from HubSpot/clean-up-prompt-files
Cleaning up the prompt files
2 parents e77b372 + 60b0292 commit ffdb932

31 files changed

+294
-290
lines changed

packages/cli-lib/lang/en.lyaml

Lines changed: 65 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@ en:
128128
errors:
129129
pathExists: "The {{ path }} path already exists"
130130
nameRequired: "The \"name\" argument is required when creating a Custom Module."
131-
project:
132-
success:
133-
projectCreated: "Project created in {{ path }}"
134131
template:
135132
debug:
136133
creatingPath: "Making {{ path }} if needed"
@@ -622,39 +619,72 @@ en:
622619
useEnv:
623620
describe: "Use environment variable config"
624621
prompts:
625-
accountId: "Enter the account ID for your account (the number under the DOMAIN column at https://app.hubspot.com/myaccounts-beta ):"
626-
accountName: "Enter a unique name to reference your account:"
627-
apiKey: "Enter the API key for your account (found at https://app.hubspot.com/l/api-key):"
628-
clientId: "Enter your OAuth2 client ID:"
629-
clientSecret: "Enter your OAuth2 client secret:"
630-
errors:
631-
invalidAccountId: "You did not enter a valid account ID. Please try again."
632-
invalidAPIKey: "You did not enter a valid API key. Please try again"
633-
invalidName: "You entered an invalid name. Please try again."
634-
invalidOauthClientId: "You entered an invalid OAuth2 client ID. Please try again."
635-
invalidOauthClientIdLength: "The OAuth2 client ID must be 36 characters long. Please try again."
636-
invalidOauthClientSecret: "You entered an invalid OAuth2 client secret. Please try again."
637-
invalidOauthClientSecretLength: "The OAuth2 client secret must be 36 characters long. Please try again."
638-
invalidOauthClientSecretCopy: "Please copy the actual OAuth2 client secret rather than the asterisks that mask it."
639-
invalidPersonalAccessKey: "You did not enter a valid access key. Please try again."
640-
invalidPersonalAccessKeyCopy: "Please copy the actual access key rather than the bullets that mask it."
641-
nameRequired: "The name may not be blank. Please try again."
642-
spacesInName: "The name may not contain spaces. Please try again."
643-
folderOverwrite: "The folder with name \"{{ folderName }}\" already exists. Overwrite?"
644-
logs:
645-
openingWebBrowser: "Opening {{ url }} in your web browser"
646-
personalAccessKey: "Enter your personal access key:"
647-
personalAccessKeyBrowserOpenPrep: "When you're ready, we'll open a secure page in your default browser where you can view and copy your personal access key, which you'll need to complete the next step.\n<Press enter to open the page and generate your personal access key>"
648-
projects:
649-
enterDescription: "Enter a description for the project"
650-
enterLabel: "Enter a label for the project"
651-
selectTemplate: "Select a project template to use"
622+
personalAccessKeyPrompt:
623+
enterAccountId: "Enter the account ID for your account (the number under the DOMAIN column at https://app.hubspot.com/myaccounts-beta ): "
624+
enterClientId: "Enter your OAuth2 client ID: "
625+
enterClientSecret: "Enter your OAuth2 client secret: "
626+
enterAccountName: "Enter a unique name to reference your account: "
627+
enterApiKey: "Enter the API key for your account (found at https://app.hubspot.com/l/api-key): "
628+
enterPersonalAccessKey: "Enter your personal access key: "
629+
selectScopes: "Select access scopes (see https://developers.hubspot.com/docs/methods/oauth2/initiate-oauth-integration#scopes)"
630+
personalAccessKeyBrowserOpenPrep: "When you're ready, we'll open a secure page in your default browser where you can view and copy your personal access key, which you'll need to complete the next step.\n<Press enter to open the page and generate your personal access key>"
631+
logs:
632+
openingWebBrowser: "Opening {{ url }} in your web browser"
633+
errors:
634+
invalidAccountId: "You did not enter a valid account ID. Please try again."
635+
invalidAPIKey: "You did not enter a valid API key. Please try again"
636+
invalidName: "You entered an invalid name. Please try again."
637+
invalidOauthClientId: "You entered an invalid OAuth2 client ID. Please try again."
638+
invalidOauthClientIdLength: "The OAuth2 client ID must be 36 characters long. Please try again."
639+
invalidOauthClientSecret: "You entered an invalid OAuth2 client secret. Please try again."
640+
invalidOauthClientSecretLength: "The OAuth2 client secret must be 36 characters long. Please try again."
641+
invalidOauthClientSecretCopy: "Please copy the actual OAuth2 client secret rather than the asterisks that mask it."
642+
invalidPersonalAccessKey: "You did not enter a valid access key. Please try again."
643+
invalidPersonalAccessKeyCopy: "Please copy the actual access key rather than the bullets that mask it."
644+
nameRequired: "The name may not be blank. Please try again."
645+
spacesInName: "The name may not contain spaces. Please try again."
646+
folderOverwritePrompt:
647+
overwriteConfirm: "The folder with name \"{{ folderName }}\" already exists. Overwrite?"
648+
createTemplatePrompt:
649+
selectTemplate: "Select the type of template to create"
650+
createModulePrompt:
651+
enterLabel: "What should the module label be?"
652+
selectContentType: "What types of content will this module be used in?"
653+
confirmGlobal: "Is this a global module?"
654+
errors:
655+
invalidLabel: "You entered an invalid name. Please try again."
656+
labelRequired: "The name may not be blank. Please try again."
657+
contentTypeRequired: "Please select at least one content type for this module."
658+
createFunctionPrompt:
659+
enterFolder: "Name of the folder where your function will be created: "
660+
enterFilename: "Name of the JavaScript file for your function: "
661+
enterEndpointPath: "Path portion of the URL created for the function: "
662+
selectEndpointMethod: "Select the HTTP method for the endpoint"
663+
errors:
664+
invalid: "You entered an invalid name. Please try again."
665+
blank: "The name may not be blank. Please try again."
666+
space: "The name may not contain spaces. Please try again."
667+
createApiSamplePrompt:
668+
selectApiSampleApp: "Please, select API sample app"
669+
selectLanguage: "Please, select sample app's language"
670+
errors:
671+
apiSampleAppRequired: "Please select API sample app"
672+
languageRequired: "Please select API sample app's language"
673+
createProjectPrompt:
674+
enterName: "[--name] Give your project a name: "
675+
enterLocation: "[--location] Where should the project be created?"
676+
selectTemplate: "[--template] Start from a template?"
677+
templateOptions:
678+
noTemplate: "No template"
679+
errors:
680+
nameRequired: "A project name is required"
681+
locationRequired: "A project location is required"
682+
invalidTemplate: "[--template] Could not find template {{ template }}. Please choose an available template."
683+
secretPrompt:
684+
enterValue: "Enter a value for your secret: "
652685
errors:
653-
invalidDescription: "You entered an invalid description. Please try again."
654-
invalidLabel: "You entered an invalid label. Please try again."
655-
sandboxes:
686+
invalidValue: "You entered an invalid value. Please try again."
687+
sandboxesPrompt:
656688
enterName: "Enter a name to use for the sandbox: "
657689
errors:
658690
invalidName: "You entered an invalid name. Please try again."
659-
scopes: "Select access scopes (see https://developers.hubspot.com/docs/methods/oauth2/initiate-oauth-integration#scopes)"
660-

packages/cli/commands/auth.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ const {
1818
getConfigPath,
1919
} = require('@hubspot/cli-lib/lib/config');
2020
const { commaSeparatedValues } = require('@hubspot/cli-lib/lib/text');
21+
const { promptUser } = require('../lib/prompts/promptUtils');
2122
const {
22-
promptUser,
2323
personalAccessKeyPrompt,
2424
OAUTH_FLOW,
2525
API_KEY_FLOW,
2626
ACCOUNT_NAME,
27-
} = require('../lib/prompts');
27+
} = require('../lib/prompts/personalAccessKeyPrompt');
2828
const {
2929
addConfigOptions,
3030
setLogLevel,

packages/cli/commands/config/set/allowUsageTracking.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
const { logger } = require('@hubspot/cli-lib/logger');
22
const { updateAllowUsageTracking } = require('@hubspot/cli-lib/lib/config');
3-
const inquirer = require('inquirer');
43

54
const { getAccountId } = require('../../../lib/commonOpts');
65
const { trackCommandUsage } = require('../../../lib/usageTracking');
6+
const { promptUser } = require('../../../lib/prompts/promptUtils');
77
const { loadAndValidateOptions } = require('../../../lib/validation');
88
const { i18n } = require('@hubspot/cli-lib/lib/lang');
99

1010
const i18nKey =
1111
'cli.commands.config.subcommands.set.subcommands.allowUsageTracking';
1212

1313
const enableOrDisableUsageTracking = async () => {
14-
const { isEnabled } = await inquirer.prompt([
14+
const { isEnabled } = await promptUser([
1515
{
1616
type: 'list',
1717
look: false,

packages/cli/commands/config/set/defaultAccount.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ const {
44
getConfigPath,
55
updateDefaultAccount,
66
} = require('@hubspot/cli-lib/lib/config');
7-
const inquirer = require('inquirer');
87
const { loadAndValidateOptions } = require('../../../lib/validation');
98

109
const { getAccountId } = require('../../../lib/commonOpts');
1110
const { trackCommandUsage } = require('../../../lib/usageTracking');
11+
const { promptUser } = require('../../../lib/prompts/promptUtils');
1212
const { i18n } = require('@hubspot/cli-lib/lib/lang');
1313

1414
const i18nKey =
1515
'cli.commands.config.subcommands.set.subcommands.defaultAccount';
1616

1717
const selectAccountFromConfig = async config => {
18-
const { default: selectedDefault } = await inquirer.prompt([
18+
const { default: selectedDefault } = await promptUser([
1919
{
2020
type: 'list',
2121
look: false,

packages/cli/commands/config/set/defaultMode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const { logger } = require('@hubspot/cli-lib/logger');
22
const { updateDefaultMode } = require('@hubspot/cli-lib/lib/config');
3-
const inquirer = require('inquirer');
43
const { Mode } = require('@hubspot/cli-lib');
54
const { commaSeparatedValues } = require('@hubspot/cli-lib/lib/text');
65

76
const { getAccountId } = require('../../../lib/commonOpts');
87
const { trackCommandUsage } = require('../../../lib/usageTracking');
8+
const { promptUser } = require('../../../lib/prompts/promptUtils');
99
const { loadAndValidateOptions } = require('../../../lib/validation');
1010
const { i18n } = require('@hubspot/cli-lib/lib/lang');
1111

@@ -14,7 +14,7 @@ const i18nKey = 'cli.commands.config.subcommands.set.subcommands.defaultMode';
1414
const ALL_MODES = Object.values(Mode);
1515

1616
const selectMode = async () => {
17-
const { mode } = await inquirer.prompt([
17+
const { mode } = await promptUser([
1818
{
1919
type: 'list',
2020
look: false,

packages/cli/commands/create/api-sample.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
const { createApiSamplePrompt } = require('../../lib/createApiSamplePrompt');
2-
const { folderOverwritePrompt } = require('../../lib/prompts');
1+
const {
2+
createApiSamplePrompt,
3+
} = require('../../lib/prompts/createApiSamplePrompt');
4+
const {
5+
folderOverwritePrompt,
6+
} = require('../../lib/prompts/folderOverwritePrompt');
37
const { logger } = require('@hubspot/cli-lib/logger');
48
const path = require('path');
59
const fs = require('fs-extra');

packages/cli/commands/create/function.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const { createFunction } = require('@hubspot/cli-lib/functions');
2-
const { createFunctionPrompt } = require('../../lib/createFunctionPrompt');
2+
const {
3+
createFunctionPrompt,
4+
} = require('../../lib/prompts/createFunctionPrompt');
35

46
module.exports = {
57
dest: ({ name }) => name,

packages/cli/commands/create/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module.exports = {
33
app: require('./app'),
44
function: require('./function'),
55
module: require('./module'),
6-
project: require('./project'),
76
'react-app': require('./react-app'),
87
template: require('./template'),
98
'vue-app': require('./vue-app'),

packages/cli/commands/create/module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const path = require('path');
2-
const { createModulePrompt } = require('../../lib/createModulePrompt');
2+
const { createModulePrompt } = require('../../lib/prompts/createModulePrompt');
33
const fs = require('fs-extra');
44
const { logger } = require('@hubspot/cli-lib/logger');
55
const { i18n } = require('@hubspot/cli-lib/lib/lang');

packages/cli/commands/create/project.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)