@hubspot/cli 4.0.2-beta.3 → 4.0.2-beta.5

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 (42) hide show
  1. package/bin/cli.js +2 -0
  2. package/commands/accounts/list.js +1 -1
  3. package/commands/accounts/rename.js +1 -1
  4. package/commands/accounts/use.js +1 -1
  5. package/commands/config/set/allowUsageTracking.js +1 -1
  6. package/commands/config/set/defaultMode.js +1 -1
  7. package/commands/config/set/httpTimeout.js +1 -1
  8. package/commands/config/set.js +1 -1
  9. package/commands/create.js +2 -6
  10. package/commands/feedback.js +48 -0
  11. package/commands/filemanager/fetch.js +1 -1
  12. package/commands/functions/deploy.js +1 -1
  13. package/commands/functions/list.js +1 -2
  14. package/commands/functions/server.js +1 -1
  15. package/commands/hubdb/clear.js +1 -1
  16. package/commands/hubdb/create.js +1 -1
  17. package/commands/hubdb/delete.js +1 -1
  18. package/commands/hubdb/fetch.js +1 -1
  19. package/commands/lint.js +1 -1
  20. package/commands/list.js +1 -1
  21. package/commands/module/marketplace-validate.js +1 -1
  22. package/commands/mv.js +1 -1
  23. package/commands/open.js +1 -1
  24. package/commands/project/create.js +2 -1
  25. package/commands/project/deploy.js +4 -1
  26. package/commands/project/download.js +1 -1
  27. package/commands/project/listBuilds.js +1 -1
  28. package/commands/project/logs.js +1 -1
  29. package/commands/project/open.js +1 -1
  30. package/commands/project/upload.js +12 -2
  31. package/commands/project/watch.js +4 -1
  32. package/commands/remove.js +1 -1
  33. package/commands/sandbox/create.js +1 -3
  34. package/commands/sandbox/delete.js +1 -3
  35. package/commands/secrets/addSecret.js +1 -1
  36. package/commands/secrets/deleteSecret.js +1 -1
  37. package/commands/secrets/listSecrets.js +1 -1
  38. package/commands/secrets/updateSecret.js +1 -1
  39. package/commands/theme/marketplace-validate.js +1 -1
  40. package/lib/projects.js +16 -0
  41. package/lib/prompts/feedbackPrompt.js +40 -0
  42. package/package.json +4 -4
package/bin/cli.js CHANGED
@@ -40,6 +40,7 @@ const accountsCommand = require('../commands/accounts');
40
40
  const sandboxesCommand = require('../commands/sandbox');
41
41
  const processCommand = require('../commands/process');
42
42
  const cmsCommand = require('../commands/cms');
43
+ const feedbackCommand = require('../commands/feedback');
43
44
  const { EXIT_CODES } = require('../lib/enums/exitCodes');
44
45
 
45
46
  const notifier = updateNotifier({ pkg: { ...pkg, name: '@hubspot/cli' } });
@@ -159,6 +160,7 @@ const argv = yargs
159
160
  .command(accountsCommand)
160
161
  .command(sandboxesCommand)
161
162
  .command(processCommand, false)
163
+ .command(feedbackCommand)
162
164
  .help()
163
165
  .recommendCommands()
164
166
  .demandCommand(1, '')
@@ -72,7 +72,7 @@ exports.handler = async options => {
72
72
 
73
73
  const accountId = getAccountId(options);
74
74
 
75
- trackCommandUsage('accounts-list', {}, accountId);
75
+ trackCommandUsage('accounts-list', null, accountId);
76
76
 
77
77
  const config = getConfig();
78
78
  const configPath = getConfigPath();
@@ -21,7 +21,7 @@ exports.handler = async options => {
21
21
  const { accountName, newName } = options;
22
22
  const accountId = getAccountId(options);
23
23
 
24
- trackCommandUsage('accounts-rename', {}, accountId);
24
+ trackCommandUsage('accounts-rename', null, accountId);
25
25
 
26
26
  await renameAccount(accountName, newName);
27
27
 
@@ -37,7 +37,7 @@ exports.handler = async options => {
37
37
 
38
38
  trackCommandUsage(
39
39
  'accounts-use',
40
- {},
40
+ null,
41
41
  getAccountIdFromConfig(newDefaultAccount)
42
42
  );
43
43
 
@@ -33,7 +33,7 @@ const enableOrDisableUsageTracking = async () => {
33
33
  };
34
34
 
35
35
  const setAllowUsageTracking = async ({ accountId, allowUsageTracking }) => {
36
- trackCommandUsage('config-set-allow-usage-tracking', {}, accountId);
36
+ trackCommandUsage('config-set-allow-usage-tracking', null, accountId);
37
37
 
38
38
  let isEnabled;
39
39
 
@@ -27,7 +27,7 @@ const selectMode = async () => {
27
27
  };
28
28
 
29
29
  const setDefaultMode = async ({ accountId, defaultMode }) => {
30
- trackCommandUsage('config-set-default-mode', {}, accountId);
30
+ trackCommandUsage('config-set-default-mode', null, accountId);
31
31
 
32
32
  let newDefault;
33
33
 
@@ -20,7 +20,7 @@ const enterTimeout = async () => {
20
20
  };
21
21
 
22
22
  const setHttpTimeout = async ({ accountId, httpTimeout }) => {
23
- trackCommandUsage('config-set-http-timeout', {}, accountId);
23
+ trackCommandUsage('config-set-http-timeout', null, accountId);
24
24
 
25
25
  let newHttpTimeout;
26
26
 
@@ -54,7 +54,7 @@ exports.handler = async options => {
54
54
 
55
55
  const accountId = getAccountId(options);
56
56
 
57
- trackCommandUsage('config-set', {}, accountId);
57
+ trackCommandUsage('config-set', null, accountId);
58
58
 
59
59
  const configUpdated = await handleConfigUpdate(accountId, options);
60
60
 
@@ -93,13 +93,9 @@ exports.handler = async options => {
93
93
 
94
94
  if (asset.validate && !asset.validate(argsToPass)) return;
95
95
 
96
- const additionalTracking = (await asset.execute(argsToPass)) || {};
96
+ await asset.execute(argsToPass);
97
97
 
98
- trackCommandUsage(
99
- 'create',
100
- { assetType, ...additionalTracking },
101
- getAccountId(options)
102
- );
98
+ trackCommandUsage('create', { assetType }, getAccountId(options));
103
99
  };
104
100
 
105
101
  exports.builder = yargs => {
@@ -0,0 +1,48 @@
1
+ const open = require('open');
2
+
3
+ const { i18n } = require('@hubspot/cli-lib/lib/lang');
4
+ const {
5
+ FEEDBACK_OPTIONS,
6
+ FEEDBACK_URLS,
7
+ } = require('@hubspot/cli-lib/lib/constants');
8
+ const { logger } = require('@hubspot/cli-lib/logger');
9
+
10
+ const {
11
+ feedbackTypePrompt,
12
+ shouldOpenBrowserPrompt,
13
+ } = require('../lib/prompts/feedbackPrompt');
14
+
15
+ const i18nKey = 'cli.commands.project.subcommands.feedback';
16
+
17
+ exports.command = 'feedback';
18
+ exports.describe = i18n(`${i18nKey}.describe`);
19
+
20
+ exports.handler = async options => {
21
+ const { bug: bugFlag, general: generalFlag } = options;
22
+ const usedTypeFlag = bugFlag !== generalFlag;
23
+
24
+ const { type } = await feedbackTypePrompt(usedTypeFlag);
25
+ const { shouldOpen } = await shouldOpenBrowserPrompt(type, usedTypeFlag);
26
+
27
+ if (shouldOpen || usedTypeFlag) {
28
+ const url =
29
+ type === FEEDBACK_OPTIONS.BUG || bugFlag
30
+ ? FEEDBACK_URLS.BUG
31
+ : FEEDBACK_URLS.GENERAL;
32
+ open(url, { url: true });
33
+ logger.success(i18n(`${i18nKey}.success`, { url }));
34
+ }
35
+ };
36
+
37
+ exports.builder = yargs => {
38
+ yargs.options({
39
+ bug: {
40
+ describe: i18n(`${i18nKey}.options.bug.describe`),
41
+ type: 'boolean',
42
+ },
43
+ general: {
44
+ describe: i18n(`${i18nKey}.options.general.describe`),
45
+ type: 'boolean',
46
+ },
47
+ });
48
+ };
@@ -32,7 +32,7 @@ exports.handler = async options => {
32
32
 
33
33
  const accountId = getAccountId(options);
34
34
 
35
- trackCommandUsage('filemanager-fetch', {}, accountId);
35
+ trackCommandUsage('filemanager-fetch', null, accountId);
36
36
 
37
37
  // Fetch and write file/folder.
38
38
  await downloadFileOrFolder(accountId, src, dest, options);
@@ -50,7 +50,7 @@ exports.handler = async options => {
50
50
  const splitFunctionPath = functionPath.split('.');
51
51
  let spinner;
52
52
 
53
- trackCommandUsage('functions-deploy', { functionPath }, accountId);
53
+ trackCommandUsage('functions-deploy', null, accountId);
54
54
 
55
55
  if (
56
56
  !splitFunctionPath.length ||
@@ -29,10 +29,9 @@ exports.describe = i18n(`${i18nKey}.describe`);
29
29
  exports.handler = async options => {
30
30
  loadAndValidateOptions(options);
31
31
 
32
- const { json, compact } = options;
33
32
  const accountId = getAccountId(options);
34
33
 
35
- trackCommandUsage('functions-list', { json, compact }, accountId);
34
+ trackCommandUsage('functions-list', null, accountId);
36
35
 
37
36
  logger.debug(i18n(`${i18nKey}.debug.gettingFunctions`));
38
37
 
@@ -21,7 +21,7 @@ exports.handler = async options => {
21
21
  const { path: functionPath } = options;
22
22
  const accountId = getAccountId(options);
23
23
 
24
- trackCommandUsage('functions-server', { functionPath }, accountId);
24
+ trackCommandUsage('functions-server', null, accountId);
25
25
 
26
26
  logger.debug(
27
27
  i18n(`${i18nKey}.debug.startingServer`, {
@@ -26,7 +26,7 @@ exports.handler = async options => {
26
26
 
27
27
  const accountId = getAccountId(options);
28
28
 
29
- trackCommandUsage('hubdb-clear', {}, accountId);
29
+ trackCommandUsage('hubdb-clear', null, accountId);
30
30
 
31
31
  try {
32
32
  const { deletedRowCount } = await clearHubDbTableRows(accountId, tableId);
@@ -31,7 +31,7 @@ exports.handler = async options => {
31
31
 
32
32
  const accountId = getAccountId(options);
33
33
 
34
- trackCommandUsage('hubdb-create', {}, accountId);
34
+ trackCommandUsage('hubdb-create', null, accountId);
35
35
 
36
36
  try {
37
37
  const filePath = path.resolve(getCwd(), src);
@@ -24,7 +24,7 @@ exports.handler = async options => {
24
24
 
25
25
  const accountId = getAccountId(options);
26
26
 
27
- trackCommandUsage('hubdb-delete', {}, accountId);
27
+ trackCommandUsage('hubdb-delete', null, accountId);
28
28
 
29
29
  try {
30
30
  await deleteTable(accountId, tableId);
@@ -25,7 +25,7 @@ exports.handler = async options => {
25
25
 
26
26
  const accountId = getAccountId(options);
27
27
 
28
- trackCommandUsage('hubdb-fetch', {}, accountId);
28
+ trackCommandUsage('hubdb-fetch', null, accountId);
29
29
 
30
30
  try {
31
31
  const { filePath } = await downloadHubDbTable(accountId, tableId, dest);
package/commands/lint.js CHANGED
@@ -33,7 +33,7 @@ exports.handler = async options => {
33
33
  path: localPath,
34
34
  });
35
35
 
36
- trackCommandUsage('lint', {}, accountId);
36
+ trackCommandUsage('lint', null, accountId);
37
37
 
38
38
  logger.group(groupName);
39
39
  let count = 0;
package/commands/list.js CHANGED
@@ -37,7 +37,7 @@ exports.handler = async options => {
37
37
  const accountId = getAccountId(options);
38
38
  let contentsResp;
39
39
 
40
- trackCommandUsage('list', {}, accountId);
40
+ trackCommandUsage('list', null, accountId);
41
41
 
42
42
  logger.debug(
43
43
  i18n(`${i18nKey}.gettingPathContents`, {
@@ -38,7 +38,7 @@ exports.handler = async options => {
38
38
  })
39
39
  );
40
40
  }
41
- trackCommandUsage('validate', {}, accountId);
41
+ trackCommandUsage('validate', null, accountId);
42
42
 
43
43
  applyRelativeValidators(
44
44
  MARKETPLACE_VALIDATORS.module,
package/commands/mv.js CHANGED
@@ -36,7 +36,7 @@ exports.handler = async options => {
36
36
  const { srcPath, destPath } = options;
37
37
  const accountId = getAccountId(options);
38
38
 
39
- trackCommandUsage('mv', {}, accountId);
39
+ trackCommandUsage('mv', null, accountId);
40
40
 
41
41
  try {
42
42
  await moveFile(accountId, srcPath, getCorrectedDestPath(srcPath, destPath));
package/commands/open.js CHANGED
@@ -34,7 +34,7 @@ exports.handler = async options => {
34
34
  const { shortcut, list } = options;
35
35
  const accountId = getAccountId(options);
36
36
 
37
- trackCommandUsage('open', { shortcut }, accountId);
37
+ trackCommandUsage('open', null, accountId);
38
38
 
39
39
  if (shortcut === undefined && !list) {
40
40
  const choice = await createListPrompt(accountId);
@@ -30,7 +30,7 @@ exports.handler = async options => {
30
30
 
31
31
  const { name, template, location } = await createProjectPrompt(options);
32
32
 
33
- trackCommandUsage('project-create', { projectName: name }, accountId);
33
+ trackCommandUsage('project-create', null, accountId);
34
34
 
35
35
  await createProjectConfig(
36
36
  path.resolve(getCwd(), options.location || location),
@@ -45,6 +45,7 @@ exports.handler = async options => {
45
45
  'projectUploadCommand',
46
46
  'projectDeployCommand',
47
47
  'projectHelpCommand',
48
+ 'feedbackCommand',
48
49
  ]);
49
50
  };
50
51
 
@@ -15,6 +15,7 @@ const { loadAndValidateOptions } = require('../../lib/validation');
15
15
  const { getProjectConfig, pollDeployStatus } = require('../../lib/projects');
16
16
  const { projectNamePrompt } = require('../../lib/prompts/projectNamePrompt');
17
17
  const { i18n } = require('@hubspot/cli-lib/lib/lang');
18
+ // const { getAccountConfig } = require('@hubspot/cli-lib');
18
19
 
19
20
  const i18nKey = 'cli.commands.project.subcommands.deploy';
20
21
  const { EXIT_CODES } = require('../../lib/enums/exitCodes');
@@ -26,9 +27,11 @@ exports.handler = async options => {
26
27
  await loadAndValidateOptions(options);
27
28
 
28
29
  const accountId = getAccountId(options);
30
+ // const accountConfig = getAccountConfig(accountId);
29
31
  const { project, buildId } = options;
32
+ // const sandboxType = accountConfig && accountConfig.sandboxAccountType;
30
33
 
31
- trackCommandUsage('project-deploy', { project }, accountId);
34
+ trackCommandUsage('project-deploy', null, accountId);
32
35
 
33
36
  const { projectConfig } = await getProjectConfig();
34
37
 
@@ -36,7 +36,7 @@ exports.handler = async options => {
36
36
  const { name: projectName, dest, buildNumber } = options;
37
37
  const accountId = getAccountId(options);
38
38
 
39
- trackCommandUsage('project-download', { projectName }, accountId);
39
+ trackCommandUsage('project-download', null, accountId);
40
40
 
41
41
  const projectExists = await ensureProjectExists(accountId, projectName, {
42
42
  allowCreate: false,
@@ -40,7 +40,7 @@ exports.handler = async options => {
40
40
  const { path: projectPath, limit } = options;
41
41
  const accountId = getAccountId(options);
42
42
 
43
- trackCommandUsage('project-list-builds', { projectPath }, accountId);
43
+ trackCommandUsage('project-list-builds', null, accountId);
44
44
 
45
45
  const cwd = projectPath ? path.resolve(getCwd(), projectPath) : getCwd();
46
46
  const { projectConfig, projectDir } = await getProjectConfig(cwd);
@@ -188,7 +188,7 @@ exports.handler = async options => {
188
188
  }
189
189
  }
190
190
 
191
- trackCommandUsage('project-logs', { latest: options.latest }, accountId);
191
+ trackCommandUsage('project-logs', null, accountId);
192
192
 
193
193
  const logsInfo = [accountId, `"${projectName}"`];
194
194
  let tableHeader;
@@ -29,7 +29,7 @@ exports.handler = async options => {
29
29
  const accountId = getAccountId(options);
30
30
  const { project } = options;
31
31
 
32
- trackCommandUsage('project-open', { project }, accountId);
32
+ trackCommandUsage('project-open', null, accountId);
33
33
 
34
34
  const { projectConfig } = await getProjectConfig();
35
35
 
@@ -13,11 +13,13 @@ const {
13
13
  ensureProjectExists,
14
14
  getProjectConfig,
15
15
  handleProjectUpload,
16
+ logFeedbackMessage,
16
17
  pollBuildStatus,
17
18
  pollDeployStatus,
18
19
  validateProjectConfig,
19
20
  } = require('../../lib/projects');
20
21
  const { i18n } = require('@hubspot/cli-lib/lib/lang');
22
+ // const { getAccountConfig } = require('@hubspot/cli-lib');
21
23
  const { EXIT_CODES } = require('../../lib/enums/exitCodes');
22
24
 
23
25
  const i18nKey = 'cli.commands.project.subcommands.upload';
@@ -30,8 +32,10 @@ exports.handler = async options => {
30
32
 
31
33
  const { forceCreate, path: projectPath } = options;
32
34
  const accountId = getAccountId(options);
35
+ // const accountConfig = getAccountConfig(accountId);
36
+ // const sandboxType = accountConfig && accountConfig.sandboxAccountType;
33
37
 
34
- trackCommandUsage('project-upload', { projectPath }, accountId);
38
+ trackCommandUsage('project-upload', null, accountId);
35
39
 
36
40
  const { projectConfig, projectDir } = await getProjectConfig(projectPath);
37
41
 
@@ -43,17 +47,21 @@ exports.handler = async options => {
43
47
  let exitCode = EXIT_CODES.SUCCESS;
44
48
 
45
49
  const {
50
+ autoDeployId,
46
51
  isAutoDeployEnabled,
47
52
  deployStatusTaskLocator,
48
53
  status,
49
54
  } = await pollBuildStatus(accountId, projectConfig.name, buildId);
55
+ // autoDeployId of 0 indicates a skipped deploy
56
+ const isDeploying =
57
+ isAutoDeployEnabled && autoDeployId > 0 && deployStatusTaskLocator;
50
58
 
51
59
  uiLine();
52
60
 
53
61
  if (status === 'FAILURE') {
54
62
  exitCode = EXIT_CODES.ERROR;
55
63
  return;
56
- } else if (isAutoDeployEnabled && deployStatusTaskLocator) {
64
+ } else if (isDeploying) {
57
65
  logger.log(
58
66
  i18n(`${i18nKey}.logs.buildSucceededAutomaticallyDeploying`, {
59
67
  accountIdentifier: uiAccountDescription(accountId),
@@ -98,6 +106,8 @@ exports.handler = async options => {
98
106
  logger.error(e);
99
107
  }
100
108
 
109
+ logFeedbackMessage(buildId);
110
+
101
111
  process.exit(exitCode);
102
112
  };
103
113
 
@@ -19,6 +19,7 @@ const {
19
19
  pollBuildStatus,
20
20
  pollDeployStatus,
21
21
  validateProjectConfig,
22
+ logFeedbackMessage,
22
23
  } = require('../../lib/projects');
23
24
  const {
24
25
  cancelStagedBuild,
@@ -47,6 +48,8 @@ const handleBuildStatus = async (accountId, projectName, buildId) => {
47
48
  buildId
48
49
  );
49
50
  }
51
+
52
+ logFeedbackMessage(buildId);
50
53
  };
51
54
 
52
55
  const handleUserInput = (accountId, projectName, currentBuildId) => {
@@ -83,7 +86,7 @@ exports.handler = async options => {
83
86
  const { initialUpload, path: projectPath } = options;
84
87
  const accountId = getAccountId(options);
85
88
 
86
- trackCommandUsage('project-watch', { projectPath }, accountId);
89
+ trackCommandUsage('project-watch', null, accountId);
87
90
 
88
91
  const { projectConfig, projectDir } = await getProjectConfig(projectPath);
89
92
 
@@ -27,7 +27,7 @@ exports.handler = async options => {
27
27
 
28
28
  const accountId = getAccountId(options);
29
29
 
30
- trackCommandUsage('remove', {}, accountId);
30
+ trackCommandUsage('remove', null, accountId);
31
31
 
32
32
  try {
33
33
  await deleteFile(accountId, hsPath);
@@ -120,7 +120,7 @@ exports.handler = async options => {
120
120
  succeedColor: 'white',
121
121
  });
122
122
 
123
- trackCommandUsage('sandbox-create', {}, accountId);
123
+ trackCommandUsage('sandbox-create', null, accountId);
124
124
 
125
125
  let namePrompt;
126
126
 
@@ -151,8 +151,6 @@ exports.handler = async options => {
151
151
  } catch (err) {
152
152
  debugErrorAndContext(err);
153
153
 
154
- trackCommandUsage('sandbox-create', { success: false }, accountId);
155
-
156
154
  spinnies.fail('sandboxCreate', {
157
155
  text: i18n(`${i18nKey}.loading.fail`, {
158
156
  sandboxName,
@@ -49,7 +49,7 @@ exports.handler = async options => {
49
49
  account: account || accountPrompt.account,
50
50
  });
51
51
 
52
- trackCommandUsage('sandbox-delete', {}, sandboxAccountId);
52
+ trackCommandUsage('sandbox-delete', null, sandboxAccountId);
53
53
 
54
54
  let parentAccountId;
55
55
  for (const portal of config.portals) {
@@ -126,8 +126,6 @@ exports.handler = async options => {
126
126
  } catch (err) {
127
127
  debugErrorAndContext(err);
128
128
 
129
- trackCommandUsage('sandbox-delete', { success: false }, sandboxAccountId);
130
-
131
129
  if (
132
130
  err.error &&
133
131
  err.error.category === OBJECT_NOT_FOUND &&
@@ -28,7 +28,7 @@ exports.handler = async options => {
28
28
  await loadAndValidateOptions(options);
29
29
 
30
30
  const accountId = getAccountId(options);
31
- trackCommandUsage('secrets-add', {}, accountId);
31
+ trackCommandUsage('secrets-add', null, accountId);
32
32
 
33
33
  try {
34
34
  const { secretValue } = await secretValuePrompt();
@@ -27,7 +27,7 @@ exports.handler = async options => {
27
27
  await loadAndValidateOptions(options);
28
28
 
29
29
  const accountId = getAccountId(options);
30
- trackCommandUsage('secrets-delete', {}, accountId);
30
+ trackCommandUsage('secrets-delete', null, accountId);
31
31
 
32
32
  try {
33
33
  await deleteSecret(accountId, secretName);
@@ -25,7 +25,7 @@ exports.handler = async options => {
25
25
  await loadAndValidateOptions(options);
26
26
 
27
27
  const accountId = getAccountId(options);
28
- trackCommandUsage('secrets-list', {}, accountId);
28
+ trackCommandUsage('secrets-list', null, accountId);
29
29
 
30
30
  try {
31
31
  const { results } = await fetchSecrets(accountId);
@@ -28,7 +28,7 @@ exports.handler = async options => {
28
28
  await loadAndValidateOptions(options);
29
29
 
30
30
  const accountId = getAccountId(options);
31
- trackCommandUsage('secrets-update', {}, accountId);
31
+ trackCommandUsage('secrets-update', null, accountId);
32
32
 
33
33
  try {
34
34
  const { secretValue } = await secretValuePrompt();
@@ -63,7 +63,7 @@ exports.handler = async options => {
63
63
  })
64
64
  );
65
65
  }
66
- trackCommandUsage('validate', {}, accountId);
66
+ trackCommandUsage('validate', null, accountId);
67
67
 
68
68
  const themeFiles = await walk(absoluteSrcPath);
69
69
 
package/lib/projects.js CHANGED
@@ -11,6 +11,8 @@ const { cloneGitHubRepo } = require('@hubspot/cli-lib/github');
11
11
  const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
12
12
  const {
13
13
  ENVIRONMENTS,
14
+ FEEDBACK_INTERVAL,
15
+ ERROR_TYPES,
14
16
  POLLING_DELAY,
15
17
  PROJECT_TEMPLATES,
16
18
  PROJECT_BUILD_TEXT,
@@ -280,6 +282,9 @@ const uploadProjectFiles = async (accountId, projectName, filePath) => {
280
282
  projectName,
281
283
  })
282
284
  );
285
+ if (err.error.subCategory === ERROR_TYPES.PROJECT_LOCKED) {
286
+ logger.log(i18n(`${i18nKey}.logs.projectLockedError`));
287
+ }
283
288
  process.exit(EXIT_CODES.ERROR);
284
289
  }
285
290
 
@@ -517,6 +522,16 @@ const pollDeployStatus = makePollTaskStatusFunc({
517
522
  },
518
523
  });
519
524
 
525
+ const logFeedbackMessage = buildId => {
526
+ const i18nKey = 'cli.commands.project.subcommands.upload';
527
+ if (buildId > 0 && buildId % FEEDBACK_INTERVAL === 0) {
528
+ uiLine();
529
+ logger.log(i18n(`${i18nKey}.logs.feedbackHeader`));
530
+ uiLine();
531
+ logger.log(i18n(`${i18nKey}.logs.feedbackMessage`));
532
+ }
533
+ };
534
+
520
535
  module.exports = {
521
536
  writeProjectConfig,
522
537
  getProjectConfig,
@@ -529,4 +544,5 @@ module.exports = {
529
544
  pollBuildStatus,
530
545
  pollDeployStatus,
531
546
  ensureProjectExists,
547
+ logFeedbackMessage,
532
548
  };
@@ -0,0 +1,40 @@
1
+ const { promptUser } = require('./promptUtils');
2
+ const { i18n } = require('@hubspot/cli-lib/lib/lang');
3
+ const { FEEDBACK_OPTIONS } = require('@hubspot/cli-lib/lib/constants');
4
+
5
+ const i18nKey = 'cli.lib.prompts.feedbackPrompt';
6
+
7
+ const feedbackTypePrompt = bypassPrompt => {
8
+ return promptUser([
9
+ {
10
+ name: 'type',
11
+ message: i18n(`${i18nKey}.feedbackType.message`),
12
+ type: 'list',
13
+ when: !bypassPrompt,
14
+ choices: Object.values(FEEDBACK_OPTIONS).map(option => ({
15
+ name: i18n(`${i18nKey}.feedbackType.${option}`),
16
+ value: option,
17
+ })),
18
+ },
19
+ ]);
20
+ };
21
+
22
+ const shouldOpenBrowserPrompt = (type, bypassPrompt) => {
23
+ return promptUser([
24
+ {
25
+ name: 'shouldOpen',
26
+ message: () => {
27
+ return type === FEEDBACK_OPTIONS.BUG
28
+ ? i18n(`${i18nKey}.bugPrompt`)
29
+ : i18n(`${i18nKey}.generalPrompt`);
30
+ },
31
+ type: 'confirm',
32
+ when: !bypassPrompt,
33
+ },
34
+ ]);
35
+ };
36
+
37
+ module.exports = {
38
+ feedbackTypePrompt,
39
+ shouldOpenBrowserPrompt,
40
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "4.0.2-beta.3",
3
+ "version": "4.0.2-beta.5",
4
4
  "description": "CLI for working with HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,8 +8,8 @@
8
8
  "url": "https://github.com/HubSpot/hubspot-cms-tools"
9
9
  },
10
10
  "dependencies": {
11
- "@hubspot/cli-lib": "4.0.2-beta.3",
12
- "@hubspot/serverless-dev-runtime": "4.0.2-beta.3",
11
+ "@hubspot/cli-lib": "4.0.2-beta.5",
12
+ "@hubspot/serverless-dev-runtime": "4.0.2-beta.5",
13
13
  "archiver": "^5.3.0",
14
14
  "chalk": "^4.1.2",
15
15
  "express": "^4.17.1",
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "8d7d59214871eb34d2e9061e253c8d5d39ae0d9a"
40
+ "gitHead": "3c4cd0095cfd6b115da0c91def008240386b52a5"
41
41
  }