@hubspot/cli 6.2.0 → 6.2.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.
@@ -7,7 +7,6 @@ const {
7
7
  const { logger } = require('@hubspot/local-dev-lib/logger');
8
8
  const path = require('path');
9
9
  const fs = require('fs-extra');
10
- const ora = require('ora');
11
10
  const {
12
11
  fetchFileFromRepository,
13
12
  cloneGithubRepo,
@@ -37,14 +36,13 @@ module.exports = {
37
36
  return;
38
37
  }
39
38
  }
40
- const downloadSpinner = ora(i18n(`${i18nKey}.loading.apiSamples`));
41
- downloadSpinner.start();
39
+
42
40
  const samplesConfig = await fetchFileFromRepository(
43
41
  'HubSpot/sample-apps-list',
44
42
  'samples.json',
45
43
  'main'
46
44
  );
47
- downloadSpinner.stop();
45
+
48
46
  if (!samplesConfig) {
49
47
  logger.error(i18n(`${i18nKey}.errors.noSamples`));
50
48
  return;
@@ -1,4 +1,4 @@
1
- const ora = require('ora');
1
+ const SpinniesManager = require('../../lib/ui/SpinniesManager');
2
2
  const {
3
3
  addAccountOptions,
4
4
  addConfigOptions,
@@ -7,7 +7,7 @@ const {
7
7
  } = require('../../lib/commonOpts');
8
8
  const { trackCommandUsage } = require('../../lib/usageTracking');
9
9
  const { logError, ApiErrorContext } = require('../../lib/errorHandlers/index');
10
-
10
+ const { uiAccountDescription } = require('../../lib/ui');
11
11
  const { poll } = require('../../lib/polling');
12
12
  const { logger } = require('@hubspot/local-dev-lib/logger');
13
13
  const {
@@ -30,7 +30,6 @@ exports.handler = async options => {
30
30
  const { path: functionPath } = options;
31
31
  const accountId = getAccountId(options);
32
32
  const splitFunctionPath = functionPath.split('.');
33
- let spinner;
34
33
 
35
34
  trackCommandUsage('functions-deploy', null, accountId);
36
35
 
@@ -52,17 +51,22 @@ exports.handler = async options => {
52
51
  })
53
52
  );
54
53
 
54
+ SpinniesManager.init();
55
+
56
+ SpinniesManager.add('loading', {
57
+ text: i18n(`${i18nKey}.loading`, {
58
+ account: uiAccountDescription(accountId),
59
+ functionPath,
60
+ }),
61
+ });
62
+
55
63
  try {
56
- spinner = ora(
57
- i18n(`${i18nKey}.loading`, {
58
- accountId,
59
- functionPath,
60
- })
61
- ).start();
62
64
  const { data: buildId } = await buildPackage(accountId, functionPath);
63
65
  const successResp = await poll(getBuildStatus, accountId, buildId);
64
66
  const buildTimeSeconds = (successResp.buildTime / 1000).toFixed(2);
65
- spinner.stop();
67
+
68
+ SpinniesManager.succeed('loading');
69
+
66
70
  await outputBuildLog(successResp.cdnUrl);
67
71
  logger.success(
68
72
  i18n(`${i18nKey}.success.deployed`, {
@@ -72,15 +76,19 @@ exports.handler = async options => {
72
76
  })
73
77
  );
74
78
  } catch (e) {
75
- spinner && spinner.stop && spinner.stop();
79
+ SpinniesManager.fail('loading', {
80
+ text: i18n(`${i18nKey}.loadingFailed`, {
81
+ account: uiAccountDescription(accountId),
82
+ functionPath,
83
+ }),
84
+ });
85
+
76
86
  if (isHubSpotHttpError(e) && e.status === 404) {
77
87
  logger.error(
78
88
  i18n(`${i18nKey}.errors.noPackageJson`, {
79
89
  functionPath,
80
90
  })
81
91
  );
82
- } else if (isHubSpotHttpError(e) && e.status === 400) {
83
- logger.error(e.error.message);
84
92
  } else if (e.status === 'ERROR') {
85
93
  await outputBuildLog(e.cdnUrl);
86
94
  logger.error(
@@ -100,9 +100,7 @@ exports.handler = async options => {
100
100
  const {
101
101
  data: { exportId },
102
102
  } = await cloneApp(accountId, appId);
103
- const {
104
- data: { status },
105
- } = await poll(checkCloneStatus, accountId, exportId);
103
+ const { status } = await poll(checkCloneStatus, accountId, exportId);
106
104
  if (status === 'SUCCESS') {
107
105
  // Ensure correct project folder structure exists
108
106
  const baseDestPath = path.resolve(getCwd(), location);
package/lang/en.lyaml CHANGED
@@ -183,8 +183,6 @@ en:
183
183
  noSamples: "Currently there are no samples available, please, try again later."
184
184
  info:
185
185
  sampleChosen: "You've chosen {{ sampleType }} sample written on {{ sampleLanguage }} language"
186
- loading:
187
- apiSamples: "Loading available API samples"
188
186
  success:
189
187
  sampleCreated: "Please, follow {{ filePath }}/README.md to find out how to run the sample"
190
188
  module:
@@ -335,7 +333,8 @@ en:
335
333
  notFunctionsFolder: "Specified path {{ functionPath }} is not a .functions folder."
336
334
  examples:
337
335
  default: "Build and deploy a new bundle for all functions within the myFunctionFolder.functions folder"
338
- loading: "Building and deploying bundle for \"{{ functionPath }}\" on account \"{{ accountId }}\".\n"
336
+ loading: "Building and deploying bundle for \"{{ functionPath }}\" on {{ account }}"
337
+ loadingFailed: "Failed to build and deploy bundle for \"{{ functionPath }}\" on {{ account }}"
339
338
  positionals:
340
339
  path:
341
340
  describe: "Path to .functions folder"
package/lib/localDev.js CHANGED
@@ -80,7 +80,13 @@ const confirmDefaultAccountIsTarget = async accountConfig => {
80
80
 
81
81
  // Confirm the default account is supported for the type of apps being developed
82
82
  const checkIfDefaultAccountIsSupported = (accountConfig, hasPublicApps) => {
83
- if (hasPublicApps && !isAppDeveloperAccount(accountConfig)) {
83
+ if (
84
+ hasPublicApps &&
85
+ !(
86
+ isAppDeveloperAccount(accountConfig) ||
87
+ isDeveloperTestAccount(accountConfig)
88
+ )
89
+ ) {
84
90
  logger.error(
85
91
  i18n(`${i18nKey}.checkIfDefaultAccountIsSupported.publicApp`, {
86
92
  useCommand: uiCommandReference('hs accounts use'),
package/lib/projects.js CHANGED
@@ -436,7 +436,7 @@ const pollProjectBuildAndDeploy = async (
436
436
  )
437
437
  );
438
438
 
439
- displayWarnLogs(accountId, projectConfig.name, buildId);
439
+ await displayWarnLogs(accountId, projectConfig.name, buildId);
440
440
  }
441
441
 
442
442
  // autoDeployId of 0 indicates a skipped deploy
@@ -495,7 +495,7 @@ const pollProjectBuildAndDeploy = async (
495
495
  }
496
496
 
497
497
  if (result && result.deployResult) {
498
- displayWarnLogs(
498
+ await displayWarnLogs(
499
499
  accountId,
500
500
  projectConfig.name,
501
501
  result.deployResult.deployId,
@@ -1003,10 +1003,13 @@ const displayWarnLogs = async (
1003
1003
  }
1004
1004
  }
1005
1005
 
1006
- if (result && result.logs.length) {
1007
- result.logs.forEach(log => {
1006
+ if (result && result.logs) {
1007
+ const logLength = result.logs.length;
1008
+ result.logs.forEach((log, i) => {
1008
1009
  logger.warn(log.message);
1009
- logger.log('');
1010
+ if (i < logLength - 1) {
1011
+ logger.log('');
1012
+ }
1010
1013
  });
1011
1014
  }
1012
1015
  };
@@ -16,7 +16,9 @@ const fetchPublicAppOptions = async (
16
16
  isMigratingApp = false
17
17
  ) => {
18
18
  try {
19
- const { data: publicApps } = await fetchPublicAppsForPortal(accountId);
19
+ const {
20
+ data: { results: publicApps },
21
+ } = await fetchPublicAppsForPortal(accountId);
20
22
  const filteredPublicApps = publicApps.filter(
21
23
  app => !app.projectId && !app.sourceId
22
24
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "6.2.0",
3
+ "version": "6.2.1",
4
4
  "description": "CLI for working with HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,11 +8,11 @@
8
8
  "url": "https://github.com/HubSpot/hubspot-cli"
9
9
  },
10
10
  "dependencies": {
11
- "@hubspot/local-dev-lib": "2.0.0",
11
+ "@hubspot/local-dev-lib": "^2.0.1",
12
12
  "@hubspot/serverless-dev-runtime": "6.2.0",
13
13
  "@hubspot/theme-preview-dev-server": "0.0.8",
14
14
  "@hubspot/ui-extensions-dev-server": "0.8.33",
15
- "archiver": "^5.3.0",
15
+ "archiver": "^7.0.1",
16
16
  "chalk": "^4.1.2",
17
17
  "chokidar": "^3.0.1",
18
18
  "cli-cursor": "^3.1.0",
@@ -24,13 +24,12 @@
24
24
  "js-yaml": "^4.1.0",
25
25
  "moment": "^2.29.1",
26
26
  "open": "^7.0.3",
27
- "ora": "^4.0.3",
28
27
  "p-queue": "^6.0.2",
29
28
  "strip-ansi": "^5.2.0",
30
29
  "table": "^6.6.0",
31
30
  "tmp": "^0.2.1",
32
31
  "update-notifier": "^5.1.0",
33
- "yargs": "15.4.1"
32
+ "yargs": "17.7.2"
34
33
  },
35
34
  "devDependencies": {
36
35
  "axios": "^1.7.2",
@@ -46,5 +45,5 @@
46
45
  "publishConfig": {
47
46
  "access": "public"
48
47
  },
49
- "gitHead": "760939368a64cd5dedf529ca89106253dbf98fce"
48
+ "gitHead": "bca108b05c57cfb6984cda5c09740760855c70d8"
50
49
  }