@hubspot/cli 4.0.1-beta.4 → 4.0.1-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.
@@ -49,7 +49,10 @@ const selectTheme = async accountId => {
49
49
  message: i18n(`${i18nKey}.info.promptMessage`),
50
50
  choices: async () => {
51
51
  try {
52
- const result = await fetchThemes(accountId);
52
+ const result = await fetchThemes(accountId, {
53
+ limit: 500,
54
+ sorting: 'MOST_USED',
55
+ });
53
56
  if (result && result.objects) {
54
57
  return result.objects
55
58
  .map(({ theme }) => theme.path)
package/commands/init.js CHANGED
@@ -8,6 +8,7 @@ const {
8
8
  } = require('@hubspot/cli-lib/lib/config');
9
9
  const { addConfigOptions } = require('../lib/commonOpts');
10
10
  const { handleExit } = require('@hubspot/cli-lib/lib/process');
11
+ const { checkAndUpdateGitignore } = require('@hubspot/cli-lib/lib/git');
11
12
  const { logErrorInstance } = require('@hubspot/cli-lib/errorHandlers');
12
13
  const {
13
14
  DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
@@ -116,6 +117,8 @@ exports.handler = async options => {
116
117
  );
117
118
  const configPath = getConfigPath();
118
119
 
120
+ checkAndUpdateGitignore(configPath);
121
+
119
122
  logger.log('');
120
123
  logger.success(
121
124
  i18n(`${i18nKey}.success.configFileCreated`, {
@@ -13,6 +13,9 @@ const { loadAndValidateOptions } = require('../../lib/validation');
13
13
  const { createSandboxPrompt } = require('../../lib/prompts/sandboxesPrompt');
14
14
  const { i18n } = require('@hubspot/cli-lib/lib/lang');
15
15
  const { logErrorInstance } = require('@hubspot/cli-lib/errorHandlers');
16
+ const {
17
+ debugErrorAndContext,
18
+ } = require('@hubspot/cli-lib/errorHandlers/standardErrors');
16
19
  const {
17
20
  ENVIRONMENTS,
18
21
  PERSONAL_ACCESS_KEY_AUTH_METHOD,
@@ -103,7 +106,7 @@ const personalAccessKeyFlow = async (env, account, name) => {
103
106
  ]);
104
107
  };
105
108
 
106
- exports.command = 'create [name]';
109
+ exports.command = 'create [--name]';
107
110
  exports.describe = i18n(`${i18nKey}.describe`);
108
111
 
109
112
  exports.handler = async options => {
@@ -146,11 +149,14 @@ exports.handler = async options => {
146
149
  }),
147
150
  });
148
151
  } catch (err) {
152
+ debugErrorAndContext(err);
153
+
149
154
  spinnies.fail('sandboxCreate', {
150
155
  text: i18n(`${i18nKey}.loading.fail`, {
151
156
  sandboxName,
152
157
  }),
153
158
  });
159
+
154
160
  if (isMissingScopeError(err)) {
155
161
  logger.error(
156
162
  i18n(`${i18nKey}.failure.scopes.message`, {
@@ -180,13 +186,16 @@ exports.handler = async options => {
180
186
  };
181
187
 
182
188
  exports.builder = yargs => {
183
- yargs.positional('name', {
184
- describe: i18n(`${i18nKey}.positionals.name.describe`),
189
+ yargs.option('name', {
190
+ describe: i18n(`${i18nKey}.options.name.describe`),
185
191
  type: 'string',
186
192
  });
187
193
 
188
194
  yargs.example([
189
- ['$0 sandbox create MySandboxAccount', i18n(`${i18nKey}.examples.default`)],
195
+ [
196
+ '$0 sandbox create --name=MySandboxAccount',
197
+ i18n(`${i18nKey}.examples.default`),
198
+ ],
190
199
  ]);
191
200
 
192
201
  addConfigOptions(yargs, true);
@@ -8,6 +8,9 @@ const {
8
8
  const { logger } = require('@hubspot/cli-lib/logger');
9
9
  const { trackCommandUsage } = require('../../lib/usageTracking');
10
10
  const { loadAndValidateOptions } = require('../../lib/validation');
11
+ const {
12
+ debugErrorAndContext,
13
+ } = require('@hubspot/cli-lib/errorHandlers/standardErrors');
11
14
 
12
15
  const { deleteSandbox } = require('@hubspot/cli-lib/sandboxes');
13
16
  const { i18n } = require('@hubspot/cli-lib/lib/lang');
@@ -117,6 +120,8 @@ exports.handler = async options => {
117
120
  }
118
121
  process.exit(EXIT_CODES.SUCCESS);
119
122
  } catch (err) {
123
+ debugErrorAndContext(err);
124
+
120
125
  if (
121
126
  err.error &&
122
127
  err.error.category === OBJECT_NOT_FOUND &&
package/lib/projects.js CHANGED
@@ -343,8 +343,9 @@ const makePollTaskStatusFunc = ({
343
343
  }
344
344
  };
345
345
 
346
- return async (accountId, taskName, taskId) => {
347
- let hubspotLinkText = '';
346
+ return async (accountId, taskName, taskId, deployedBuildId = null) => {
347
+ const displayId = deployedBuildId || taskId;
348
+
348
349
  if (linkToHubSpot) {
349
350
  logger.log(`\n${linkToHubSpot(taskName, taskId, accountId)}\n`);
350
351
  }
@@ -372,7 +373,7 @@ const makePollTaskStatusFunc = ({
372
373
  const subTaskName = subTask[statusText.SUBTASK_NAME_KEY];
373
374
 
374
375
  spinnies.add(subTaskName, {
375
- text: `${chalk.bold(subTaskName)} #${taskId} ${
376
+ text: `${chalk.bold(subTaskName)} #${displayId} ${
376
377
  statusText.STATUS_TEXT[statusText.STATES.ENQUEUED]
377
378
  }\n`,
378
379
  indent: 2,
@@ -395,7 +396,7 @@ const makePollTaskStatusFunc = ({
395
396
  return;
396
397
  }
397
398
 
398
- const updatedText = `${chalk.bold(subTaskName)} #${taskId} ${
399
+ const updatedText = `${chalk.bold(subTaskName)} #${displayId} ${
399
400
  statusText.STATUS_TEXT[subTask.status]
400
401
  }\n`;
401
402
 
@@ -413,17 +414,17 @@ const makePollTaskStatusFunc = ({
413
414
  });
414
415
 
415
416
  if (isTaskComplete(taskStatus)) {
416
- subTaskStatus.forEach(subTask => {
417
- spinnies.remove(subTask[statusText.SUBTASK_NAME_KEY]);
418
- });
417
+ // subTaskStatus.forEach(subTask => {
418
+ // spinnies.remove(subTask[statusText.SUBTASK_NAME_KEY]);
419
+ // });
419
420
 
420
421
  if (status === statusText.STATES.SUCCESS) {
421
422
  spinnies.succeed('overallTaskStatus', {
422
- text: `${statusStrings.SUCCESS(taskName)}${hubspotLinkText}`,
423
+ text: statusStrings.SUCCESS(taskName),
423
424
  });
424
425
  } else if (status === statusText.STATES.FAILURE) {
425
426
  spinnies.fail('overallTaskStatus', {
426
- text: `${statusStrings.FAIL(taskName)}${hubspotLinkText}`,
427
+ text: statusStrings.FAIL(taskName),
427
428
  });
428
429
 
429
430
  const failedSubtask = subTaskStatus.filter(
@@ -433,7 +434,7 @@ const makePollTaskStatusFunc = ({
433
434
  uiLine();
434
435
  logger.log(
435
436
  `${statusStrings.SUBTASK_FAIL(
436
- taskId,
437
+ displayId,
437
438
  failedSubtask.length === 1
438
439
  ? failedSubtask[0][statusText.SUBTASK_NAME_KEY]
439
440
  : failedSubtask.length + ' components'
@@ -481,8 +482,8 @@ const pollBuildStatus = makePollTaskStatusFunc({
481
482
  INITIALIZE: name => `Building ${chalk.bold(name)}`,
482
483
  SUCCESS: name => `Built ${chalk.bold(name)}`,
483
484
  FAIL: name => `Failed to build ${chalk.bold(name)}`,
484
- SUBTASK_FAIL: (taskId, name) =>
485
- `Build #${taskId} failed because there was a problem\nbuilding ${chalk.bold(
485
+ SUBTASK_FAIL: (buildId, name) =>
486
+ `Build #${buildId} failed because there was a problem\nbuilding ${chalk.bold(
486
487
  name
487
488
  )}`,
488
489
  },
@@ -495,8 +496,8 @@ const pollDeployStatus = makePollTaskStatusFunc({
495
496
  INITIALIZE: name => `Deploying ${chalk.bold(name)}`,
496
497
  SUCCESS: name => `Deployed ${chalk.bold(name)}`,
497
498
  FAIL: name => `Failed to deploy ${chalk.bold(name)}`,
498
- SUBTASK_FAIL: (taskId, name) =>
499
- `Deploy for build #${taskId} failed because there was a\nproblem deploying ${chalk.bold(
499
+ SUBTASK_FAIL: (deployedBuildId, name) =>
500
+ `Deploy for build #${deployedBuildId} failed because there was a\nproblem deploying ${chalk.bold(
500
501
  name
501
502
  )}`,
502
503
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "4.0.1-beta.4",
3
+ "version": "4.0.1-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.1-beta.4",
12
- "@hubspot/serverless-dev-runtime": "4.0.1-beta.4",
11
+ "@hubspot/cli-lib": "4.0.1-beta.5",
12
+ "@hubspot/serverless-dev-runtime": "4.0.1-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": "38cd22d1d1a3d8d06d65dfb40ba4d6b3b659e205"
40
+ "gitHead": "af927b5e071f91db0dd415fca154a446f259fe3b"
41
41
  }