@hubspot/cli 3.0.13-beta.3 → 3.0.13-beta.4

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.
@@ -26,6 +26,7 @@ const {
26
26
  getAccountId,
27
27
  getMode,
28
28
  } = require('../lib/commonOpts');
29
+ const { uploadPrompt } = require('../lib/prompts/uploadPrompt');
29
30
  const { validateMode, loadAndValidateOptions } = require('../lib/validation');
30
31
  const { trackCommandUsage } = require('../lib/usageTracking');
31
32
  const { getThemePreviewUrl } = require('@hubspot/cli-lib/lib/files');
@@ -34,7 +35,7 @@ const { i18n } = require('@hubspot/cli-lib/lib/lang');
34
35
  const i18nKey = 'cli.commands.upload';
35
36
  const { EXIT_CODES } = require('../lib/enums/exitCodes');
36
37
 
37
- exports.command = 'upload <src> <dest>';
38
+ exports.command = 'upload [--src] [--dest]';
38
39
  exports.describe = i18n(`${i18nKey}.describe`);
39
40
 
40
41
  const logThemePreview = (filePath, accountId) => {
@@ -50,8 +51,6 @@ const logThemePreview = (filePath, accountId) => {
50
51
  };
51
52
 
52
53
  exports.handler = async options => {
53
- const { src, dest } = options;
54
-
55
54
  await loadAndValidateOptions(options);
56
55
 
57
56
  if (!validateMode(options)) {
@@ -60,6 +59,12 @@ exports.handler = async options => {
60
59
 
61
60
  const accountId = getAccountId(options);
62
61
  const mode = getMode(options);
62
+
63
+ const uploadPromptAnswers = await uploadPrompt(options);
64
+
65
+ const src = options.src || uploadPromptAnswers.src;
66
+ const dest = options.dest || uploadPromptAnswers.dest;
67
+
63
68
  const absoluteSrcPath = path.resolve(getCwd(), src);
64
69
  let stats;
65
70
  try {
package/commands/watch.js CHANGED
@@ -13,6 +13,7 @@ const {
13
13
  getAccountId,
14
14
  getMode,
15
15
  } = require('../lib/commonOpts');
16
+ const { uploadPrompt } = require('../lib/prompts/uploadPrompt');
16
17
  const { validateMode, loadAndValidateOptions } = require('../lib/validation');
17
18
  const { trackCommandUsage } = require('../lib/usageTracking');
18
19
  const { i18n } = require('@hubspot/cli-lib/lib/lang');
@@ -20,11 +21,11 @@ const { i18n } = require('@hubspot/cli-lib/lib/lang');
20
21
  const i18nKey = 'cli.commands.watch';
21
22
  const { EXIT_CODES } = require('../lib/enums/exitCodes');
22
23
 
23
- exports.command = 'watch <src> <dest>';
24
+ exports.command = 'watch [--src] [--dest]';
24
25
  exports.describe = i18n(`${i18nKey}.describe`);
25
26
 
26
27
  exports.handler = async options => {
27
- const { src, dest, remove, initialUpload, disableInitial, notify } = options;
28
+ const { remove, initialUpload, disableInitial, notify } = options;
28
29
 
29
30
  await loadAndValidateOptions(options);
30
31
 
@@ -35,6 +36,11 @@ exports.handler = async options => {
35
36
  const accountId = getAccountId(options);
36
37
  const mode = getMode(options);
37
38
 
39
+ const uploadPromptAnswers = await uploadPrompt(options);
40
+
41
+ const src = options.src || uploadPromptAnswers.src;
42
+ const dest = options.dest || uploadPromptAnswers.dest;
43
+
38
44
  const absoluteSrcPath = path.resolve(getCwd(), src);
39
45
  try {
40
46
  const stats = fs.statSync(absoluteSrcPath);
@@ -0,0 +1,39 @@
1
+ const path = require('path');
2
+ const { getCwd } = require('@hubspot/cli-lib/path');
3
+ const { promptUser } = require('./promptUtils');
4
+ const { i18n } = require('@hubspot/cli-lib/lib/lang');
5
+
6
+ const i18nKey = 'cli.lib.prompts.uploadPrompt';
7
+
8
+ const uploadPrompt = (promptOptions = {}) => {
9
+ return promptUser([
10
+ {
11
+ name: 'src',
12
+ message: i18n(`${i18nKey}.enterSrc`),
13
+ when: !promptOptions.src,
14
+ default: '.',
15
+ validate: input => {
16
+ if (!input) {
17
+ return i18n(`${i18nKey}.errors.srcRequired`);
18
+ }
19
+ return true;
20
+ },
21
+ },
22
+ {
23
+ name: 'dest',
24
+ message: i18n(`${i18nKey}.enterDest`),
25
+ when: !promptOptions.dest,
26
+ default: path.basename(getCwd()),
27
+ validate: input => {
28
+ if (!input) {
29
+ return i18n(`${i18nKey}.errors.destRequired`);
30
+ }
31
+ return true;
32
+ },
33
+ },
34
+ ]);
35
+ };
36
+
37
+ module.exports = {
38
+ uploadPrompt,
39
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "3.0.13-beta.3",
3
+ "version": "3.0.13-beta.4",
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": "3.0.13-beta.3",
12
- "@hubspot/serverless-dev-runtime": "3.0.13-beta.3",
11
+ "@hubspot/cli-lib": "3.0.13-beta.4",
12
+ "@hubspot/serverless-dev-runtime": "3.0.13-beta.4",
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": "34e55c31dee127f375faaddbbe0f71940c01c860"
40
+ "gitHead": "470770a002f503df0538286c22e990639033e572"
41
41
  }