@hubspot/cli 5.1.3 → 5.1.4-beta.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.
Files changed (48) hide show
  1. package/commands/accounts/list.js +43 -31
  2. package/commands/customObject/create.js +10 -6
  3. package/commands/customObject/schema/create.js +10 -9
  4. package/commands/customObject/schema/delete.js +6 -6
  5. package/commands/customObject/schema/fetch.js +1 -1
  6. package/commands/customObject/schema/update.js +10 -9
  7. package/commands/functions/deploy.js +1 -1
  8. package/commands/functions/list.js +1 -1
  9. package/commands/hubdb/clear.js +4 -4
  10. package/commands/hubdb/create.js +5 -5
  11. package/commands/hubdb/delete.js +3 -3
  12. package/commands/hubdb/fetch.js +3 -3
  13. package/commands/mv.js +3 -2
  14. package/commands/project/deploy.js +4 -1
  15. package/commands/project/dev.js +33 -14
  16. package/commands/project/download.js +1 -1
  17. package/commands/project/listBuilds.js +1 -1
  18. package/commands/project/logs.js +7 -7
  19. package/commands/project/upload.js +5 -2
  20. package/commands/project/watch.js +7 -2
  21. package/commands/sandbox/create.js +6 -7
  22. package/commands/sandbox/delete.js +8 -11
  23. package/commands/sandbox/sync.js +18 -17
  24. package/commands/secrets/addSecret.js +5 -6
  25. package/commands/secrets/deleteSecret.js +5 -6
  26. package/commands/secrets/listSecrets.js +5 -6
  27. package/commands/secrets/updateSecret.js +5 -6
  28. package/lang/en.lyaml +3 -2
  29. package/lib/DevServerManager.js +12 -6
  30. package/lib/LocalDevManager.js +1 -1
  31. package/lib/constants.js +11 -0
  32. package/lib/developerTestAccounts.js +14 -0
  33. package/lib/lang.js +3 -1
  34. package/lib/marketplace-validate.js +1 -1
  35. package/lib/projects.js +6 -5
  36. package/lib/projectsWatch.js +61 -19
  37. package/lib/prompts/accountsPrompt.js +5 -7
  38. package/lib/prompts/downloadProjectPrompt.js +1 -1
  39. package/lib/prompts/projectDevTargetAccountPrompt.js +15 -11
  40. package/lib/prompts/projectsLogsPrompt.js +1 -1
  41. package/lib/prompts/sandboxesPrompt.js +12 -13
  42. package/lib/{sandbox-create.js → sandboxCreate.js} +100 -13
  43. package/lib/{sandbox-sync.js → sandboxSync.js} +7 -7
  44. package/lib/sandboxes.js +53 -136
  45. package/lib/schema.js +4 -2
  46. package/lib/ui.js +16 -5
  47. package/lib/validation.js +8 -6
  48. package/package.json +4 -4
@@ -9,13 +9,11 @@ const { loadAndValidateOptions } = require('../../lib/validation');
9
9
  const { i18n } = require('../../lib/lang');
10
10
  const { EXIT_CODES } = require('../../lib/enums/exitCodes');
11
11
  const { getAccountConfig, getEnv } = require('@hubspot/local-dev-lib/config');
12
- const { buildSandbox } = require('../../lib/sandbox-create');
13
- const { uiFeatureHighlight } = require('../../lib/ui');
12
+ const { buildSandbox } = require('../../lib/sandboxCreate');
13
+ const { uiFeatureHighlight, uiAccountDescription } = require('../../lib/ui');
14
14
  const {
15
15
  sandboxTypeMap,
16
- DEVELOPER_SANDBOX,
17
16
  getSandboxTypeAsString,
18
- getAccountName,
19
17
  getAvailableSyncTypes,
20
18
  syncTypes,
21
19
  validateSandboxUsageLimits,
@@ -31,12 +29,13 @@ const {
31
29
  sandboxNamePrompt,
32
30
  } = require('../../lib/prompts/sandboxesPrompt');
33
31
  const { promptUser } = require('../../lib/prompts/promptUtils');
34
- const { syncSandbox } = require('../../lib/sandbox-sync');
32
+ const { syncSandbox } = require('../../lib/sandboxSync');
35
33
  const { logErrorInstance } = require('../../lib/errorHandlers/standardErrors');
36
34
  const {
37
35
  isMissingScopeError,
38
36
  } = require('@hubspot/local-dev-lib/errors/apiErrors');
39
37
  const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
38
+ const { DEVELOPER_SANDBOX_TYPE } = require('../../lib/constants');
40
39
 
41
40
  const i18nKey = 'cli.commands.sandbox.subcommands.create';
42
41
 
@@ -123,7 +122,7 @@ exports.handler = async options => {
123
122
  name: 'sandboxSyncPrompt',
124
123
  type: 'confirm',
125
124
  message: i18n(`${syncI18nKey}.confirm.createFlow.${sandboxType}`, {
126
- parentAccountName: getAccountName(accountConfig),
125
+ parentAccountName: uiAccountDescription(accountId),
127
126
  sandboxName,
128
127
  }),
129
128
  },
@@ -192,7 +191,7 @@ exports.handler = async options => {
192
191
  }
193
192
 
194
193
  const highlightItems = ['accountsUseCommand', 'projectCreateCommand'];
195
- if (sandboxType === DEVELOPER_SANDBOX) {
194
+ if (sandboxType === DEVELOPER_SANDBOX_TYPE) {
196
195
  highlightItems.push('projectDevCommand');
197
196
  } else {
198
197
  highlightItems.push('projectUploadCommand');
@@ -22,7 +22,6 @@ const { deleteSandboxPrompt } = require('../../lib/prompts/sandboxesPrompt');
22
22
  const {
23
23
  getConfig,
24
24
  getEnv,
25
- getAccountConfig,
26
25
  removeSandboxAccountFromConfig,
27
26
  updateDefaultAccount,
28
27
  } = require('@hubspot/local-dev-lib/config');
@@ -33,8 +32,8 @@ const { EXIT_CODES } = require('../../lib/enums/exitCodes');
33
32
  const { promptUser } = require('../../lib/prompts/promptUtils');
34
33
  const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
35
34
 
36
- const { getAccountName } = require('../../lib/sandboxes');
37
35
  const { getValidEnv } = require('@hubspot/local-dev-lib/environment');
36
+ const { uiAccountDescription } = require('../../lib/ui');
38
37
 
39
38
  const i18nKey = 'cli.commands.sandbox.subcommands.delete';
40
39
 
@@ -69,7 +68,6 @@ exports.handler = async options => {
69
68
  const sandboxAccountId = getAccountId({
70
69
  account: account || accountPrompt.account,
71
70
  });
72
- const accountConfig = getAccountConfig(sandboxAccountId);
73
71
  const isDefaultAccount =
74
72
  sandboxAccountId === getAccountId(config.defaultPortal);
75
73
 
@@ -94,7 +92,6 @@ exports.handler = async options => {
94
92
  }
95
93
  }
96
94
 
97
- const parentAccount = getAccountConfig(parentAccountId);
98
95
  const url = `${baseUrl}/sandboxes/${parentAccountId}`;
99
96
  const command = `hs auth ${
100
97
  getEnv(sandboxAccountId) === 'qa' ? '--qa' : ''
@@ -115,14 +112,14 @@ exports.handler = async options => {
115
112
 
116
113
  logger.debug(
117
114
  i18n(`${i18nKey}.debug.deleting`, {
118
- account: getAccountName(accountConfig),
115
+ account: uiAccountDescription(sandboxAccountId),
119
116
  })
120
117
  );
121
118
 
122
119
  if (isDefaultAccount) {
123
120
  logger.info(
124
121
  i18n(`${i18nKey}.defaultAccountWarning`, {
125
- account: getAccountName(accountConfig),
122
+ account: uiAccountDescription(sandboxAccountId),
126
123
  })
127
124
  );
128
125
  logger.log('');
@@ -135,7 +132,7 @@ exports.handler = async options => {
135
132
  name: 'confirmSandboxDeletePrompt',
136
133
  type: 'confirm',
137
134
  message: i18n(`${i18nKey}.confirm`, {
138
- account: getAccountName(accountConfig),
135
+ account: uiAccountDescription(sandboxAccountId),
139
136
  }),
140
137
  },
141
138
  ]);
@@ -177,7 +174,7 @@ exports.handler = async options => {
177
174
  logger.log('');
178
175
  logger.error(
179
176
  i18n(`${i18nKey}.failure.invalidKey`, {
180
- account: getAccountName(parentAccount),
177
+ account: uiAccountDescription(parentAccountId),
181
178
  })
182
179
  );
183
180
  } else if (
@@ -190,8 +187,8 @@ exports.handler = async options => {
190
187
  logger.log('');
191
188
  logger.error(
192
189
  i18n(`${i18nKey}.failure.invalidUser`, {
193
- accountName: getAccountName(accountConfig),
194
- parentAccountName: getAccountName(parentAccount),
190
+ accountName: uiAccountDescription(sandboxAccountId),
191
+ parentAccountName: uiAccountDescription(parentAccountId),
195
192
  })
196
193
  );
197
194
  logger.log('');
@@ -205,7 +202,7 @@ exports.handler = async options => {
205
202
  logger.log('');
206
203
  logger.warn(
207
204
  i18n(`${i18nKey}.failure.objectNotFound`, {
208
- account: getAccountName(accountConfig),
205
+ account: uiAccountDescription(sandboxAccountId),
209
206
  })
210
207
  );
211
208
  logger.log('');
@@ -13,19 +13,20 @@ const { EXIT_CODES } = require('../../lib/enums/exitCodes');
13
13
  const { getAccountConfig, getEnv } = require('@hubspot/local-dev-lib/config');
14
14
  const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
15
15
  const { promptUser } = require('../../lib/prompts/promptUtils');
16
- const { uiLine } = require('../../lib/ui');
16
+ const { uiLine, uiAccountDescription } = require('../../lib/ui');
17
17
  const {
18
- getAccountName,
19
18
  sandboxTypeMap,
20
- DEVELOPER_SANDBOX,
21
- STANDARD_SANDBOX,
22
19
  getAvailableSyncTypes,
23
20
  getSyncTypesWithContactRecordsPrompt,
24
21
  } = require('../../lib/sandboxes');
25
- const { syncSandbox } = require('../../lib/sandbox-sync');
22
+ const { syncSandbox } = require('../../lib/sandboxSync');
26
23
  const { getValidEnv } = require('@hubspot/local-dev-lib/environment');
27
24
  const { isSpecifiedError } = require('@hubspot/local-dev-lib/errors/apiErrors');
28
25
  const { logErrorInstance } = require('../../lib/errorHandlers/standardErrors');
26
+ const {
27
+ DEVELOPER_SANDBOX_TYPE,
28
+ STANDARD_SANDBOX_TYPE,
29
+ } = require('../../lib/constants');
29
30
 
30
31
  const i18nKey = 'cli.commands.sandbox.subcommands.sync';
31
32
 
@@ -62,7 +63,7 @@ exports.handler = async options => {
62
63
  logger.log('');
63
64
  logger.error(
64
65
  i18n(`${i18nKey}.failure.missingParentPortal`, {
65
- sandboxName: getAccountName(accountConfig),
66
+ sandboxName: uiAccountDescription(accountId),
66
67
  })
67
68
  );
68
69
  process.exit(EXIT_CODES.ERROR);
@@ -70,9 +71,9 @@ exports.handler = async options => {
70
71
 
71
72
  const parentAccountConfig = getAccountConfig(parentAccountId);
72
73
  const isDevelopmentSandbox =
73
- sandboxTypeMap[accountConfig.sandboxAccountType] === DEVELOPER_SANDBOX;
74
+ sandboxTypeMap[accountConfig.sandboxAccountType] === DEVELOPER_SANDBOX_TYPE;
74
75
  const isStandardSandbox =
75
- sandboxTypeMap[accountConfig.sandboxAccountType] === STANDARD_SANDBOX;
76
+ sandboxTypeMap[accountConfig.sandboxAccountType] === STANDARD_SANDBOX_TYPE;
76
77
 
77
78
  let availableSyncTasks;
78
79
  try {
@@ -90,7 +91,7 @@ exports.handler = async options => {
90
91
  ) {
91
92
  logger.error(
92
93
  i18n('cli.lib.sandbox.sync.failure.objectNotFound', {
93
- account: getAccountName(accountConfig),
94
+ account: uiAccountDescription(accountId),
94
95
  })
95
96
  );
96
97
  } else {
@@ -103,8 +104,8 @@ exports.handler = async options => {
103
104
  logger.log(i18n(`${i18nKey}.info.developmentSandbox`));
104
105
  logger.log(
105
106
  i18n(`${i18nKey}.info.sync`, {
106
- parentAccountName: getAccountName(parentAccountConfig),
107
- sandboxName: getAccountName(accountConfig),
107
+ parentAccountName: uiAccountDescription(parentAccountId),
108
+ sandboxName: uiAccountDescription(accountId),
108
109
  })
109
110
  );
110
111
  uiLine();
@@ -119,8 +120,8 @@ exports.handler = async options => {
119
120
  name: 'confirmSandboxSyncPrompt',
120
121
  type: 'confirm',
121
122
  message: i18n(`${i18nKey}.confirm.developmentSandbox`, {
122
- parentAccountName: getAccountName(parentAccountConfig),
123
- sandboxName: getAccountName(accountConfig),
123
+ parentAccountName: uiAccountDescription(parentAccountId),
124
+ sandboxName: uiAccountDescription(accountId),
124
125
  }),
125
126
  },
126
127
  ]);
@@ -140,8 +141,8 @@ exports.handler = async options => {
140
141
  );
141
142
  logger.log(
142
143
  i18n(`${i18nKey}.info.sync`, {
143
- parentAccountName: getAccountName(parentAccountConfig),
144
- sandboxName: getAccountName(accountConfig),
144
+ parentAccountName: uiAccountDescription(parentAccountId),
145
+ sandboxName: uiAccountDescription(accountId),
145
146
  })
146
147
  );
147
148
  uiLine();
@@ -156,8 +157,8 @@ exports.handler = async options => {
156
157
  name: 'confirmSandboxSyncPrompt',
157
158
  type: 'confirm',
158
159
  message: i18n(`${i18nKey}.confirm.standardSandbox`, {
159
- parentAccountName: getAccountName(parentAccountConfig),
160
- sandboxName: getAccountName(accountConfig),
160
+ parentAccountName: uiAccountDescription(parentAccountId),
161
+ sandboxName: uiAccountDescription(accountId),
161
162
  }),
162
163
  },
163
164
  ]);
@@ -1,9 +1,9 @@
1
1
  const { logger } = require('@hubspot/cli-lib/logger');
2
2
  const {
3
- logServerlessFunctionApiErrorInstance,
3
+ logApiErrorInstance,
4
4
  ApiErrorContext,
5
5
  } = require('../../lib/errorHandlers/apiErrors');
6
- const { addSecret } = require('@hubspot/cli-lib/api/secrets');
6
+ const { addSecret } = require('@hubspot/local-dev-lib/api/secrets');
7
7
 
8
8
  const { loadAndValidateOptions } = require('../../lib/validation');
9
9
  const { trackCommandUsage } = require('../../lib/usageTracking');
@@ -41,15 +41,14 @@ exports.handler = async options => {
41
41
  secretName,
42
42
  })
43
43
  );
44
- } catch (e) {
44
+ } catch (err) {
45
45
  logger.error(
46
46
  i18n(`${i18nKey}.errors.add`, {
47
47
  secretName,
48
48
  })
49
49
  );
50
- await logServerlessFunctionApiErrorInstance(
51
- accountId,
52
- e,
50
+ logApiErrorInstance(
51
+ err,
53
52
  new ApiErrorContext({
54
53
  request: 'add secret',
55
54
  accountId,
@@ -1,9 +1,9 @@
1
1
  const { logger } = require('@hubspot/cli-lib/logger');
2
2
  const {
3
- logServerlessFunctionApiErrorInstance,
4
3
  ApiErrorContext,
4
+ logApiErrorInstance,
5
5
  } = require('../../lib/errorHandlers/apiErrors');
6
- const { deleteSecret } = require('@hubspot/cli-lib/api/secrets');
6
+ const { deleteSecret } = require('@hubspot/local-dev-lib/api/secrets');
7
7
 
8
8
  const { loadAndValidateOptions } = require('../../lib/validation');
9
9
  const { trackCommandUsage } = require('../../lib/usageTracking');
@@ -38,15 +38,14 @@ exports.handler = async options => {
38
38
  secretName,
39
39
  })
40
40
  );
41
- } catch (e) {
41
+ } catch (err) {
42
42
  logger.error(
43
43
  i18n(`${i18nKey}.errors.delete`, {
44
44
  secretName,
45
45
  })
46
46
  );
47
- await logServerlessFunctionApiErrorInstance(
48
- accountId,
49
- e,
47
+ logApiErrorInstance(
48
+ err,
50
49
  new ApiErrorContext({
51
50
  request: 'delete a secret',
52
51
  accountId,
@@ -1,9 +1,9 @@
1
1
  const { logger } = require('@hubspot/cli-lib/logger');
2
2
  const {
3
- logServerlessFunctionApiErrorInstance,
3
+ logApiErrorInstance,
4
4
  ApiErrorContext,
5
5
  } = require('../../lib/errorHandlers/apiErrors');
6
- const { fetchSecrets } = require('@hubspot/cli-lib/api/secrets');
6
+ const { fetchSecrets } = require('@hubspot/local-dev-lib/api/secrets');
7
7
 
8
8
  const { loadAndValidateOptions } = require('../../lib/validation');
9
9
  const { trackCommandUsage } = require('../../lib/usageTracking');
@@ -36,11 +36,10 @@ exports.handler = async options => {
36
36
  logger.group(groupLabel);
37
37
  results.forEach(secret => logger.log(secret));
38
38
  logger.groupEnd(groupLabel);
39
- } catch (e) {
39
+ } catch (err) {
40
40
  logger.error(i18n(`${i18nKey}.errors.list`));
41
- await logServerlessFunctionApiErrorInstance(
42
- accountId,
43
- e,
41
+ logApiErrorInstance(
42
+ err,
44
43
  new ApiErrorContext({
45
44
  request: 'add secret',
46
45
  accountId,
@@ -1,9 +1,9 @@
1
1
  const { logger } = require('@hubspot/cli-lib/logger');
2
2
  const {
3
- logServerlessFunctionApiErrorInstance,
4
3
  ApiErrorContext,
4
+ logApiErrorInstance,
5
5
  } = require('../../lib/errorHandlers/apiErrors');
6
- const { updateSecret } = require('@hubspot/cli-lib/api/secrets');
6
+ const { updateSecret } = require('@hubspot/local-dev-lib/api/secrets');
7
7
 
8
8
  const { loadAndValidateOptions } = require('../../lib/validation');
9
9
  const { trackCommandUsage } = require('../../lib/usageTracking');
@@ -42,15 +42,14 @@ exports.handler = async options => {
42
42
  })
43
43
  );
44
44
  logger.log(i18n(`${i18nKey}.success.updateExplanation`));
45
- } catch (e) {
45
+ } catch (err) {
46
46
  logger.error(
47
47
  i18n(`${i18nKey}.errors.update`, {
48
48
  secretName,
49
49
  })
50
50
  );
51
- await logServerlessFunctionApiErrorInstance(
52
- accountId,
53
- e,
51
+ logApiErrorInstance(
52
+ err,
54
53
  new ApiErrorContext({
55
54
  request: 'update secret',
56
55
  accountId,
package/lang/en.lyaml CHANGED
@@ -467,7 +467,7 @@ en:
467
467
  projectMustExistExplanation: "The project {{ projectName }} does not exist in the target account {{ accountIdentifier}}. This command requires the project to exist in the target account."
468
468
  choseNotToCreateProject: "Exiting because this command requires the project to exist in the target account."
469
469
  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 }}."
470
+ declineDefaultAccountExplanation: "To develop on a different account, run {{ useCommand }} to change your default account, then re-run {{ devCommand }}."
471
471
  status:
472
472
  creatingProject: "Creating project {{ projectName }} in {{ accountIdentifier }}"
473
473
  createdProject: "Created project {{ projectName }} in {{ accountIdentifier }}"
@@ -933,6 +933,7 @@ en:
933
933
  fileFiltered: "Ignore rule triggered for \"{{ filename }}\""
934
934
  ensureProjectExists:
935
935
  createPrompt: "The project {{ projectName }} does not exist in {{ accountIdentifier }}. Would you like to create it?"
936
+ createPromptUpload: "[--forceCreate] The project {{ projectName }} does not exist in {{ accountIdentifier }}. Would you like to create it?"
936
937
  createSuccess: "New project {{#bold}}{{ projectName }}{{/bold}} successfully created in {{#bold}}{{ accountIdentifier }}{{/bold}}."
937
938
  notFound: "Your project {{#bold}}{{ projectName }}{{/bold}} could not be found in {{#bold}}{{ accountIdentifier }}{{/bold}}."
938
939
  pollFetchProject:
@@ -1028,7 +1029,7 @@ en:
1028
1029
  promptMessage: "[--account] Choose a sandbox under {{ accountIdentifier }} to test with:"
1029
1030
  sandboxLimit: "Your account reached the limit of {{ limit }} development sandboxes"
1030
1031
  sandboxLimitWithSuggestion: "Your account reached the limit of {{ limit }} development sandboxes. Run {{ authCommand }} to add an existing one to the config."
1031
- confirmDefaultSandboxAccount: "Continue testing on {{#bold}}{{ accountName }} ({{ accountType }}){{/bold}}? (Y/n)"
1032
+ confirmDefaultAccount: "Continue testing on {{#bold}}{{ accountName }} ({{ accountType }}){{/bold}}? (Y/n)"
1032
1033
  projectLogsPrompt:
1033
1034
  projectName:
1034
1035
  message: "[--project] Enter the project name:"
@@ -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
  });
@@ -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) {
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
+ };
package/lib/lang.js CHANGED
@@ -52,11 +52,12 @@ const getTextValue = lookupDotNotation => {
52
52
  previouslyCheckedProp = prop;
53
53
  });
54
54
  } catch (e) {
55
- logger.error(
55
+ logger.debug(
56
56
  `Unable to access language property: ${lookupProps.join(
57
57
  '.'
58
58
  )}. Failed to access prop "${previouslyCheckedProp}".`
59
59
  );
60
+ logger.error('Unable to access language property.');
60
61
  return missingTextData;
61
62
  }
62
63
 
@@ -92,4 +93,5 @@ const setLangData = (newLocale, newLangObj) => {
92
93
  module.exports = {
93
94
  i18n,
94
95
  setLangData,
96
+ MISSING_LANGUAGE_DATA_PREFIX,
95
97
  };
@@ -5,7 +5,7 @@ const {
5
5
  requestValidation,
6
6
  getValidationStatus,
7
7
  getValidationResults,
8
- } = require('@hubspot/cli-lib/api/marketplaceValidation');
8
+ } = require('@hubspot/local-dev-lib/api/marketplaceValidation');
9
9
  const { i18n } = require('./lang');
10
10
  const { EXIT_CODES } = require('./enums/exitCodes');
11
11
 
package/lib/projects.js CHANGED
@@ -28,7 +28,8 @@ const {
28
28
  getDeployStructure,
29
29
  fetchProject,
30
30
  uploadProject,
31
- } = require('@hubspot/cli-lib/api/dfs');
31
+ } = require('@hubspot/local-dev-lib/api/projects');
32
+ const { isSpecifiedError } = require('@hubspot/local-dev-lib/errors/apiErrors');
32
33
  const { shouldIgnoreFile } = require('@hubspot/local-dev-lib/ignoreRules');
33
34
  const { getCwd, getAbsoluteFilePath } = require('@hubspot/local-dev-lib/path');
34
35
  const { downloadGitHubRepoContents } = require('@hubspot/cli-lib/github');
@@ -40,7 +41,6 @@ const SpinniesManager = require('./SpinniesManager');
40
41
  const {
41
42
  logApiErrorInstance,
42
43
  ApiErrorContext,
43
- isSpecifiedError, // Migrate isSpecifiedError to local-dev-lib version only after fetchProject is migrated to local-dev-lib
44
44
  isSpecifiedHubSpotAuthError,
45
45
  } = require('./errorHandlers/apiErrors');
46
46
  const { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH } = require('./constants');
@@ -238,6 +238,7 @@ const ensureProjectExists = async (
238
238
  allowCreate = true,
239
239
  noLogs = false,
240
240
  withPolling = false,
241
+ uploadCommand = false,
241
242
  } = {}
242
243
  ) => {
243
244
  const accountIdentifier = uiAccountDescription(accountId);
@@ -247,14 +248,14 @@ const ensureProjectExists = async (
247
248
  : await fetchProject(accountId, projectName);
248
249
  return !!project;
249
250
  } catch (err) {
250
- if (err.statusCode === 404) {
251
+ if (isSpecifiedError(err, { statusCode: 404 })) {
251
252
  let shouldCreateProject = forceCreate;
252
-
253
253
  if (allowCreate && !shouldCreateProject) {
254
+ const promptKey = uploadCommand ? 'createPromptUpload' : 'createPrompt';
254
255
  const promptResult = await promptUser([
255
256
  {
256
257
  name: 'shouldCreateProject',
257
- message: i18n(`${i18nKey}.ensureProjectExists.createPrompt`, {
258
+ message: i18n(`${i18nKey}.ensureProjectExists.${promptKey}`, {
258
259
  projectName,
259
260
  accountIdentifier,
260
261
  }),