@hubspot/cli 5.2.1-beta.8 → 5.3.0

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 (43) hide show
  1. package/commands/auth.js +2 -4
  2. package/commands/functions/deploy.js +2 -2
  3. package/commands/init.js +2 -4
  4. package/commands/module/marketplace-validate.js +1 -1
  5. package/commands/project/__tests__/deploy.test.js +432 -0
  6. package/commands/project/cloneApp.js +208 -0
  7. package/commands/project/deploy.js +82 -27
  8. package/commands/project/listBuilds.js +1 -1
  9. package/commands/project/logs.js +1 -1
  10. package/commands/project/migrateApp.js +85 -30
  11. package/commands/project/upload.js +1 -1
  12. package/commands/project.js +15 -12
  13. package/commands/sandbox/create.js +17 -48
  14. package/commands/sandbox/delete.js +5 -2
  15. package/commands/sandbox/sync.js +12 -2
  16. package/commands/sandbox.js +2 -1
  17. package/commands/theme/marketplace-validate.js +1 -1
  18. package/lang/en.lyaml +77 -76
  19. package/lib/LocalDevManager.js +59 -11
  20. package/lib/buildAccount.js +3 -3
  21. package/lib/constants.js +3 -1
  22. package/lib/interpolationHelpers.js +3 -0
  23. package/lib/localDev.js +21 -11
  24. package/lib/marketplace-validate.js +11 -3
  25. package/lib/polling.js +16 -10
  26. package/lib/projects.js +143 -100
  27. package/lib/prompts/accountNamePrompt.js +78 -0
  28. package/lib/prompts/activeInstallConfirmationPrompt.js +20 -0
  29. package/lib/prompts/createProjectPrompt.js +12 -2
  30. package/lib/prompts/deployBuildIdPrompt.js +22 -0
  31. package/lib/prompts/installPublicAppPrompt.js +13 -4
  32. package/lib/prompts/personalAccessKeyPrompt.js +2 -2
  33. package/lib/prompts/sandboxesPrompt.js +12 -41
  34. package/lib/prompts/selectPublicAppPrompt.js +41 -22
  35. package/lib/sandboxSync.js +49 -68
  36. package/lib/sandboxes.js +8 -149
  37. package/lib/serverlessLogs.js +2 -2
  38. package/lib/ui/index.js +74 -0
  39. package/package.json +5 -4
  40. package/lib/prompts/buildIdPrompt.js +0 -35
  41. package/lib/prompts/developerTestAccountNamePrompt.js +0 -29
  42. package/lib/prompts/enterAccountNamePrompt.js +0 -33
  43. package/lib/ui/CliProgressMultibarManager.js +0 -66
package/lib/ui/index.js CHANGED
@@ -139,13 +139,87 @@ const uiBetaTag = (message, log = true) => {
139
139
  }
140
140
  };
141
141
 
142
+ const uiDeprecatedTag = (message, log = true) => {
143
+ const i18nKey = 'lib.ui';
144
+
145
+ const terminalUISupport = getTerminalUISupport();
146
+ const tag = i18n(`${i18nKey}.deprecatedTag`);
147
+
148
+ const result = `${
149
+ terminalUISupport.color ? chalk.yellow(tag) : tag
150
+ } ${message}`;
151
+
152
+ if (log) {
153
+ logger.log(result);
154
+ } else {
155
+ return result;
156
+ }
157
+ };
158
+
159
+ const uiCommandDisabledBanner = (
160
+ command,
161
+ url = undefined,
162
+ message = undefined
163
+ ) => {
164
+ const i18nKey = 'lib.ui';
165
+
166
+ const tag =
167
+ message ||
168
+ i18n(`${i18nKey}.disabledMessage`, {
169
+ command: uiCommandReference(command),
170
+ url: url ? uiLink(i18n(`${i18nKey}.disabledUrlText`), url) : undefined,
171
+ npmCommand: uiCommandReference('npm i -g @hubspot/cli@latest'),
172
+ });
173
+
174
+ logger.log();
175
+ uiLine();
176
+ logger.error(tag);
177
+ uiLine();
178
+ logger.log();
179
+ };
180
+
181
+ const uiDeprecatedDescription = (
182
+ message,
183
+ command,
184
+ url = undefined,
185
+ log = false
186
+ ) => {
187
+ const i18nKey = 'lib.ui';
188
+
189
+ const tag = i18n(`${i18nKey}.deprecatedDescription`, {
190
+ message,
191
+ command: uiCommandReference(command),
192
+ url,
193
+ });
194
+ return uiDeprecatedTag(tag, log);
195
+ };
196
+
197
+ const uiDeprecatedMessage = (command, url = undefined, message = undefined) => {
198
+ const i18nKey = 'lib.ui';
199
+
200
+ const tag =
201
+ message ||
202
+ i18n(`${i18nKey}.deprecatedMessage`, {
203
+ command: uiCommandReference(command),
204
+ url: url ? uiLink(i18n(`${i18nKey}.deprecatedUrlText`), url) : undefined,
205
+ });
206
+
207
+ logger.log();
208
+ uiDeprecatedTag(tag, true);
209
+ logger.log();
210
+ };
211
+
142
212
  module.exports = {
143
213
  UI_COLORS,
144
214
  uiAccountDescription,
145
215
  uiCommandReference,
146
216
  uiBetaTag,
217
+ uiDeprecatedTag,
147
218
  uiFeatureHighlight,
148
219
  uiInfoSection,
149
220
  uiLine,
150
221
  uiLink,
222
+ uiDeprecatedMessage,
223
+ uiDeprecatedDescription,
224
+ uiCommandDisabledBanner,
151
225
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "5.2.1-beta.8",
3
+ "version": "5.3.0",
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/local-dev-lib": "1.4.0",
12
- "@hubspot/serverless-dev-runtime": "5.2.1-beta.7",
11
+ "@hubspot/local-dev-lib": "1.10.0",
12
+ "@hubspot/serverless-dev-runtime": "5.3.0",
13
13
  "@hubspot/theme-preview-dev-server": "0.0.7",
14
14
  "@hubspot/ui-extensions-dev-server": "0.8.20",
15
15
  "archiver": "^5.3.0",
@@ -33,6 +33,7 @@
33
33
  "yargs": "15.4.1"
34
34
  },
35
35
  "devDependencies": {
36
+ "axios": "^1.7.2",
36
37
  "mock-stdin": "^1.0.0"
37
38
  },
38
39
  "engines": {
@@ -45,5 +46,5 @@
45
46
  "publishConfig": {
46
47
  "access": "public"
47
48
  },
48
- "gitHead": "d36fbe19c7daae6e47b6cb421f4c90ea935d9c9e"
49
+ "gitHead": "f55582baa2ac86396c72861b31998e54580c8c6a"
49
50
  }
@@ -1,35 +0,0 @@
1
- const { promptUser } = require('./promptUtils');
2
- const { i18n } = require('../lang');
3
-
4
- const i18nKey = 'lib.prompts.buildIdPrompt';
5
-
6
- const buildIdPrompt = (latestBuildId, deployedBuildId, projectName) => {
7
- return promptUser({
8
- name: 'buildId',
9
- message: i18n(`${i18nKey}.enterBuildId`),
10
- default: () => {
11
- if (latestBuildId === deployedBuildId) {
12
- return;
13
- }
14
- return latestBuildId;
15
- },
16
- validate: val => {
17
- if (Number(val) > latestBuildId) {
18
- return i18n(`${i18nKey}.errors.buildIdDoesNotExist`, {
19
- buildId: val,
20
- projectName,
21
- });
22
- }
23
- if (Number(val) === deployedBuildId) {
24
- return i18n(`${i18nKey}.errors.buildAlreadyDeployed`, {
25
- buildId: val,
26
- });
27
- }
28
- return true;
29
- },
30
- });
31
- };
32
-
33
- module.exports = {
34
- buildIdPrompt,
35
- };
@@ -1,29 +0,0 @@
1
- const { promptUser } = require('./promptUtils');
2
- const { i18n } = require('../lang');
3
- const { accountNameExistsInConfig } = require('@hubspot/local-dev-lib/config');
4
-
5
- const i18nKey = 'lib.prompts.developerTestAccountPrompt';
6
-
7
- const developerTestAccountNamePrompt = currentPortalCount => {
8
- return promptUser([
9
- {
10
- name: 'name',
11
- message: i18n(`${i18nKey}.name.message`),
12
- validate(val) {
13
- if (typeof val !== 'string') {
14
- return i18n(`${i18nKey}.name.errors.invalidName`);
15
- } else if (!val.length) {
16
- return i18n(`${i18nKey}.name.errors.nameRequired`);
17
- }
18
- return accountNameExistsInConfig(val)
19
- ? i18n(`${i18nKey}.name.errors.accountNameExists`, { name: val })
20
- : true;
21
- },
22
- default: `Developer test account ${currentPortalCount + 1}`,
23
- },
24
- ]);
25
- };
26
-
27
- module.exports = {
28
- developerTestAccountNamePrompt,
29
- };
@@ -1,33 +0,0 @@
1
- const { accountNameExistsInConfig } = require('@hubspot/local-dev-lib/config');
2
- const { STRING_WITH_NO_SPACES_REGEX } = require('../regex');
3
- const { promptUser } = require('./promptUtils');
4
- const { i18n } = require('../lang');
5
-
6
- const i18nKey = 'lib.prompts.enterAccountNamePrompt';
7
-
8
- const accountNamePrompt = defaultName => ({
9
- name: 'name',
10
- message: i18n(`${i18nKey}.enterAccountName`),
11
- default: defaultName,
12
- validate(val) {
13
- if (typeof val !== 'string') {
14
- return i18n(`${i18nKey}.errors.invalidName`);
15
- } else if (!val.length) {
16
- return i18n(`${i18nKey}.errors.nameRequired`);
17
- } else if (!STRING_WITH_NO_SPACES_REGEX.test(val)) {
18
- return i18n(`${i18nKey}.errors.spacesInName`);
19
- }
20
- return accountNameExistsInConfig(val)
21
- ? i18n(`${i18nKey}.errors.accountNameExists`, { name: val })
22
- : true;
23
- },
24
- });
25
-
26
- const enterAccountNamePrompt = defaultName => {
27
- return promptUser(accountNamePrompt(defaultName));
28
- };
29
-
30
- module.exports = {
31
- accountNamePrompt,
32
- enterAccountNamePrompt,
33
- };
@@ -1,66 +0,0 @@
1
- // https://github.com/npkgz/cli-progress/blob/master/README.md
2
- const ProgressMultibarManager = require('cli-progress');
3
-
4
- class CliProgressMultibarManager {
5
- constructor() {
6
- this.multibar = null;
7
- this.barInstances = {};
8
- }
9
-
10
- init(options) {
11
- if (!this.multibar) {
12
- this.multibar = new ProgressMultibarManager.MultiBar(
13
- {
14
- hideCursor: true,
15
- format: '[{bar}] {percentage}% | {label}',
16
- gracefulExit: true,
17
- ...options,
18
- },
19
- ProgressMultibarManager.Presets.rect
20
- );
21
- }
22
-
23
- return {
24
- get: this.get.bind(this),
25
- create: this.create.bind(this),
26
- update: this.update.bind(this),
27
- increment: this.increment.bind(this),
28
- remove: this.multibar.remove.bind(this.multibar),
29
- stop: this.multibar.stop.bind(this.multibar),
30
- log: this.multibar.log.bind(this.multibar),
31
- };
32
- }
33
-
34
- get(barName) {
35
- return this.barInstances[barName];
36
- }
37
-
38
- create(barName, total = 100, startValue = 0, options = {}) {
39
- if (!this.multibar) {
40
- return;
41
- }
42
- if (!this.barInstances[barName]) {
43
- this.barInstances[barName] = this.multibar.create(
44
- total,
45
- startValue,
46
- options
47
- );
48
- }
49
- }
50
-
51
- update(barName, value, options = {}) {
52
- const barInstance = this.barInstances[barName];
53
- if (barInstance) {
54
- barInstance.update(value, options);
55
- }
56
- }
57
-
58
- increment(barName, value, options = {}) {
59
- const barInstance = this.barInstances[barName];
60
- if (barInstance) {
61
- barInstance.increment(value, options);
62
- }
63
- }
64
- }
65
-
66
- module.exports = new CliProgressMultibarManager();