@hubspot/cli 6.4.0-beta.1 → 7.0.0-experimental.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.
- package/bin/cli.js +36 -15
- package/commands/{accounts → account}/clean.js +10 -9
- package/commands/{accounts → account}/info.js +10 -14
- package/commands/{accounts → account}/list.js +16 -13
- package/commands/{accounts → account}/remove.js +8 -8
- package/commands/{accounts → account}/rename.js +4 -5
- package/commands/{accounts → account}/use.js +5 -8
- package/commands/account.js +26 -0
- package/commands/auth.js +30 -23
- package/commands/cms/getReactModule.js +70 -0
- package/commands/cms/lighthouseScore.js +19 -19
- package/commands/cms.js +4 -3
- package/commands/completion.js +22 -0
- package/commands/config/set.js +22 -22
- package/commands/config.js +2 -2
- package/commands/create.js +5 -3
- package/commands/customObject/create.js +18 -13
- package/commands/customObject/schema/create.js +14 -14
- package/commands/customObject/schema/delete.js +29 -9
- package/commands/customObject/schema/fetch-all.js +14 -9
- package/commands/customObject/schema/fetch.js +22 -12
- package/commands/customObject/schema/list.js +3 -4
- package/commands/customObject/schema/update.js +27 -16
- package/commands/customObject/schema.js +1 -1
- package/commands/customObject.js +3 -4
- package/commands/doctor.js +2 -0
- package/commands/feedback.js +2 -0
- package/commands/fetch.js +13 -12
- package/commands/filemanager/fetch.js +6 -5
- package/commands/filemanager/upload.js +10 -10
- package/commands/filemanager.js +0 -4
- package/commands/{functions → function}/deploy.js +13 -11
- package/commands/{functions → function}/list.js +7 -7
- package/commands/{functions → function}/server.js +5 -6
- package/commands/function.js +20 -0
- package/commands/hubdb/clear.js +14 -8
- package/commands/hubdb/create.js +36 -11
- package/commands/hubdb/delete.js +31 -8
- package/commands/hubdb/fetch.js +14 -7
- package/commands/hubdb.js +2 -3
- package/commands/init.js +37 -14
- package/commands/lint.js +6 -5
- package/commands/list.js +5 -5
- package/commands/logs.js +24 -13
- package/commands/module/marketplace-validate.js +6 -7
- package/commands/module.js +2 -1
- package/commands/mv.js +11 -11
- package/commands/open.js +11 -10
- package/commands/project/add.js +2 -3
- package/commands/project/cloneApp.js +28 -30
- package/commands/project/create.js +8 -8
- package/commands/project/deploy.js +16 -13
- package/commands/project/dev.js +14 -14
- package/commands/project/download.js +18 -13
- package/commands/project/listBuilds.js +34 -29
- package/commands/project/logs.js +5 -5
- package/commands/project/migrateApp.js +27 -25
- package/commands/project/open.js +7 -8
- package/commands/project/upload.js +27 -29
- package/commands/project/watch.js +12 -19
- package/commands/project.js +3 -4
- package/commands/remove.js +14 -11
- package/commands/sandbox/create.js +12 -13
- package/commands/sandbox/delete.js +15 -13
- package/commands/sandbox.js +3 -4
- package/commands/{secrets → secret}/addSecret.js +24 -9
- package/commands/secret/deleteSecret.js +71 -0
- package/commands/{secrets → secret}/listSecrets.js +6 -6
- package/commands/secret/updateSecret.d.ts +1 -0
- package/commands/{secrets → secret}/updateSecret.js +20 -10
- package/commands/secret.js +22 -0
- package/commands/theme/generate-selectors.js +8 -8
- package/commands/theme/marketplace-validate.js +10 -11
- package/commands/theme/preview.js +6 -7
- package/commands/theme.js +3 -1
- package/commands/upload.js +28 -24
- package/commands/watch.js +19 -19
- package/lang/en.lyaml +177 -111
- package/lib/buildAccount.js +3 -1
- package/lib/commonOpts.d.ts +15 -6
- package/lib/commonOpts.js +53 -38
- package/lib/configOptions.js +19 -18
- package/lib/developerTestAccounts.js +8 -5
- package/lib/oauth.js +3 -1
- package/lib/projects.js +10 -5
- package/lib/prompts/accountsPrompt.js +9 -5
- package/lib/prompts/createModulePrompt.js +17 -2
- package/lib/prompts/createProjectPrompt.js +5 -5
- package/lib/prompts/projectDevTargetAccountPrompt.js +3 -2
- package/lib/prompts/promptUtils.d.ts +3 -0
- package/lib/prompts/promptUtils.js +14 -2
- package/lib/prompts/sandboxesPrompt.js +10 -7
- package/lib/prompts/secretPrompt.d.ts +3 -1
- package/lib/prompts/secretPrompt.js +32 -19
- package/lib/prompts/selectHubDBTablePrompt.d.ts +8 -0
- package/lib/prompts/selectHubDBTablePrompt.js +69 -0
- package/lib/prompts/setAsDefaultAccountPrompt.js +4 -2
- package/lib/sandboxSync.js +5 -2
- package/lib/sandboxes.js +12 -7
- package/lib/validation.js +14 -13
- package/package.json +5 -4
- package/commands/accounts.js +0 -30
- package/commands/cms/reactModules.js +0 -60
- package/commands/functions.js +0 -24
- package/commands/secrets/deleteSecret.js +0 -46
- package/commands/secrets.js +0 -23
- /package/commands/{accounts → account}/clean.d.ts +0 -0
- /package/commands/{accounts → account}/info.d.ts +0 -0
- /package/commands/{accounts → account}/list.d.ts +0 -0
- /package/commands/{accounts → account}/remove.d.ts +0 -0
- /package/commands/{accounts → account}/rename.d.ts +0 -0
- /package/commands/{accounts → account}/use.d.ts +0 -0
- /package/commands/{accounts.d.ts → account.d.ts} +0 -0
- /package/commands/cms/{reactModules.d.ts → getReactModule.d.ts} +0 -0
- /package/commands/{functions.d.ts → completion.d.ts} +0 -0
- /package/commands/{functions/list.d.ts → function/deploy.d.ts} +0 -0
- /package/commands/{functions/server.d.ts → function/list.d.ts} +0 -0
- /package/commands/{secrets.d.ts → function/server.d.ts} +0 -0
- /package/commands/{functions/deploy.d.ts → function.d.ts} +0 -0
- /package/commands/{secrets/deleteSecret.d.ts → secret/addSecret.d.ts} +0 -0
- /package/commands/{secrets/listSecrets.d.ts → secret/deleteSecret.d.ts} +0 -0
- /package/commands/{secrets/updateSecret.d.ts → secret/listSecrets.d.ts} +0 -0
- /package/commands/{secrets/addSecret.d.ts → secret.d.ts} +0 -0
package/commands/watch.js
CHANGED
|
@@ -6,25 +6,24 @@ const path = require('path');
|
|
|
6
6
|
const { watch } = require('@hubspot/local-dev-lib/cms/watch');
|
|
7
7
|
const { getCwd } = require('@hubspot/local-dev-lib/path');
|
|
8
8
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
9
|
-
const { addConfigOptions, addAccountOptions,
|
|
9
|
+
const { addConfigOptions, addAccountOptions, addCmsPublishModeOptions, addUseEnvironmentOptions, addGlobalOptions, getCmsPublishMode, } = require('../lib/commonOpts');
|
|
10
10
|
const { uploadPrompt } = require('../lib/prompts/uploadPrompt');
|
|
11
|
-
const {
|
|
11
|
+
const { validateCmsPublishMode, loadAndValidateOptions, } = require('../lib/validation');
|
|
12
12
|
const { trackCommandUsage } = require('../lib/usageTracking');
|
|
13
13
|
const { i18n } = require('../lib/lang');
|
|
14
14
|
const { getUploadableFileList } = require('../lib/upload');
|
|
15
15
|
const { logError, ApiErrorContext } = require('../lib/errorHandlers/index');
|
|
16
16
|
const i18nKey = 'commands.watch';
|
|
17
17
|
const { EXIT_CODES } = require('../lib/enums/exitCodes');
|
|
18
|
-
exports.command = 'watch [
|
|
18
|
+
exports.command = 'watch [src] [dest]';
|
|
19
19
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
20
20
|
exports.handler = async (options) => {
|
|
21
|
-
const { remove, initialUpload, disableInitial, notify } = options;
|
|
21
|
+
const { remove, initialUpload, disableInitial, notify, derivedAccountId, } = options;
|
|
22
22
|
await loadAndValidateOptions(options);
|
|
23
|
-
if (!
|
|
23
|
+
if (!validateCmsPublishMode(options)) {
|
|
24
24
|
process.exit(EXIT_CODES.ERROR);
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
const mode = getMode(options);
|
|
26
|
+
const cmsPublishMode = getCmsPublishMode(options);
|
|
28
27
|
const uploadPromptAnswers = await uploadPrompt(options);
|
|
29
28
|
const src = options.src || uploadPromptAnswers.src;
|
|
30
29
|
const dest = options.dest || uploadPromptAnswers.dest;
|
|
@@ -59,33 +58,33 @@ exports.handler = async (options) => {
|
|
|
59
58
|
if (initialUpload) {
|
|
60
59
|
filesToUpload = await getUploadableFileList(absoluteSrcPath, options.convertFields);
|
|
61
60
|
}
|
|
62
|
-
trackCommandUsage('watch', { mode },
|
|
61
|
+
trackCommandUsage('watch', { mode: cmsPublishMode }, derivedAccountId);
|
|
63
62
|
const postInitialUploadCallback = null;
|
|
64
63
|
const onUploadFolderError = error => {
|
|
65
64
|
logger.error(i18n(`${i18nKey}.errors.folderFailed`, {
|
|
66
65
|
src,
|
|
67
66
|
dest,
|
|
68
|
-
accountId,
|
|
67
|
+
accountId: derivedAccountId,
|
|
69
68
|
}));
|
|
70
69
|
logError(error, {
|
|
71
|
-
accountId,
|
|
70
|
+
accountId: derivedAccountId,
|
|
72
71
|
});
|
|
73
72
|
};
|
|
74
73
|
const onQueueAddError = null;
|
|
75
|
-
const onUploadFileError = (file, dest,
|
|
74
|
+
const onUploadFileError = (file, dest, derivedAccountId) => error => {
|
|
76
75
|
logger.error(i18n(`${i18nKey}.errors.fileFailed`, {
|
|
77
76
|
file,
|
|
78
77
|
dest,
|
|
79
|
-
accountId,
|
|
78
|
+
accountId: derivedAccountId,
|
|
80
79
|
}));
|
|
81
80
|
logError(error, new ApiErrorContext({
|
|
82
|
-
accountId,
|
|
81
|
+
accountId: derivedAccountId,
|
|
83
82
|
request: dest,
|
|
84
83
|
payload: file,
|
|
85
84
|
}));
|
|
86
85
|
};
|
|
87
|
-
watch(
|
|
88
|
-
|
|
86
|
+
watch(derivedAccountId, absoluteSrcPath, dest, {
|
|
87
|
+
cmsPublishMode,
|
|
89
88
|
remove,
|
|
90
89
|
disableInitial: initialUpload ? false : true,
|
|
91
90
|
notify,
|
|
@@ -94,10 +93,6 @@ exports.handler = async (options) => {
|
|
|
94
93
|
}, postInitialUploadCallback, onUploadFolderError, onQueueAddError, onUploadFileError);
|
|
95
94
|
};
|
|
96
95
|
exports.builder = yargs => {
|
|
97
|
-
addConfigOptions(yargs);
|
|
98
|
-
addAccountOptions(yargs);
|
|
99
|
-
addModeOptions(yargs, { write: true });
|
|
100
|
-
addUseEnvironmentOptions(yargs);
|
|
101
96
|
yargs.positional('src', {
|
|
102
97
|
describe: i18n(`${i18nKey}.positionals.src.describe`),
|
|
103
98
|
type: 'string',
|
|
@@ -143,5 +138,10 @@ exports.builder = yargs => {
|
|
|
143
138
|
type: 'boolean',
|
|
144
139
|
default: false,
|
|
145
140
|
});
|
|
141
|
+
addConfigOptions(yargs);
|
|
142
|
+
addAccountOptions(yargs);
|
|
143
|
+
addCmsPublishModeOptions(yargs, { write: true });
|
|
144
|
+
addUseEnvironmentOptions(yargs);
|
|
145
|
+
addGlobalOptions(yargs);
|
|
146
146
|
return yargs;
|
|
147
147
|
};
|