@hubspot/cli 5.1.4-beta.0 → 5.1.4-beta.2

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.
Files changed (103) hide show
  1. package/bin/cli.js +1 -1
  2. package/commands/accounts/clean.js +1 -1
  3. package/commands/accounts/info.js +1 -1
  4. package/commands/accounts/list.js +44 -32
  5. package/commands/accounts/remove.js +1 -1
  6. package/commands/accounts/rename.js +1 -1
  7. package/commands/accounts/use.js +1 -1
  8. package/commands/auth.js +1 -1
  9. package/commands/cms/convertFields.js +1 -1
  10. package/commands/cms/lighthouseScore.js +1 -1
  11. package/commands/cms/reactModules.js +67 -0
  12. package/commands/cms.js +2 -0
  13. package/commands/config/set/allowUsageTracking.js +1 -1
  14. package/commands/config/set/defaultMode.js +1 -1
  15. package/commands/config/set/httpTimeout.js +1 -1
  16. package/commands/create/api-sample.js +1 -1
  17. package/commands/create/module.js +3 -3
  18. package/commands/create/template.js +1 -1
  19. package/commands/create.js +10 -4
  20. package/commands/customObject/create.js +1 -1
  21. package/commands/customObject/schema/create.js +1 -1
  22. package/commands/customObject/schema/delete.js +1 -1
  23. package/commands/customObject/schema/fetch-all.js +1 -1
  24. package/commands/customObject/schema/fetch.js +1 -1
  25. package/commands/customObject/schema/list.js +1 -1
  26. package/commands/customObject/schema/update.js +1 -1
  27. package/commands/customObject.js +1 -1
  28. package/commands/feedback.js +1 -1
  29. package/commands/fetch.js +1 -1
  30. package/commands/filemanager/fetch.js +1 -1
  31. package/commands/filemanager/upload.js +1 -1
  32. package/commands/functions/deploy.js +1 -1
  33. package/commands/functions/list.js +1 -1
  34. package/commands/functions/server.js +1 -1
  35. package/commands/hubdb/clear.js +1 -1
  36. package/commands/hubdb/create.js +1 -1
  37. package/commands/hubdb/delete.js +1 -1
  38. package/commands/hubdb/fetch.js +1 -1
  39. package/commands/init.js +1 -1
  40. package/commands/lint.js +1 -1
  41. package/commands/list.js +1 -1
  42. package/commands/logs.js +1 -1
  43. package/commands/mv.js +1 -1
  44. package/commands/project/add.js +1 -1
  45. package/commands/project/create.js +1 -1
  46. package/commands/project/deploy.js +1 -1
  47. package/commands/project/dev.js +30 -14
  48. package/commands/project/download.js +1 -1
  49. package/commands/project/listBuilds.js +1 -1
  50. package/commands/project/logs.js +1 -1
  51. package/commands/project/open.js +1 -1
  52. package/commands/project/upload.js +1 -1
  53. package/commands/project/watch.js +1 -1
  54. package/commands/remove.js +1 -1
  55. package/commands/sandbox/create.js +7 -8
  56. package/commands/sandbox/delete.js +9 -12
  57. package/commands/sandbox/sync.js +19 -18
  58. package/commands/secrets/addSecret.js +1 -1
  59. package/commands/secrets/deleteSecret.js +1 -1
  60. package/commands/secrets/listSecrets.js +1 -1
  61. package/commands/secrets/updateSecret.js +1 -1
  62. package/commands/theme/generate-selectors.js +1 -1
  63. package/commands/theme/preview.js +175 -0
  64. package/commands/theme.js +2 -0
  65. package/commands/upload.js +1 -1
  66. package/commands/watch.js +1 -1
  67. package/lang/en.lyaml +41 -2
  68. package/lib/DevServerManager.js +13 -7
  69. package/lib/LocalDevManager.js +2 -2
  70. package/lib/__tests__/validation.js +1 -1
  71. package/lib/commonOpts.js +4 -13
  72. package/lib/constants.js +11 -0
  73. package/lib/developerTestAccounts.js +14 -0
  74. package/lib/errorHandlers/apiErrors.js +1 -1
  75. package/lib/errorHandlers/fileSystemErrors.js +1 -1
  76. package/lib/errorHandlers/standardErrors.js +1 -1
  77. package/lib/generate-selectors.js +1 -1
  78. package/lib/hublValidate.js +1 -1
  79. package/lib/lang.js +1 -1
  80. package/lib/links.js +1 -1
  81. package/lib/marketplace-validate.js +1 -1
  82. package/lib/oauth.js +1 -1
  83. package/lib/process.js +5 -1
  84. package/lib/projectStructure.js +1 -1
  85. package/lib/projects.js +1 -1
  86. package/lib/projectsWatch.js +1 -1
  87. package/lib/prompts/accountsPrompt.js +5 -7
  88. package/lib/prompts/createModulePrompt.js +14 -1
  89. package/lib/prompts/createProjectPrompt.js +1 -1
  90. package/lib/prompts/personalAccessKeyPrompt.js +1 -1
  91. package/lib/prompts/previewPrompt.js +39 -0
  92. package/lib/prompts/projectDevTargetAccountPrompt.js +16 -12
  93. package/lib/prompts/projectsLogsPrompt.js +1 -1
  94. package/lib/prompts/sandboxesPrompt.js +12 -13
  95. package/lib/{sandbox-create.js → sandboxCreate.js} +101 -14
  96. package/lib/{sandbox-sync.js → sandboxSync.js} +8 -8
  97. package/lib/sandboxes.js +44 -126
  98. package/lib/schema.js +1 -1
  99. package/lib/serverlessLogs.js +1 -1
  100. package/lib/ui.js +17 -6
  101. package/lib/usageTracking.js +1 -1
  102. package/lib/validation.js +1 -1
  103. package/package.json +5 -4
@@ -10,7 +10,7 @@ const {
10
10
  convertToUnixPath,
11
11
  isAllowedExtension,
12
12
  } = require('@hubspot/local-dev-lib/path');
13
- const { logger } = require('@hubspot/cli-lib/logger');
13
+ const { logger } = require('@hubspot/local-dev-lib/logger');
14
14
  const {
15
15
  ApiErrorContext,
16
16
  logApiUploadErrorInstance,
package/commands/watch.js CHANGED
@@ -3,7 +3,7 @@ const path = require('path');
3
3
 
4
4
  const { watch } = require('@hubspot/cli-lib');
5
5
  const { getCwd } = require('@hubspot/local-dev-lib/path');
6
- const { logger } = require('@hubspot/cli-lib/logger');
6
+ const { logger } = require('@hubspot/local-dev-lib/logger');
7
7
 
8
8
  const {
9
9
  addConfigOptions,
package/lang/en.lyaml CHANGED
@@ -147,6 +147,19 @@ en:
147
147
  describe: "Medium to test against"
148
148
  verbose:
149
149
  describe: "View a detailed output of the lighthouse sores"
150
+ reactModule:
151
+ describe: "Get a specified default React module"
152
+ options:
153
+ name:
154
+ describe: "Name of the react modules to be fetched"
155
+ dest:
156
+ describe: "Destination to download the react module to"
157
+ success:
158
+ moduleDownloaded: "\"{{ moduleName }}\" succesfully downloaded to \"{{ path }}\""
159
+ errors:
160
+ pathExists: "Folder already exists at \"{{ path }}\""
161
+ invalidName: "Module not found with that name, please check the spelling of the module you are trying to download."
162
+ groupLabel: "React modules available to download:"
150
163
  create:
151
164
  describe: "Create HubSpot sample apps and CMS assets. Supported assets are {{ supportedAssetTypes }}."
152
165
  errors:
@@ -467,7 +480,7 @@ en:
467
480
  projectMustExistExplanation: "The project {{ projectName }} does not exist in the target account {{ accountIdentifier}}. This command requires the project to exist in the target account."
468
481
  choseNotToCreateProject: "Exiting because this command requires the project to exist in the target account."
469
482
  initialUploadMessage: "HubSpot Local Dev Server Startup"
470
- declineDefaultSandboxExplanation: "To develop on a different account, run {{ useCommand }} to change your default account, then re-run {{ devCommand }}."
483
+ declineDefaultAccountExplanation: "To develop on a different account, run {{ useCommand }} to change your default account, then re-run {{ devCommand }}."
471
484
  status:
472
485
  creatingProject: "Creating project {{ projectName }} in {{ accountIdentifier }}"
473
486
  createdProject: "Created project {{ projectName }} in {{ accountIdentifier }}"
@@ -876,6 +889,25 @@ en:
876
889
  disableInitial: "Passing the \"--disable-initial\" option is no longer necessary. Running \"hs watch\" no longer uploads the watched directory by default."
877
890
  initialUpload: "To upload the directory run \"hs upload\" beforehand or add the \"--initial-upload\" option when running \"hs watch\"."
878
891
  notUploaded: "The \"hs watch\" command no longer uploads the watched directory when started. The directory \"{{ path }}\" was not uploaded."
892
+ preview:
893
+ describe: "Upload and watch a theme directory on your computer for changes and start a local development server to preview theme changes on a site"
894
+ errors:
895
+ invalidPath: "The path \"{{ path }}\" is not a path to a directory"
896
+ options:
897
+ src:
898
+ describe: "Path to the local directory your theme is in, relative to your current working directory"
899
+ dest:
900
+ describe: "Path in HubSpot Design Tools. Can be a net new path. If you wish to preview a site page using your theme changes it must match the path of the theme used by the site."
901
+ notify:
902
+ describe: "Log to specified file when a watch task is triggered and after workers have gone idle. Ex. --notify path/to/file"
903
+ noSsl:
904
+ describe: "Disable HTTPS"
905
+ port:
906
+ describe: "The port on which to start the local server"
907
+ initialUploadProgressBar:
908
+ start: "Starting..."
909
+ uploading: "Uploading..."
910
+ finish: "Complete!"
879
911
  convertFields:
880
912
  describe: "Converts a specific JavaScript fields file of a module or theme to JSON"
881
913
  positionals:
@@ -1029,7 +1061,7 @@ en:
1029
1061
  promptMessage: "[--account] Choose a sandbox under {{ accountIdentifier }} to test with:"
1030
1062
  sandboxLimit: "Your account reached the limit of {{ limit }} development sandboxes"
1031
1063
  sandboxLimitWithSuggestion: "Your account reached the limit of {{ limit }} development sandboxes. Run {{ authCommand }} to add an existing one to the config."
1032
- confirmDefaultSandboxAccount: "Continue testing on {{#bold}}{{ accountName }} ({{ accountType }}){{/bold}}? (Y/n)"
1064
+ confirmDefaultAccount: "Continue testing on {{#bold}}{{ accountName }} ({{ accountType }}){{/bold}}? (Y/n)"
1033
1065
  projectLogsPrompt:
1034
1066
  projectName:
1035
1067
  message: "[--project] Enter the project name:"
@@ -1078,6 +1110,7 @@ en:
1078
1110
  selectTemplate: "Select the type of template to create"
1079
1111
  createModulePrompt:
1080
1112
  enterLabel: "What should the module label be?"
1113
+ selectReactType: "Is this a React module?"
1081
1114
  selectContentType: "What types of content will this module be used in?"
1082
1115
  confirmGlobal: "Is this a global module?"
1083
1116
  errors:
@@ -1161,6 +1194,12 @@ en:
1161
1194
  errors:
1162
1195
  buildIdDoesNotExist: "Build {{ buildId }} does not exist for project {{ projectName }}."
1163
1196
  buildAlreadyDeployed: "Build {{ buildId }} is already deployed."
1197
+ previewPrompt:
1198
+ enterSrc: "[--src] Enter a local theme directory to preview."
1199
+ enterDest: "[--dest] Enter the destination path for the src theme in HubSpot Design Tools."
1200
+ errors:
1201
+ srcRequired: "You must specify a source directory."
1202
+ destRequired: "You must specify a destination directory."
1164
1203
  cleanUploadPrompt:
1165
1204
  message: "You are about to remove any remote files in \"{{ filePath }}\" on HubSpot account {{ accountId }} that don't exist locally. Are you sure you want to do this?"
1166
1205
  convertFields:
@@ -1,4 +1,4 @@
1
- const { logger } = require('@hubspot/cli-lib/logger');
1
+ const { logger } = require('@hubspot/local-dev-lib/logger');
2
2
  const { COMPONENT_TYPES } = require('./projectStructure');
3
3
  const { i18n } = require('./lang');
4
4
  const { promptUser } = require('./prompts/promptUtils');
@@ -9,6 +9,11 @@ const {
9
9
  stopPortManagerServer,
10
10
  requestPorts,
11
11
  } = require('@hubspot/local-dev-lib/portManager');
12
+ const {
13
+ getHubSpotApiOrigin,
14
+ getHubSpotWebsiteOrigin,
15
+ } = require('@hubspot/local-dev-lib/urls');
16
+ const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
12
17
 
13
18
  const i18nKey = 'cli.lib.DevServerManager';
14
19
 
@@ -29,7 +34,6 @@ class DevServerManager {
29
34
  serverInterface: DevModeInterface,
30
35
  },
31
36
  };
32
- this.debug = false;
33
37
  }
34
38
 
35
39
  async iterateDevServers(callback) {
@@ -62,19 +66,22 @@ class DevServerManager {
62
66
  }, {});
63
67
  }
64
68
 
65
- async setup({ components, debug, onUploadRequired }) {
66
- this.debug = debug;
69
+ async setup({ components, onUploadRequired, accountId }) {
67
70
  this.componentsByType = this.arrangeComponentsByType(components);
68
-
71
+ const { env } = getAccountConfig(accountId);
69
72
  await startPortManagerServer();
70
73
  await this.iterateDevServers(
71
74
  async (serverInterface, compatibleComponents) => {
72
75
  if (serverInterface.setup) {
73
76
  await serverInterface.setup({
74
77
  components: compatibleComponents,
75
- debug,
76
78
  onUploadRequired,
77
79
  promptUser,
80
+ logger,
81
+ urls: {
82
+ api: getHubSpotApiOrigin(env),
83
+ web: getHubSpotWebsiteOrigin(env),
84
+ },
78
85
  });
79
86
  }
80
87
  }
@@ -89,7 +96,6 @@ class DevServerManager {
89
96
  if (serverInterface.start) {
90
97
  await serverInterface.start({
91
98
  accountId,
92
- debug: this.debug,
93
99
  projectConfig,
94
100
  requestPorts,
95
101
  });
@@ -3,7 +3,7 @@ const chokidar = require('chokidar');
3
3
  const chalk = require('chalk');
4
4
  const { i18n } = require('./lang');
5
5
  const { handleKeypress } = require('./process');
6
- const { logger } = require('@hubspot/cli-lib/logger');
6
+ const { logger } = require('@hubspot/local-dev-lib/logger');
7
7
  const {
8
8
  getAccountId,
9
9
  getConfigDefaultAccount,
@@ -322,8 +322,8 @@ class LocalDevManager {
322
322
  try {
323
323
  await DevServerManager.setup({
324
324
  components,
325
- debug: this.debug,
326
325
  onUploadRequired: this.logUploadWarning.bind(this),
326
+ accountId: this.targetAccountId,
327
327
  });
328
328
  return true;
329
329
  } catch (e) {
@@ -9,7 +9,7 @@ const { validateAccount } = require('../validation');
9
9
 
10
10
  jest.mock('@hubspot/cli-lib');
11
11
  jest.mock('@hubspot/local-dev-lib/config');
12
- jest.mock('@hubspot/cli-lib/logger');
12
+ jest.mock('@hubspot/local-dev-lib/logger');
13
13
  jest.mock('@hubspot/local-dev-lib/oauth');
14
14
  jest.mock('@hubspot/local-dev-lib/personalAccessKey');
15
15
  jest.mock('../commonOpts');
package/lib/commonOpts.js CHANGED
@@ -1,6 +1,6 @@
1
- const Logger = require('@hubspot/cli-lib/logger');
2
1
  const {
3
- setLogLevel: setLocalDevLibLogLevel,
2
+ LOG_LEVEL,
3
+ setLogLevel: setLoggerLogLevel,
4
4
  } = require('@hubspot/local-dev-lib/logger');
5
5
  const { DEFAULT_MODE, Mode } = require('@hubspot/cli-lib');
6
6
  const {
@@ -11,7 +11,6 @@ const {
11
11
  const { i18n } = require('./lang');
12
12
 
13
13
  const i18nKey = 'cli.lib.commonOpts';
14
- const { LOG_LEVEL } = Logger;
15
14
 
16
15
  const addAccountOptions = program =>
17
16
  program.option('portal', {
@@ -68,17 +67,9 @@ const addUseEnvironmentOptions = yargs =>
68
67
  const setLogLevel = (options = {}) => {
69
68
  const { debug } = options;
70
69
  if (debug) {
71
- Logger.setLogLevel(LOG_LEVEL.DEBUG);
72
-
73
- // Update the log level in local-dev-lib's instance of the logger
74
- // This will evenutally replace cli-lib's version of it
75
- setLocalDevLibLogLevel(LOG_LEVEL.DEBUG);
70
+ setLoggerLogLevel(LOG_LEVEL.DEBUG);
76
71
  } else {
77
- Logger.setLogLevel(LOG_LEVEL.LOG);
78
-
79
- // Update the log level in local-dev-lib's instance of the logger
80
- // This will evenutally replace cli-lib's version of it
81
- setLocalDevLibLogLevel(LOG_LEVEL.LOG);
72
+ setLoggerLogLevel(LOG_LEVEL.LOG);
82
73
  }
83
74
  };
84
75
 
package/lib/constants.js CHANGED
@@ -2,7 +2,18 @@ const HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH =
2
2
  'HubSpot/hubspot-project-components';
3
3
  const DEFAULT_PROJECT_TEMPLATE_BRANCH = 'main';
4
4
 
5
+ // Sandboxes
6
+ const STANDARD_SANDBOX_TYPE = 'standard';
7
+ const DEVELOPER_SANDBOX_TYPE = 'developer';
8
+
9
+ const STANDARD_SANDBOX = 'STANDARD';
10
+ const DEVELOPER_SANDBOX = 'DEVELOPER';
11
+
5
12
  module.exports = {
6
13
  HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
7
14
  DEFAULT_PROJECT_TEMPLATE_BRANCH,
15
+ STANDARD_SANDBOX_TYPE,
16
+ DEVELOPER_SANDBOX_TYPE,
17
+ STANDARD_SANDBOX,
18
+ DEVELOPER_SANDBOX,
8
19
  };
@@ -0,0 +1,14 @@
1
+ const {
2
+ HUBSPOT_ACCOUNT_TYPES,
3
+ } = require('@hubspot/local-dev-lib/constants/config');
4
+
5
+ const DEV_TEST_ACCOUNT_STRING = 'developer test account';
6
+
7
+ const isDeveloperTestAccount = config =>
8
+ config.accountType &&
9
+ config.accountType === HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST;
10
+
11
+ module.exports = {
12
+ DEV_TEST_ACCOUNT_STRING,
13
+ isDeveloperTestAccount,
14
+ };
@@ -1,4 +1,4 @@
1
- const { logger } = require('@hubspot/cli-lib/logger');
1
+ const { logger } = require('@hubspot/local-dev-lib/logger');
2
2
  const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
3
3
  const {
4
4
  getAxiosErrorWithContext,
@@ -1,4 +1,4 @@
1
- const { logger } = require('@hubspot/cli-lib/logger');
1
+ const { logger } = require('@hubspot/local-dev-lib/logger');
2
2
  const {
3
3
  ErrorContext,
4
4
  isSystemError,
@@ -2,7 +2,7 @@ const util = require('util');
2
2
  const {
3
3
  HubSpotAuthError,
4
4
  } = require('@hubspot/local-dev-lib/models/HubSpotAuthError');
5
- const { logger } = require('@hubspot/cli-lib/logger');
5
+ const { logger } = require('@hubspot/local-dev-lib/logger');
6
6
  const { i18n } = require('../lang');
7
7
 
8
8
  const i18nKey = 'cli.lib.errorHandlers.standardErrors';
@@ -1,6 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const { EXIT_CODES } = require('./enums/exitCodes');
3
- const { logger } = require('@hubspot/cli-lib/logger');
3
+ const { logger } = require('@hubspot/local-dev-lib/logger');
4
4
  const { i18n } = require('../lib/lang');
5
5
 
6
6
  const CSS_COMMENTS_REGEX = new RegExp(/\/\*.*\*\//, 'g');
@@ -1,4 +1,4 @@
1
- const { logger } = require('@hubspot/cli-lib/logger');
1
+ const { logger } = require('@hubspot/local-dev-lib/logger');
2
2
 
3
3
  const getErrorsFromHublValidationObject = validation =>
4
4
  (validation && validation.meta && validation.meta.template_errors) || [];
package/lib/lang.js CHANGED
@@ -2,7 +2,7 @@ const util = require('util');
2
2
  const path = require('path');
3
3
  const fs = require('fs-extra');
4
4
  const yaml = require('js-yaml');
5
- const { logger } = require('@hubspot/cli-lib/logger');
5
+ const { logger } = require('@hubspot/local-dev-lib/logger');
6
6
  const { interpolate } = require('./interpolation');
7
7
 
8
8
  const MISSING_LANGUAGE_DATA_PREFIX = '[Missing language data]';
package/lib/links.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const { getEnv } = require('@hubspot/local-dev-lib/config');
2
2
  const { ENVIRONMENTS } = require('@hubspot/cli-lib/lib/constants');
3
3
  const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
4
- const { logger } = require('@hubspot/cli-lib/logger');
4
+ const { logger } = require('@hubspot/local-dev-lib/logger');
5
5
  const {
6
6
  getTableContents,
7
7
  getTableHeader,
@@ -1,6 +1,6 @@
1
1
  const chalk = require('chalk');
2
2
 
3
- const { logger } = require('@hubspot/cli-lib/logger');
3
+ const { logger } = require('@hubspot/local-dev-lib/logger');
4
4
  const {
5
5
  requestValidation,
6
6
  getValidationStatus,
package/lib/oauth.js CHANGED
@@ -7,7 +7,7 @@ const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
7
7
  const { addOauthToAccountConfig } = require('@hubspot/local-dev-lib/oauth');
8
8
  const { handleExit } = require('./process');
9
9
  const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
10
- const { logger } = require('@hubspot/cli-lib/logger');
10
+ const { logger } = require('@hubspot/local-dev-lib/logger');
11
11
  const { ENVIRONMENTS } = require('@hubspot/cli-lib/lib/constants');
12
12
 
13
13
  const PORT = 3000;
package/lib/process.js CHANGED
@@ -1,5 +1,9 @@
1
1
  const readline = require('readline');
2
- const { logger, setLogLevel, LOG_LEVEL } = require('@hubspot/cli-lib/logger');
2
+ const {
3
+ logger,
4
+ setLogLevel,
5
+ LOG_LEVEL,
6
+ } = require('@hubspot/local-dev-lib/logger');
3
7
  const {
4
8
  setLogLevel: setLocalDevLibLogLevel,
5
9
  } = require('@hubspot/local-dev-lib/logger');
@@ -1,7 +1,7 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const { walk } = require('@hubspot/local-dev-lib/fs');
4
- const { logger } = require('@hubspot/cli-lib/logger');
4
+ const { logger } = require('@hubspot/local-dev-lib/logger');
5
5
  const { logErrorInstance } = require('./errorHandlers/standardErrors');
6
6
 
7
7
  const COMPONENT_TYPES = Object.freeze({
package/lib/projects.js CHANGED
@@ -4,7 +4,7 @@ const archiver = require('archiver');
4
4
  const tmp = require('tmp');
5
5
  const chalk = require('chalk');
6
6
  const findup = require('findup-sync');
7
- const { logger } = require('@hubspot/cli-lib/logger');
7
+ const { logger } = require('@hubspot/local-dev-lib/logger');
8
8
  const { getEnv } = require('@hubspot/local-dev-lib/config');
9
9
  const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
10
10
  const {
@@ -7,7 +7,7 @@ const {
7
7
  ApiErrorContext,
8
8
  } = require('./errorHandlers/apiErrors');
9
9
  const { i18n } = require('@hubspot/cli-lib/lib/lang');
10
- const { logger } = require('@hubspot/cli-lib/logger');
10
+ const { logger } = require('@hubspot/local-dev-lib/logger');
11
11
  const { isAllowedExtension } = require('@hubspot/local-dev-lib/path');
12
12
  const { shouldIgnoreFile } = require('@hubspot/local-dev-lib/ignoreRules');
13
13
  const {
@@ -1,15 +1,13 @@
1
1
  const { updateDefaultAccount } = require('@hubspot/local-dev-lib/config');
2
2
  const { promptUser } = require('./promptUtils');
3
3
  const { i18n } = require('../lang');
4
- const { getAccountName } = require('../sandboxes');
4
+ const { uiAccountDescription } = require('../ui');
5
5
 
6
6
  const mapAccountChoices = portals =>
7
- portals.map(p => {
8
- return {
9
- name: getAccountName(p),
10
- value: p.name || p.portalId,
11
- };
12
- });
7
+ portals.map(p => ({
8
+ name: uiAccountDescription(p.portalId, false),
9
+ value: p.name || p.portalId,
10
+ }));
13
11
 
14
12
  const i18nKey = 'cli.commands.accounts.subcommands.use';
15
13
 
@@ -15,6 +15,14 @@ const MODULE_LABEL_PROMPT = {
15
15
  return true;
16
16
  },
17
17
  };
18
+
19
+ const REACT_TYPE_PROMPT = {
20
+ type: 'confirm',
21
+ name: 'reactType',
22
+ message: i18n(`${i18nKey}.selectReactType`),
23
+ default: false,
24
+ };
25
+
18
26
  const CONTENT_TYPES_PROMPT = {
19
27
  type: 'checkbox',
20
28
  name: 'contentTypes',
@@ -44,7 +52,12 @@ const GLOBAL_PROMPT = {
44
52
  };
45
53
 
46
54
  function createModulePrompt() {
47
- return promptUser([MODULE_LABEL_PROMPT, CONTENT_TYPES_PROMPT, GLOBAL_PROMPT]);
55
+ return promptUser([
56
+ MODULE_LABEL_PROMPT,
57
+ REACT_TYPE_PROMPT,
58
+ CONTENT_TYPES_PROMPT,
59
+ GLOBAL_PROMPT,
60
+ ]);
48
61
  }
49
62
 
50
63
  module.exports = {
@@ -7,7 +7,7 @@ const {
7
7
  const { promptUser } = require('./promptUtils');
8
8
  const { fetchJsonFromRepository } = require('@hubspot/cli-lib/github');
9
9
  const { i18n } = require('../lang');
10
- const { logger } = require('@hubspot/cli-lib/logger');
10
+ const { logger } = require('@hubspot/local-dev-lib/logger');
11
11
  const { EXIT_CODES } = require('../../lib/enums/exitCodes');
12
12
  const {
13
13
  HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
@@ -5,7 +5,7 @@ const {
5
5
  } = require('@hubspot/cli-lib/lib/constants');
6
6
  const { deleteEmptyConfigFile } = require('@hubspot/local-dev-lib/config');
7
7
  const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
8
- const { logger } = require('@hubspot/cli-lib/logger');
8
+ const { logger } = require('@hubspot/local-dev-lib/logger');
9
9
  const { promptUser } = require('./promptUtils');
10
10
  const { accountNamePrompt } = require('./enterAccountNamePrompt');
11
11
  const { i18n } = require('../lang');
@@ -0,0 +1,39 @@
1
+ const path = require('path');
2
+ const { getCwd } = require('@hubspot/local-dev-lib/path');
3
+ const { promptUser } = require('./promptUtils');
4
+ const { i18n } = require('../lang');
5
+
6
+ const i18nKey = 'cli.lib.prompts.previewPrompt';
7
+
8
+ const previewPrompt = (promptOptions = {}) => {
9
+ return promptUser([
10
+ {
11
+ name: 'src',
12
+ message: i18n(`${i18nKey}.enterSrc`),
13
+ when: !promptOptions.src,
14
+ default: '.',
15
+ validate: input => {
16
+ if (!input) {
17
+ return i18n(`${i18nKey}.errors.srcRequired`);
18
+ }
19
+ return true;
20
+ },
21
+ },
22
+ {
23
+ name: 'dest',
24
+ message: i18n(`${i18nKey}.enterDest`),
25
+ when: !promptOptions.dest,
26
+ default: path.basename(getCwd()),
27
+ validate: input => {
28
+ if (!input) {
29
+ return i18n(`${i18nKey}.errors.destRequired`);
30
+ }
31
+ return true;
32
+ },
33
+ },
34
+ ]);
35
+ };
36
+
37
+ module.exports = {
38
+ previewPrompt,
39
+ };
@@ -1,15 +1,16 @@
1
1
  const { promptUser } = require('./promptUtils');
2
2
  const { i18n } = require('../lang');
3
3
  const { uiAccountDescription, uiCommandReference } = require('../ui');
4
- const { isSandbox, getAccountName } = require('../sandboxes');
4
+ const { isSandbox } = require('../sandboxes');
5
5
  const { getAccountId } = require('@hubspot/local-dev-lib/config');
6
6
  const { getSandboxUsageLimits } = require('@hubspot/local-dev-lib/sandboxes');
7
- const { logger } = require('@hubspot/cli-lib/logger');
7
+ const { logger } = require('@hubspot/local-dev-lib/logger');
8
+ const { DEVELOPER_SANDBOX, STANDARD_SANDBOX } = require('../constants');
8
9
 
9
10
  const i18nKey = 'cli.lib.prompts.projectDevTargetAccountPrompt';
10
11
 
11
12
  const mapSandboxAccount = accountConfig => ({
12
- name: getAccountName(accountConfig, false),
13
+ name: uiAccountDescription(accountConfig.portalId, false),
13
14
  value: {
14
15
  targetAccountId: getAccountId(accountConfig.name),
15
16
  createNewSandbox: false,
@@ -33,15 +34,18 @@ const selectTargetAccountPrompt = async (accounts, defaultAccountConfig) => {
33
34
  );
34
35
  let disabledMessage = false;
35
36
 
36
- if (sandboxUsage['DEVELOPER'] && sandboxUsage['DEVELOPER'].available === 0) {
37
- if (sandboxAccounts.length < sandboxUsage['DEVELOPER'].limit) {
37
+ if (
38
+ sandboxUsage[DEVELOPER_SANDBOX] &&
39
+ sandboxUsage[DEVELOPER_SANDBOX].available === 0
40
+ ) {
41
+ if (sandboxAccounts.length < sandboxUsage[DEVELOPER_SANDBOX].limit) {
38
42
  disabledMessage = i18n(`${i18nKey}.sandboxLimitWithSuggestion`, {
39
43
  authCommand: uiCommandReference('hs auth'),
40
- limit: sandboxUsage['DEVELOPER'].limit,
44
+ limit: sandboxUsage[DEVELOPER_SANDBOX].limit,
41
45
  });
42
46
  } else {
43
47
  disabledMessage = i18n(`${i18nKey}.sandboxLimit`, {
44
- limit: sandboxUsage['DEVELOPER'].limit,
48
+ limit: sandboxUsage[DEVELOPER_SANDBOX].limit,
45
49
  });
46
50
  }
47
51
  }
@@ -49,10 +53,10 @@ const selectTargetAccountPrompt = async (accounts, defaultAccountConfig) => {
49
53
  // Order choices by Developer Sandbox -> Standard Sandbox
50
54
  const choices = [
51
55
  ...sandboxAccounts
52
- .filter(a => a.sandboxAccountType === 'DEVELOPER')
56
+ .filter(a => a.sandboxAccountType === DEVELOPER_SANDBOX)
53
57
  .map(mapSandboxAccount),
54
58
  ...sandboxAccounts
55
- .filter(a => a.sandboxAccountType === 'STANDARD')
59
+ .filter(a => a.sandboxAccountType === STANDARD_SANDBOX)
56
60
  .map(mapSandboxAccount),
57
61
  {
58
62
  name: i18n(`${i18nKey}.createNewSandboxOption`),
@@ -85,12 +89,12 @@ const selectTargetAccountPrompt = async (accounts, defaultAccountConfig) => {
85
89
  return targetAccountInfo;
86
90
  };
87
91
 
88
- const confirmDefaultSandboxAccountPrompt = async (accountName, accountType) => {
92
+ const confirmDefaultAccountPrompt = async (accountName, accountType) => {
89
93
  const { useDefaultAccount } = await promptUser([
90
94
  {
91
95
  name: 'useDefaultAccount',
92
96
  type: 'confirm',
93
- message: i18n(`${i18nKey}.confirmDefaultSandboxAccount`, {
97
+ message: i18n(`${i18nKey}.confirmDefaultAccount`, {
94
98
  accountName,
95
99
  accountType,
96
100
  }),
@@ -101,5 +105,5 @@ const confirmDefaultSandboxAccountPrompt = async (accountName, accountType) => {
101
105
 
102
106
  module.exports = {
103
107
  selectTargetAccountPrompt,
104
- confirmDefaultSandboxAccountPrompt,
108
+ confirmDefaultAccountPrompt,
105
109
  };
@@ -7,7 +7,7 @@ const {
7
7
  logApiErrorInstance,
8
8
  ApiErrorContext,
9
9
  } = require('../../lib/errorHandlers/apiErrors');
10
- const { logger } = require('@hubspot/cli-lib/logger');
10
+ const { logger } = require('@hubspot/local-dev-lib/logger');
11
11
  const { EXIT_CODES } = require('../enums/exitCodes');
12
12
 
13
13
  const i18nKey = 'cli.lib.prompts.projectLogsPrompt';
@@ -1,11 +1,13 @@
1
1
  const { promptUser } = require('./promptUtils');
2
2
  const { i18n } = require('../lang');
3
+ const { accountNameExistsInConfig } = require('@hubspot/local-dev-lib/config');
4
+ const { uiAccountDescription } = require('../ui');
3
5
  const {
4
- getSandboxTypeAsString,
5
- STANDARD_SANDBOX,
6
6
  DEVELOPER_SANDBOX,
7
- } = require('../sandboxes');
8
- const { accountNameExistsInConfig } = require('@hubspot/local-dev-lib/config');
7
+ STANDARD_SANDBOX,
8
+ STANDARD_SANDBOX_TYPE,
9
+ DEVELOPER_SANDBOX_TYPE,
10
+ } = require('../constants');
9
11
 
10
12
  const i18nKey = 'cli.lib.prompts.sandboxesPrompt';
11
13
 
@@ -13,11 +15,8 @@ const mapSandboxAccountChoices = portals =>
13
15
  portals
14
16
  .filter(p => p.sandboxAccountType && p.sandboxAccountType !== null)
15
17
  .map(p => {
16
- const sandboxName = `[${getSandboxTypeAsString(
17
- p.sandboxAccountType
18
- )} sandbox] `;
19
18
  return {
20
- name: `${p.name} ${sandboxName}(${p.portalId})`,
19
+ name: uiAccountDescription(p.portalId, false),
21
20
  value: p.name || p.portalId,
22
21
  };
23
22
  });
@@ -34,8 +33,8 @@ const mapNonSandboxAccountChoices = portals =>
34
33
  };
35
34
  });
36
35
 
37
- const sandboxNamePrompt = (type = STANDARD_SANDBOX) => {
38
- const isDeveloperSandbox = type === DEVELOPER_SANDBOX;
36
+ const sandboxNamePrompt = (type = STANDARD_SANDBOX_TYPE) => {
37
+ const isDeveloperSandbox = type === DEVELOPER_SANDBOX_TYPE;
39
38
  const namePromptMessage = isDeveloperSandbox
40
39
  ? `${i18nKey}.name.developmentSandboxMessage`
41
40
  : `${i18nKey}.name.message`;
@@ -61,11 +60,11 @@ const sandboxNamePrompt = (type = STANDARD_SANDBOX) => {
61
60
  const sandboxTypeChoices = [
62
61
  {
63
62
  name: i18n(`${i18nKey}.type.developer`),
64
- value: 'DEVELOPER',
63
+ value: DEVELOPER_SANDBOX,
65
64
  },
66
65
  {
67
66
  name: i18n(`${i18nKey}.type.standard`),
68
- value: 'STANDARD',
67
+ value: STANDARD_SANDBOX,
69
68
  },
70
69
  ];
71
70
 
@@ -77,7 +76,7 @@ const sandboxTypePrompt = () => {
77
76
  type: 'list',
78
77
  look: false,
79
78
  choices: sandboxTypeChoices,
80
- default: 'DEVELOPER',
79
+ default: DEVELOPER_SANDBOX,
81
80
  },
82
81
  ]);
83
82
  };