@hubspot/cli 3.0.10-beta.6 → 3.0.10

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 (90) hide show
  1. package/README.md +7 -1
  2. package/bin/cli.js +3 -4
  3. package/commands/accounts/list.js +18 -26
  4. package/commands/accounts/rename.js +13 -24
  5. package/commands/accounts.js +4 -1
  6. package/commands/auth.js +33 -16
  7. package/commands/config/set/allowUsageTracking.js +17 -33
  8. package/commands/config/set/defaultAccount.js +24 -34
  9. package/commands/config/set/defaultMode.js +25 -44
  10. package/commands/config/set/httpTimeout.js +10 -28
  11. package/commands/config/set.js +4 -1
  12. package/commands/config.js +4 -1
  13. package/commands/create/api-sample.js +20 -14
  14. package/commands/create/function.js +3 -1
  15. package/commands/create/index.js +0 -1
  16. package/commands/create/module.js +20 -7
  17. package/commands/create/template.js +22 -5
  18. package/commands/create/website-theme.js +12 -1
  19. package/commands/create.js +23 -8
  20. package/commands/customObject/create.js +22 -24
  21. package/commands/customObject/schema/create.js +30 -28
  22. package/commands/customObject/schema/delete.js +20 -20
  23. package/commands/customObject/schema/fetch-all.js +17 -24
  24. package/commands/customObject/schema/fetch.js +29 -24
  25. package/commands/customObject/schema/list.js +8 -17
  26. package/commands/customObject/schema/update.js +31 -29
  27. package/commands/customObject/schema.js +4 -1
  28. package/commands/customObject.js +10 -21
  29. package/commands/fetch.js +15 -30
  30. package/commands/filemanager/fetch.js +13 -25
  31. package/commands/filemanager/upload.js +47 -35
  32. package/commands/filemanager.js +4 -1
  33. package/commands/functions/deploy.js +34 -37
  34. package/commands/functions/list.js +9 -24
  35. package/commands/functions/server.js +13 -29
  36. package/commands/functions.js +4 -1
  37. package/commands/hubdb/clear.js +25 -21
  38. package/commands/hubdb/create.js +25 -22
  39. package/commands/hubdb/delete.js +19 -20
  40. package/commands/hubdb/fetch.js +15 -20
  41. package/commands/hubdb.js +4 -1
  42. package/commands/init.js +25 -13
  43. package/commands/lint.js +14 -23
  44. package/commands/list.js +19 -25
  45. package/commands/logs.js +23 -44
  46. package/commands/mv.js +21 -25
  47. package/commands/open.js +9 -7
  48. package/commands/project/create.js +26 -42
  49. package/commands/project/deploy.js +35 -36
  50. package/commands/project/listBuilds.js +160 -0
  51. package/commands/project/logs.js +87 -79
  52. package/commands/project/upload.js +74 -78
  53. package/commands/project/watch.js +103 -0
  54. package/commands/project.js +5 -6
  55. package/commands/remove.js +12 -20
  56. package/commands/sandbox/create.js +18 -13
  57. package/commands/secrets/addSecret.js +19 -22
  58. package/commands/secrets/deleteSecret.js +18 -21
  59. package/commands/secrets/listSecrets.js +10 -19
  60. package/commands/secrets/updateSecret.js +19 -22
  61. package/commands/secrets.js +4 -1
  62. package/commands/server.js +15 -6
  63. package/commands/{marketplaceValidate/validateTheme.js → theme/marketplace-validate.js} +26 -24
  64. package/commands/theme.js +5 -3
  65. package/commands/upload.js +66 -45
  66. package/commands/watch.js +33 -55
  67. package/lib/commonOpts.js +14 -11
  68. package/lib/enums/exitCodes.js +14 -0
  69. package/lib/links.js +0 -10
  70. package/lib/projects.js +121 -77
  71. package/lib/{createApiSamplePrompt.js → prompts/createApiSamplePrompt.js} +10 -11
  72. package/lib/{createFunctionPrompt.js → prompts/createFunctionPrompt.js} +27 -21
  73. package/lib/{createModulePrompt.js → prompts/createModulePrompt.js} +12 -9
  74. package/lib/prompts/createProjectPrompt.js +68 -0
  75. package/lib/{createTemplatePrompt.js → prompts/createTemplatePrompt.js} +7 -4
  76. package/lib/prompts/folderOverwritePrompt.js +17 -0
  77. package/lib/{prompts.js → prompts/personalAccessKeyPrompt.js} +25 -42
  78. package/lib/prompts/promptUtils.js +10 -0
  79. package/lib/prompts/sandboxesPrompt.js +24 -0
  80. package/lib/prompts/secretPrompt.js +25 -0
  81. package/lib/serverlessLogs.js +4 -3
  82. package/lib/ui.js +48 -0
  83. package/lib/validation.js +4 -3
  84. package/package.json +8 -7
  85. package/commands/app/deploy.js +0 -116
  86. package/commands/app.js +0 -14
  87. package/commands/create/project.js +0 -25
  88. package/lib/prompts/projects.js +0 -40
  89. package/lib/prompts/sandboxes.js +0 -22
  90. package/lib/secretPrompt.js +0 -22
@@ -1,4 +1,3 @@
1
- const inquirer = require('inquirer');
2
1
  const open = require('open');
3
2
  const {
4
3
  OAUTH_SCOPES,
@@ -6,12 +5,11 @@ const {
6
5
  } = require('@hubspot/cli-lib/lib/constants');
7
6
  const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
8
7
  const { logger } = require('@hubspot/cli-lib/logger');
9
- const { API_KEY_REGEX, STRING_WITH_NO_SPACES_REGEX } = require('./regex');
8
+ const { API_KEY_REGEX, STRING_WITH_NO_SPACES_REGEX } = require('../regex');
9
+ const { promptUser } = require('./promptUtils');
10
+ const { i18n } = require('@hubspot/cli-lib/lib/lang');
10
11
 
11
- const promptUser = async promptConfig => {
12
- const prompt = inquirer.createPromptModule();
13
- return prompt(promptConfig);
14
- };
12
+ const i18nKey = 'cli.lib.prompts.personalAccessKeyPrompt';
15
13
 
16
14
  /**
17
15
  * Displays notification to user that we are about to open the browser,
@@ -25,7 +23,7 @@ const personalAccessKeyPrompt = async ({ env } = {}) => {
25
23
  open(url, { url: true });
26
24
  }
27
25
 
28
- logger.log(`Opening ${url} in your web browser`);
26
+ logger.log(i18n(`${i18nKey}.logs.openingWebBrowser`, { url }));
29
27
  const { personalAccessKey } = await promptUser(PERSONAL_ACCESS_KEY);
30
28
 
31
29
  return {
@@ -36,25 +34,24 @@ const personalAccessKeyPrompt = async ({ env } = {}) => {
36
34
 
37
35
  const ACCOUNT_ID = {
38
36
  name: 'accountId',
39
- message:
40
- 'Enter the account ID for your account (the number under the DOMAIN column at https://app.hubspot.com/myaccounts-beta ):',
37
+ message: i18n(`${i18nKey}.enterAccountId`),
41
38
  type: 'number',
42
39
  validate(val) {
43
40
  if (!Number.isNaN(val) && val > 0) {
44
41
  return true;
45
42
  }
46
- return 'You did not enter a valid account ID. Please try again.';
43
+ return i18n(`${i18nKey}.errors.invalidAccountId`);
47
44
  },
48
45
  };
49
46
 
50
47
  const CLIENT_ID = {
51
48
  name: 'clientId',
52
- message: 'Enter your OAuth2 client ID:',
49
+ message: i18n(`${i18nKey}.enterClientId`),
53
50
  validate(val) {
54
51
  if (typeof val !== 'string') {
55
- return 'You entered an invalid OAuth2 client ID. Please try again.';
52
+ return i18n(`${i18nKey}.errors.invalidOauthClientId`);
56
53
  } else if (val.length !== 36) {
57
- return 'The OAuth2 client ID must be 36 characters long. Please try again.';
54
+ return i18n(`${i18nKey}.errors.invalidOauthClientIdLength`);
58
55
  }
59
56
  return true;
60
57
  },
@@ -62,14 +59,14 @@ const CLIENT_ID = {
62
59
 
63
60
  const CLIENT_SECRET = {
64
61
  name: 'clientSecret',
65
- message: 'Enter your OAuth2 client secret:',
62
+ message: i18n(`${i18nKey}.enterClientSecret`),
66
63
  validate(val) {
67
64
  if (typeof val !== 'string') {
68
- return 'You entered an invalid OAuth2 client secret. Please try again.';
65
+ return i18n(`${i18nKey}.errors.invalidOauthClientSecret`);
69
66
  } else if (val.length !== 36) {
70
- return 'The OAuth2 client secret must be 36 characters long. Please try again.';
67
+ return i18n(`${i18nKey}.errors.invalidOauthClientSecretLength`);
71
68
  } else if (val[0] === '*') {
72
- return 'Please copy the actual OAuth2 client secret rather than the asterisks that mask it.';
69
+ return i18n(`${i18nKey}.errors.invalidOauthClientSecretCopy`);
73
70
  }
74
71
  return true;
75
72
  },
@@ -77,14 +74,14 @@ const CLIENT_SECRET = {
77
74
 
78
75
  const ACCOUNT_NAME = {
79
76
  name: 'name',
80
- message: 'Enter a unique name to reference your account:',
77
+ message: i18n(`${i18nKey}.enterAccountName`),
81
78
  validate(val) {
82
79
  if (typeof val !== 'string') {
83
- return 'You entered an invalid name. Please try again.';
80
+ return i18n(`${i18nKey}.errors.invalidName`);
84
81
  } else if (!val.length) {
85
- return 'The name may not be blank. Please try again.';
82
+ return i18n(`${i18nKey}.errors.nameRequired`);
86
83
  } else if (!STRING_WITH_NO_SPACES_REGEX.test(val)) {
87
- return 'The name may not contain spaces. Please try again.';
84
+ return i18n(`${i18nKey}.errors.spacesInName`);
88
85
  }
89
86
  return true;
90
87
  },
@@ -92,11 +89,10 @@ const ACCOUNT_NAME = {
92
89
 
93
90
  const ACCOUNT_API_KEY = {
94
91
  name: 'apiKey',
95
- message:
96
- 'Enter the API key for your account (found at https://app.hubspot.com/l/api-key):',
92
+ message: i18n(`${i18nKey}.enterApiKey`),
97
93
  validate(val) {
98
94
  if (!API_KEY_REGEX.test(val)) {
99
- return 'You did not enter a valid API key. Please try again.';
95
+ return i18n(`${i18nKey}.errors.invalidAPIKey`);
100
96
  }
101
97
  return true;
102
98
  },
@@ -104,18 +100,17 @@ const ACCOUNT_API_KEY = {
104
100
 
105
101
  const PERSONAL_ACCESS_KEY_BROWSER_OPEN_PREP = {
106
102
  name: 'personalAcessKeyBrowserOpenPrep',
107
- message:
108
- "When you're ready, we'll open a secure page in your default browser where you can view and copy your personal access key, which you'll need to complete the next step.\n<Press enter to open the page and generate your personal access key>",
103
+ message: i18n(`${i18nKey}.personalAccessKeyBrowserOpenPrep`),
109
104
  };
110
105
 
111
106
  const PERSONAL_ACCESS_KEY = {
112
107
  name: 'personalAccessKey',
113
- message: 'Enter your personal access key:',
108
+ message: i18n(`${i18nKey}.enterPersonalAccessKey`),
114
109
  validate(val) {
115
110
  if (typeof val !== 'string') {
116
- return 'You did not enter a valid access key. Please try again.';
111
+ return i18n(`${i18nKey}.errors.invalidPersonalAccessKey`);
117
112
  } else if (val[0] === '•') {
118
- return 'Please copy the actual access key rather than the bullets that mask it.';
113
+ return i18n(`${i18nKey}.errors.invalidPersonalAccessKeyCopy`);
119
114
  }
120
115
  return true;
121
116
  },
@@ -124,8 +119,7 @@ const PERSONAL_ACCESS_KEY = {
124
119
  const SCOPES = {
125
120
  type: 'checkbox',
126
121
  name: 'scopes',
127
- message:
128
- 'Select access scopes (see https://developers.hubspot.com/docs/methods/oauth2/initiate-oauth-integration#scopes)',
122
+ message: i18n(`${i18nKey}.selectScopes`),
129
123
  default: DEFAULT_OAUTH_SCOPES,
130
124
  choices: OAUTH_SCOPES,
131
125
  };
@@ -133,18 +127,7 @@ const SCOPES = {
133
127
  const OAUTH_FLOW = [ACCOUNT_NAME, ACCOUNT_ID, CLIENT_ID, CLIENT_SECRET, SCOPES];
134
128
  const API_KEY_FLOW = [ACCOUNT_NAME, ACCOUNT_ID, ACCOUNT_API_KEY];
135
129
 
136
- const folderOverwritePrompt = folderName => {
137
- return promptUser({
138
- type: 'confirm',
139
- name: 'overwrite',
140
- message: `The folder with name '${folderName}' already exists. Overwrite?`,
141
- default: false,
142
- });
143
- };
144
-
145
130
  module.exports = {
146
- folderOverwritePrompt,
147
- promptUser,
148
131
  personalAccessKeyPrompt,
149
132
  CLIENT_ID,
150
133
  CLIENT_SECRET,
@@ -0,0 +1,10 @@
1
+ const inquirer = require('inquirer');
2
+
3
+ const promptUser = async promptConfig => {
4
+ const prompt = inquirer.createPromptModule();
5
+ return prompt(promptConfig);
6
+ };
7
+
8
+ module.exports = {
9
+ promptUser,
10
+ };
@@ -0,0 +1,24 @@
1
+ const { promptUser } = require('./promptUtils');
2
+ const { i18n } = require('@hubspot/cli-lib/lib/lang');
3
+
4
+ const i18nKey = 'cli.lib.prompts.sandboxesPrompt';
5
+
6
+ const createSandboxPrompt = () => {
7
+ return promptUser([
8
+ {
9
+ name: 'name',
10
+ message: i18n(`${i18nKey}.enterName`),
11
+ validate(val) {
12
+ if (typeof val !== 'string') {
13
+ return i18n(`${i18nKey}.errors.invalidName`);
14
+ }
15
+ return true;
16
+ },
17
+ default: 'New sandbox',
18
+ },
19
+ ]);
20
+ };
21
+
22
+ module.exports = {
23
+ createSandboxPrompt,
24
+ };
@@ -0,0 +1,25 @@
1
+ const { promptUser } = require('./promptUtils');
2
+ const { i18n } = require('@hubspot/cli-lib/lib/lang');
3
+
4
+ const i18nKey = 'cli.lib.prompts.secretPrompt';
5
+
6
+ const SECRET_VALUE_PROMPT = {
7
+ name: 'secretValue',
8
+ type: 'password',
9
+ mask: '*',
10
+ message: i18n(`${i18nKey}.enterValue`),
11
+ validate(val) {
12
+ if (typeof val !== 'string') {
13
+ return i18n(`${i18nKey}.errors.invalidValue`);
14
+ }
15
+ return true;
16
+ },
17
+ };
18
+
19
+ function secretValuePrompt() {
20
+ return promptUser([SECRET_VALUE_PROMPT]);
21
+ }
22
+
23
+ module.exports = {
24
+ secretValuePrompt,
25
+ };
@@ -9,6 +9,7 @@ const {
9
9
  ApiErrorContext,
10
10
  } = require('@hubspot/cli-lib/errorHandlers');
11
11
  const { base64EncodeString } = require('@hubspot/cli-lib/lib/encoding');
12
+ const { EXIT_CODES } = require('../lib/enums/exitCodes');
12
13
 
13
14
  const TAIL_DELAY = 5000;
14
15
 
@@ -33,7 +34,7 @@ const tailLogs = async ({
33
34
 
34
35
  try {
35
36
  const latestLog = await fetchLatest();
36
- initialAfter = base64EncodeString(latestLog.id);
37
+ initialAfter = latestLog && base64EncodeString(latestLog.id);
37
38
  } catch (e) {
38
39
  // A 404 means no latest log exists(never executed)
39
40
  if (e.statusCode !== 404) {
@@ -61,7 +62,7 @@ const tailLogs = async ({
61
62
  })
62
63
  );
63
64
  }
64
- process.exit();
65
+ process.exit(EXIT_CODES.SUCCESS);
65
66
  }
66
67
 
67
68
  if (latestLog && latestLog.results.length) {
@@ -79,7 +80,7 @@ const tailLogs = async ({
79
80
  spinnies.succeed('tailLogs', {
80
81
  text: `Stopped polling because "${exitKey}" was pressed.`,
81
82
  });
82
- process.exit();
83
+ process.exit(EXIT_CODES.SUCCESS);
83
84
  });
84
85
  await tail(initialAfter);
85
86
  };
package/lib/ui.js ADDED
@@ -0,0 +1,48 @@
1
+ const chalk = require('chalk');
2
+ const supportsHyperlinks = require('supports-hyperlinks');
3
+ const { getAccountConfig } = require('@hubspot/cli-lib/lib/config');
4
+ const { logger } = require('@hubspot/cli-lib/logger');
5
+
6
+ /**
7
+ * Outputs horizontal line
8
+ *
9
+ * @returns
10
+ */
11
+ const uiLine = () => {
12
+ logger.log('-'.repeat(50));
13
+ };
14
+
15
+ /**
16
+ * Returns a hyperlink or link and description
17
+ *
18
+ * @param {string} linkText
19
+ * @param {string} url
20
+ * @param {object} options
21
+ * @returns {string}
22
+ */
23
+ const uiLink = (linkText, url, options = {}) => {
24
+ if (supportsHyperlinks.stdout) {
25
+ return ['\u001B]8;;', url, '\u0007', linkText, '\u001B]8;;\u0007'].join('');
26
+ } else {
27
+ return options.fallback ? `${linkText}: ${url}` : linkText;
28
+ }
29
+ };
30
+
31
+ /**
32
+ * Returns formatted account name and ID
33
+ *
34
+ * @param {number} accountId
35
+ * @returns {string}
36
+ */
37
+ const uiAccountDescription = accountId => {
38
+ const account = getAccountConfig(accountId);
39
+ return chalk.bold(
40
+ account.name ? `${account.name} (${account.portalId})` : account.portalId
41
+ );
42
+ };
43
+
44
+ module.exports = {
45
+ uiLine,
46
+ uiLink,
47
+ uiAccountDescription,
48
+ };
package/lib/validation.js CHANGED
@@ -4,10 +4,10 @@ const {
4
4
  loadConfigFromEnvironment,
5
5
  Mode,
6
6
  loadConfig,
7
+ getConfigPath,
7
8
  validateConfig,
8
9
  checkAndWarnGitInclusion,
9
10
  } = require('@hubspot/cli-lib');
10
- const { getConfigPath } = require('@hubspot/cli-lib/lib/config');
11
11
  const {
12
12
  API_KEY_AUTH_METHOD,
13
13
  OAUTH_AUTH_METHOD,
@@ -24,16 +24,17 @@ const { getAccountId, getMode, setLogLevel } = require('./commonOpts');
24
24
  const { logDebugInfo } = require('./debugInfo');
25
25
  const fs = require('fs');
26
26
  const path = require('path');
27
+ const { EXIT_CODES } = require('./enums/exitCodes');
27
28
 
28
29
  async function loadAndValidateOptions(options) {
29
30
  setLogLevel(options);
30
31
  logDebugInfo(options);
31
32
  const { config: configPath } = options;
32
33
  loadConfig(configPath, options);
33
- checkAndWarnGitInclusion();
34
+ checkAndWarnGitInclusion(getConfigPath());
34
35
 
35
36
  if (!(validateConfig() && (await validateAccount(options)))) {
36
- process.exit(1);
37
+ process.exit(EXIT_CODES.ERROR);
37
38
  }
38
39
  }
39
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "3.0.10-beta.6",
3
+ "version": "3.0.10",
4
4
  "description": "CLI for working with HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,21 +8,22 @@
8
8
  "url": "https://github.com/HubSpot/hubspot-cms-tools"
9
9
  },
10
10
  "dependencies": {
11
- "@hubspot/cli-lib": "^3.0.10-beta.5",
12
- "@hubspot/serverless-dev-runtime": "^3.0.10-beta.5",
11
+ "@hubspot/cli-lib": "^3.0.10",
12
+ "@hubspot/serverless-dev-runtime": "^3.0.10",
13
13
  "archiver": "^5.3.0",
14
- "chalk": "^4.1.0",
14
+ "chalk": "^4.1.2",
15
15
  "express": "^4.17.1",
16
16
  "findup-sync": "^4.0.0",
17
17
  "fs-extra": "^8.1.0",
18
- "inquirer": "^6.3.1",
18
+ "inquirer": "^8.2.0",
19
+ "moment": "^2.29.1",
19
20
  "open": "^7.0.3",
20
21
  "ora": "^4.0.3",
21
22
  "shelljs": "0.8.3",
22
23
  "spinnies": "^0.5.1",
23
24
  "supports-hyperlinks": "^2.2.0",
24
25
  "tmp": "^0.2.1",
25
- "update-notifier": "3.0.1",
26
+ "update-notifier": "^5.1.0",
26
27
  "yargs": "15.4.1"
27
28
  },
28
29
  "devDependencies": {
@@ -38,5 +39,5 @@
38
39
  "publishConfig": {
39
40
  "access": "public"
40
41
  },
41
- "gitHead": "d61d0d5785c06c1e835bf474ad73ccb27cf2118e"
42
+ "gitHead": "cad6c92bb51a24a7958c3c77c3e5ffc4e6418580"
42
43
  }
@@ -1,116 +0,0 @@
1
- const ora = require('ora');
2
- const {
3
- getEnv,
4
- loadConfig,
5
- validateConfig,
6
- checkAndWarnGitInclusion,
7
- } = require('@hubspot/cli-lib');
8
- const {
9
- logApiErrorInstance,
10
- ApiErrorContext,
11
- } = require('@hubspot/cli-lib/errorHandlers');
12
- const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
13
- const { logger } = require('@hubspot/cli-lib/logger');
14
- const { deployAppSync } = require('@hubspot/cli-lib/api/appPipeline');
15
-
16
- const {
17
- setLogLevel,
18
- getAccountId,
19
- addUseEnvironmentOptions,
20
- } = require('../../lib/commonOpts');
21
- const { trackCommandUsage } = require('../../lib/usageTracking');
22
- const { logDebugInfo } = require('../../lib/debugInfo');
23
- const { validateAccount } = require('../../lib/validation');
24
- const { outputBuildLog } = require('../../lib/serverlessLogs');
25
-
26
- const loadAndValidateOptions = async options => {
27
- setLogLevel(options);
28
- logDebugInfo(options);
29
- const { config: configPath } = options;
30
- loadConfig(configPath, options);
31
- checkAndWarnGitInclusion();
32
-
33
- if (!(validateConfig() && (await validateAccount(options)))) {
34
- process.exit(1);
35
- }
36
- };
37
-
38
- const logServerlessBuildFailures = async errorDetails => {
39
- const folderPaths = errorDetails.context.folderPath;
40
- const buildLogUrls = errorDetails.context.serverlessBuildLogUrl;
41
- for (let i = 0; i < buildLogUrls.length; i++) {
42
- logger.log(`Building serverless functions in "${folderPaths[i]}":`);
43
- await outputBuildLog(buildLogUrls[i]);
44
- }
45
- logger.error(
46
- 'Your app failed to build and deploy due to a problem building the serverless functions.'
47
- );
48
- };
49
-
50
- exports.command = 'deploy <path>';
51
- exports.describe = false;
52
-
53
- exports.handler = async options => {
54
- loadAndValidateOptions(options);
55
-
56
- const { path: appPath } = options;
57
- const accountId = getAccountId(options);
58
-
59
- trackCommandUsage('app-deploy', {}, accountId);
60
-
61
- let result;
62
-
63
- const spinner = ora(`Building "${appPath}" in account ${accountId}`).start();
64
- try {
65
- result = await deployAppSync(accountId, appPath);
66
- } catch (error) {
67
- spinner.fail();
68
- if (error.response && error.response.body) {
69
- const errorDetails = error.response.body;
70
- if (
71
- errorDetails.subCategory === 'PipelineErrors.SERVERLESS_BUILD_ERROR' &&
72
- errorDetails.context &&
73
- Array.isArray(errorDetails.context.serverlessBuildLogUrl)
74
- ) {
75
- await logServerlessBuildFailures(errorDetails);
76
- } else {
77
- logApiErrorInstance(
78
- error,
79
- new ApiErrorContext({
80
- accountId,
81
- request: appPath,
82
- })
83
- );
84
- }
85
- } else {
86
- logApiErrorInstance(
87
- error,
88
- new ApiErrorContext({
89
- accountId,
90
- request: appPath,
91
- })
92
- );
93
- }
94
- process.exit(1);
95
- }
96
-
97
- spinner.succeed();
98
- logger.success(
99
- `You app has been built and deployed. Go to ${getHubSpotWebsiteOrigin(
100
- getEnv()
101
- )}/private-apps/${accountId}/${result.appId} to see your app.`
102
- );
103
- };
104
-
105
- exports.builder = yargs => {
106
- yargs.positional('path', {
107
- describe: 'Path to app folder',
108
- type: 'string',
109
- });
110
-
111
- yargs.example([['$0 app deploy /example-app', 'Build and deploy app']]);
112
-
113
- addUseEnvironmentOptions(yargs, true);
114
-
115
- return yargs;
116
- };
package/commands/app.js DELETED
@@ -1,14 +0,0 @@
1
- const { addConfigOptions, addAccountOptions } = require('../lib/commonOpts');
2
- const deploy = require('./app/deploy');
3
-
4
- exports.command = 'app';
5
- exports.describe = false;
6
-
7
- exports.builder = yargs => {
8
- addConfigOptions(yargs, true);
9
- addAccountOptions(yargs, true);
10
-
11
- yargs.command(deploy).demandCommand(1, '');
12
-
13
- return yargs;
14
- };
@@ -1,25 +0,0 @@
1
- const path = require('path');
2
- const {
3
- createProjectConfig,
4
- createProjectTemplateFiles,
5
- } = require('@hubspot/cli-lib/projects');
6
- const { logger } = require('@hubspot/cli-lib/logger');
7
- const { createProjectPrompt } = require('../../lib/prompts/projects');
8
-
9
- module.exports = {
10
- hidden: true,
11
- dest: ({ name, dest }) => path.join(dest || './', name),
12
- execute: async ({ dest, name }) => {
13
- const { label, description, template } = await createProjectPrompt({
14
- label: name,
15
- });
16
-
17
- createProjectConfig(dest, {
18
- label,
19
- description,
20
- });
21
- createProjectTemplateFiles(dest, template);
22
-
23
- logger.success(`Project created in ${dest}`);
24
- },
25
- };
@@ -1,40 +0,0 @@
1
- const inquirer = require('inquirer');
2
- const { PROJECT_TEMPLATE_TYPES } = require('@hubspot/cli-lib/lib/constants');
3
-
4
- const createProjectPrompt = (promptOptions = {}) => {
5
- const prompt = inquirer.createPromptModule();
6
- return prompt([
7
- {
8
- type: 'list',
9
- name: 'template',
10
- message: 'Select a project template to use',
11
- default: PROJECT_TEMPLATE_TYPES.blank,
12
- choices: Object.keys(PROJECT_TEMPLATE_TYPES),
13
- },
14
- {
15
- name: 'label',
16
- message: 'Enter a label for the project',
17
- validate(val) {
18
- if (typeof val !== 'string') {
19
- return 'You entered an invalid label. Please try again.';
20
- }
21
- return true;
22
- },
23
- default: promptOptions.label || 'New project',
24
- },
25
- {
26
- name: 'description',
27
- message: 'Enter a description for the project',
28
- validate(val) {
29
- if (typeof val !== 'string') {
30
- return 'You entered an invalid description. Please try again.';
31
- }
32
- return true;
33
- },
34
- },
35
- ]);
36
- };
37
-
38
- module.exports = {
39
- createProjectPrompt,
40
- };
@@ -1,22 +0,0 @@
1
- const inquirer = require('inquirer');
2
-
3
- const createSandbox = () => {
4
- const prompt = inquirer.createPromptModule();
5
- return prompt([
6
- {
7
- name: 'name',
8
- message: 'Enter a name to use for the sandbox: ',
9
- validate(val) {
10
- if (typeof val !== 'string') {
11
- return 'You entered an invalid name. Please try again.';
12
- }
13
- return true;
14
- },
15
- default: 'New sandbox',
16
- },
17
- ]);
18
- };
19
-
20
- module.exports = {
21
- createSandbox,
22
- };
@@ -1,22 +0,0 @@
1
- const inquirer = require('inquirer');
2
-
3
- const SECRET_VALUE_PROMPT = {
4
- name: 'secretValue',
5
- type: 'password',
6
- mask: '*',
7
- message: 'Enter a value for your secret',
8
- validate(val) {
9
- if (typeof val !== 'string') {
10
- return 'You entered an invalid value. Please try again.';
11
- }
12
- return true;
13
- },
14
- };
15
-
16
- function secretValuePrompt() {
17
- const prompt = inquirer.createPromptModule();
18
- return prompt([SECRET_VALUE_PROMPT]);
19
- }
20
- module.exports = {
21
- secretValuePrompt,
22
- };