@hubspot/cli 7.0.0-experimental.0 → 7.0.0-experimental.2
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 +73 -12
- package/bin/hs +2 -0
- package/bin/hscms +2 -0
- package/bin/silenceErrors.d.ts +2 -0
- package/bin/silenceErrors.js +12 -0
- package/commands/account/clean.js +0 -2
- package/commands/account/info.js +0 -2
- package/commands/account/list.js +2 -5
- package/commands/account/remove.js +4 -7
- package/commands/account/rename.js +0 -2
- package/commands/account/use.js +3 -6
- package/commands/auth.js +2 -3
- package/commands/cms/lighthouseScore.js +0 -2
- package/commands/config/set.js +0 -2
- package/commands/create.js +2 -1
- package/commands/customObject/create.js +1 -2
- package/commands/customObject/schema/create.js +1 -2
- package/commands/customObject/schema/delete.js +0 -2
- package/commands/customObject/schema/fetch-all.js +0 -2
- package/commands/customObject/schema/fetch.js +0 -2
- package/commands/customObject/schema/list.js +0 -2
- package/commands/customObject/schema/update.js +1 -2
- package/commands/doctor.js +2 -2
- package/commands/fetch.js +2 -3
- package/commands/filemanager/fetch.js +0 -2
- package/commands/filemanager/upload.js +0 -2
- package/commands/filemanager.js +1 -4
- package/commands/function/deploy.js +0 -2
- package/commands/function/list.js +0 -2
- package/commands/function/server.js +0 -2
- package/commands/function.js +1 -5
- package/commands/hubdb/clear.js +0 -2
- package/commands/hubdb/create.js +1 -2
- package/commands/hubdb/delete.js +0 -2
- package/commands/hubdb/fetch.js +0 -2
- package/commands/lint.js +0 -2
- package/commands/list.js +0 -2
- package/commands/logs.js +0 -2
- package/commands/module/marketplace-validate.js +0 -2
- package/commands/mv.js +0 -2
- package/commands/project/add.js +0 -2
- package/commands/project/cloneApp.js +0 -2
- package/commands/project/create.js +0 -2
- package/commands/project/deploy.js +3 -3
- package/commands/project/dev.js +7 -8
- package/commands/project/download.js +0 -2
- package/commands/project/listBuilds.js +2 -3
- package/commands/project/logs.js +1 -3
- package/commands/project/migrateApp.js +0 -2
- package/commands/project/open.js +2 -3
- package/commands/project/upload.js +3 -3
- package/commands/project/watch.js +5 -5
- package/commands/remove.js +0 -2
- package/commands/sandbox/create.js +0 -2
- package/commands/sandbox/delete.js +6 -9
- package/commands/sandbox.js +1 -4
- package/commands/secret/addSecret.js +1 -3
- package/commands/secret/deleteSecret.js +1 -3
- package/commands/secret/listSecrets.js +1 -3
- package/commands/secret/updateSecret.js +1 -3
- package/commands/theme/marketplace-validate.js +0 -2
- package/commands/theme/preview.js +1 -3
- package/commands/upload.js +6 -4
- package/commands/watch.js +2 -3
- package/lang/en.lyaml +25 -17
- package/lib/DevServerManager.js +1 -1
- package/lib/LocalDevManager.js +4 -4
- package/lib/buildAccount.js +2 -10
- package/lib/commonOpts.js +0 -1
- package/lib/configOptions.d.ts +13 -1
- package/lib/configOptions.js +46 -50
- package/lib/constants.d.ts +1 -4
- package/lib/dependencyManagement.d.ts +4 -1
- package/lib/dependencyManagement.js +2 -2
- package/lib/developerTestAccounts.d.ts +5 -1
- package/lib/developerTestAccounts.js +44 -41
- package/lib/doctor/DiagnosticInfoBuilder.js +8 -4
- package/lib/doctor/Doctor.js +11 -6
- package/lib/generateSelectors.d.ts +19 -0
- package/lib/generateSelectors.js +23 -23
- package/lib/localDev.js +3 -2
- package/lib/marketplaceValidate.d.ts +6 -1
- package/lib/marketplaceValidate.js +76 -77
- package/lib/oauth.d.ts +2 -1
- package/lib/oauth.js +49 -39
- package/lib/polling.d.ts +8 -0
- package/lib/polling.js +9 -12
- package/lib/projects/ProjectLogsManager.d.ts +20 -0
- package/lib/projects/ProjectLogsManager.js +105 -0
- package/lib/projects/buildAndDeploy.d.ts +16 -0
- package/lib/projects/buildAndDeploy.js +342 -0
- package/lib/projects/index.d.ts +24 -0
- package/lib/projects/index.js +256 -0
- package/lib/projects/structure.d.ts +78 -0
- package/lib/projects/structure.js +151 -0
- package/lib/projects/upload.d.ts +8 -0
- package/lib/projects/upload.js +107 -0
- package/lib/projects/urls.d.ts +4 -0
- package/lib/projects/urls.js +27 -0
- package/lib/{projectsWatch.js → projects/watch.js} +3 -3
- package/lib/prompts/accountNamePrompt.d.ts +11 -0
- package/lib/prompts/accountNamePrompt.js +45 -46
- package/lib/prompts/accountsPrompt.d.ts +1 -1
- package/lib/prompts/accountsPrompt.js +19 -21
- package/lib/prompts/cmsFieldPrompt.d.ts +1 -1
- package/lib/prompts/cmsFieldPrompt.js +23 -24
- package/lib/prompts/createApiSamplePrompt.d.ts +17 -0
- package/lib/prompts/createApiSamplePrompt.js +47 -44
- package/lib/prompts/createFunctionPrompt.d.ts +7 -0
- package/lib/prompts/createFunctionPrompt.js +17 -20
- package/lib/prompts/createModulePrompt.d.ts +8 -0
- package/lib/prompts/createModulePrompt.js +13 -16
- package/lib/prompts/createProjectPrompt.d.ts +13 -0
- package/lib/prompts/createProjectPrompt.js +46 -47
- package/lib/prompts/createTemplatePrompt.d.ts +8 -0
- package/lib/prompts/createTemplatePrompt.js +15 -17
- package/lib/prompts/downloadProjectPrompt.d.ts +8 -0
- package/lib/prompts/downloadProjectPrompt.js +25 -23
- package/lib/prompts/installPublicAppPrompt.d.ts +1 -1
- package/lib/prompts/installPublicAppPrompt.js +21 -19
- package/lib/prompts/personalAccessKeyPrompt.d.ts +28 -0
- package/lib/prompts/personalAccessKeyPrompt.js +46 -52
- package/lib/prompts/previewPrompt.d.ts +14 -0
- package/lib/prompts/previewPrompt.js +24 -24
- package/lib/prompts/projectAddPrompt.d.ts +9 -0
- package/lib/prompts/projectAddPrompt.js +11 -14
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +87 -70
- package/lib/prompts/projectsLogsPrompt.d.ts +11 -0
- package/lib/prompts/projectsLogsPrompt.js +8 -11
- package/lib/prompts/promptUtils.d.ts +5 -7
- package/lib/prompts/promptUtils.js +8 -7
- package/lib/prompts/sandboxesPrompt.d.ts +8 -0
- package/lib/prompts/sandboxesPrompt.js +41 -46
- package/lib/prompts/secretPrompt.d.ts +13 -3
- package/lib/prompts/selectHubDBTablePrompt.d.ts +5 -1
- package/lib/prompts/selectPublicAppPrompt.d.ts +8 -0
- package/lib/prompts/selectPublicAppPrompt.js +28 -27
- package/lib/prompts/setAsDefaultAccountPrompt.d.ts +1 -1
- package/lib/prompts/setAsDefaultAccountPrompt.js +10 -14
- package/lib/prompts/uploadPrompt.d.ts +8 -0
- package/lib/prompts/uploadPrompt.js +18 -18
- package/lib/ui/index.d.ts +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/usageTracking.d.ts +21 -2
- package/lib/usageTracking.js +53 -81
- package/lib/validation.d.ts +11 -1
- package/lib/validation.js +92 -86
- package/package.json +11 -6
- package/types/Projects.d.ts +43 -0
- package/types/Projects.js +2 -0
- package/types/Prompts.d.ts +25 -0
- package/types/Prompts.js +2 -0
- package/lib/ProjectLogsManager.js +0 -91
- package/lib/projectStructure.d.ts +0 -1
- package/lib/projectStructure.js +0 -116
- package/lib/projects.d.ts +0 -4
- package/lib/projects.js +0 -686
- package/lib/projectsWatch.d.ts +0 -1
- package/lib/prompts/cleanUploadPrompt.d.ts +0 -1
- package/lib/prompts/cleanUploadPrompt.js +0 -20
- /package/lib/{ProjectLogsManager.d.ts → projects/watch.d.ts} +0 -0
package/bin/cli.js
CHANGED
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
const yargs = require('yargs');
|
|
4
4
|
const updateNotifier = require('update-notifier');
|
|
5
5
|
const chalk = require('chalk');
|
|
6
|
-
const fs = require('fs');
|
|
7
6
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
8
7
|
const { addUserAgentHeader } = require('@hubspot/local-dev-lib/http');
|
|
9
|
-
const { loadConfig, configFileExists, getConfigPath, } = require('@hubspot/local-dev-lib/config');
|
|
8
|
+
const { loadConfig, configFileExists, getConfigPath, validateConfig, } = require('@hubspot/local-dev-lib/config');
|
|
10
9
|
const { logError } = require('../lib/errorHandlers/index');
|
|
11
10
|
const { setLogLevel, getCommandName, injectAccountIdMiddleware, } = require('../lib/commonOpts');
|
|
11
|
+
const { validateAccount } = require('../lib/validation');
|
|
12
12
|
const { trackHelpUsage, trackConvertFieldsUsage, } = require('../lib/usageTracking');
|
|
13
13
|
const { getIsInProject } = require('../lib/projects');
|
|
14
14
|
const pkg = require('../package.json');
|
|
15
15
|
const { i18n } = require('../lib/lang');
|
|
16
16
|
const { EXIT_CODES } = require('../lib/enums/exitCodes');
|
|
17
17
|
const { UI_COLORS, uiCommandReference } = require('../lib/ui');
|
|
18
|
+
const { checkAndWarnGitInclusion } = require('../lib/ui/git');
|
|
18
19
|
const removeCommand = require('../commands/remove');
|
|
19
20
|
const initCommand = require('../commands/init');
|
|
20
21
|
const logsCommand = require('../commands/logs');
|
|
@@ -119,21 +120,79 @@ const performChecks = argv => {
|
|
|
119
120
|
const setRequestHeaders = () => {
|
|
120
121
|
addUserAgentHeader('HubSpot CLI', pkg.version);
|
|
121
122
|
};
|
|
123
|
+
const isTargetedCommand = (options, commandMap) => {
|
|
124
|
+
const checkCommand = (options, commandMap) => {
|
|
125
|
+
const currentCommand = options._[0];
|
|
126
|
+
if (!commandMap[currentCommand]) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
if (commandMap[currentCommand].target) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
const subCommands = commandMap[currentCommand].subCommands || {};
|
|
133
|
+
if (options._.length > 1) {
|
|
134
|
+
return checkCommand({ _: options._.slice(1) }, subCommands);
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
137
|
+
};
|
|
138
|
+
return checkCommand(options, commandMap);
|
|
139
|
+
};
|
|
140
|
+
const SKIP_CONFIG_VALIDATION = {
|
|
141
|
+
init: { target: true },
|
|
142
|
+
auth: { target: true },
|
|
143
|
+
};
|
|
122
144
|
const loadConfigMiddleware = async (options) => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
logger.error(i18n(`${i18nKey}.loadConfigMiddleware.configFileExists`, {
|
|
127
|
-
configPath: getConfigPath(),
|
|
128
|
-
}));
|
|
145
|
+
const maybeValidateConfig = () => {
|
|
146
|
+
if (!isTargetedCommand(options, SKIP_CONFIG_VALIDATION) &&
|
|
147
|
+
!validateConfig()) {
|
|
129
148
|
process.exit(EXIT_CODES.ERROR);
|
|
130
149
|
}
|
|
150
|
+
};
|
|
151
|
+
if (configFileExists(true) && options.config) {
|
|
152
|
+
logger.error(i18n(`${i18nKey}.loadConfigMiddleware.configFileExists`, {
|
|
153
|
+
configPath: getConfigPath(),
|
|
154
|
+
}));
|
|
155
|
+
process.exit(EXIT_CODES.ERROR);
|
|
131
156
|
}
|
|
132
|
-
|
|
133
|
-
// so that getAccountIdFromConfig() in injectAccountIdMiddleware reads from the right config
|
|
134
|
-
if (options.config && fs.existsSync(options.config)) {
|
|
157
|
+
else if (!options._.includes('init')) {
|
|
135
158
|
const { config: configPath } = options;
|
|
136
|
-
|
|
159
|
+
loadConfig(configPath, options);
|
|
160
|
+
}
|
|
161
|
+
maybeValidateConfig();
|
|
162
|
+
};
|
|
163
|
+
const checkAndWarnGitInclusionMiddleware = () => {
|
|
164
|
+
checkAndWarnGitInclusion(getConfigPath());
|
|
165
|
+
};
|
|
166
|
+
const accountsSubCommands = {
|
|
167
|
+
target: false,
|
|
168
|
+
subCommands: {
|
|
169
|
+
clean: { target: true },
|
|
170
|
+
list: { target: true },
|
|
171
|
+
ls: { target: true },
|
|
172
|
+
remove: { target: true },
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
const sandboxesSubCommands = {
|
|
176
|
+
target: false,
|
|
177
|
+
subCommands: {
|
|
178
|
+
delete: { target: true },
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
const SKIP_ACCOUNT_VALIDATION = {
|
|
182
|
+
init: { target: true },
|
|
183
|
+
auth: { target: true },
|
|
184
|
+
account: accountsSubCommands,
|
|
185
|
+
accounts: accountsSubCommands,
|
|
186
|
+
sandbox: sandboxesSubCommands,
|
|
187
|
+
sandboxes: sandboxesSubCommands,
|
|
188
|
+
};
|
|
189
|
+
const validateAccountOptions = async (options) => {
|
|
190
|
+
let validAccount = true;
|
|
191
|
+
if (!isTargetedCommand(options, SKIP_ACCOUNT_VALIDATION)) {
|
|
192
|
+
validAccount = await validateAccount(options);
|
|
193
|
+
}
|
|
194
|
+
if (!validAccount) {
|
|
195
|
+
process.exit(EXIT_CODES.ERROR);
|
|
137
196
|
}
|
|
138
197
|
};
|
|
139
198
|
const argv = yargs
|
|
@@ -144,6 +203,8 @@ const argv = yargs
|
|
|
144
203
|
setRequestHeaders,
|
|
145
204
|
loadConfigMiddleware,
|
|
146
205
|
injectAccountIdMiddleware,
|
|
206
|
+
checkAndWarnGitInclusionMiddleware,
|
|
207
|
+
validateAccountOptions,
|
|
147
208
|
])
|
|
148
209
|
.exitProcess(false)
|
|
149
210
|
.fail(handleFailure)
|
package/bin/hs
CHANGED
package/bin/hscms
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const SILENCED_ERRORS = ['DeprecationWarning:'];
|
|
5
|
+
const originalConsoleError = console.error;
|
|
6
|
+
console.error = msg => {
|
|
7
|
+
const isSilencedError = SILENCED_ERRORS.some(error => typeof msg === 'string' && msg.includes(error));
|
|
8
|
+
if (isSilencedError) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
originalConsoleError(msg);
|
|
12
|
+
};
|
|
@@ -5,7 +5,6 @@ const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
|
5
5
|
const { accessTokenForPersonalAccessKey, } = require('@hubspot/local-dev-lib/personalAccessKey');
|
|
6
6
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
7
7
|
const { i18n } = require('../../lib/lang');
|
|
8
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
9
8
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
10
9
|
const { addTestingOptions, addConfigOptions } = require('../../lib/commonOpts');
|
|
11
10
|
const { promptUser } = require('../../lib/prompts/promptUtils');
|
|
@@ -20,7 +19,6 @@ exports.command = 'clean';
|
|
|
20
19
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
21
20
|
exports.handler = async (options) => {
|
|
22
21
|
const { qa } = options;
|
|
23
|
-
await loadAndValidateOptions(options, false);
|
|
24
22
|
trackCommandUsage('accounts-clean', null);
|
|
25
23
|
const accountsList = getConfigAccounts();
|
|
26
24
|
const filteredTestAccounts = accountsList.filter(p => qa ? p.env === 'qa' : p.env !== 'qa');
|
package/commands/account/info.js
CHANGED
|
@@ -5,14 +5,12 @@ const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
|
5
5
|
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
|
|
6
6
|
const { getAccessToken } = require('@hubspot/local-dev-lib/personalAccessKey');
|
|
7
7
|
const { addConfigOptions } = require('../../lib/commonOpts');
|
|
8
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
9
8
|
const { i18n } = require('../../lib/lang');
|
|
10
9
|
const { getTableContents } = require('../../lib/ui/table');
|
|
11
10
|
const i18nKey = 'commands.account.subcommands.info';
|
|
12
11
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
13
12
|
exports.command = 'info [account]';
|
|
14
13
|
exports.handler = async (options) => {
|
|
15
|
-
await loadAndValidateOptions(options);
|
|
16
14
|
const { derivedAccountId } = options;
|
|
17
15
|
const config = getAccountConfig(derivedAccountId);
|
|
18
16
|
// check if the provided account is using a personal access key, if not, show an error
|
package/commands/account/list.js
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// @ts-nocheck
|
|
4
4
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
5
|
-
const {
|
|
5
|
+
const { getConfigPath, getConfigDefaultAccount, getConfigAccounts, } = require('@hubspot/local-dev-lib/config');
|
|
6
6
|
const { getAccountIdentifier, } = require('@hubspot/local-dev-lib/config/getAccountIdentifier');
|
|
7
7
|
const { addConfigOptions } = require('../../lib/commonOpts');
|
|
8
8
|
const { getTableContents, getTableHeader } = require('../../lib/ui/table');
|
|
9
9
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
10
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
11
10
|
const { isSandbox, isDeveloperTestAccount } = require('../../lib/accountTypes');
|
|
12
11
|
const { i18n } = require('../../lib/lang');
|
|
13
12
|
const { HUBSPOT_ACCOUNT_TYPES, HUBSPOT_ACCOUNT_TYPE_STRINGS, } = require('@hubspot/local-dev-lib/constants/config');
|
|
@@ -62,10 +61,8 @@ const getPortalData = mappedPortalData => {
|
|
|
62
61
|
return portalData;
|
|
63
62
|
};
|
|
64
63
|
exports.handler = async (options) => {
|
|
65
|
-
await loadAndValidateOptions(options, false);
|
|
66
64
|
const { derivedAccountId } = options;
|
|
67
65
|
trackCommandUsage('accounts-list', null, derivedAccountId);
|
|
68
|
-
const config = getConfig();
|
|
69
66
|
const configPath = getConfigPath();
|
|
70
67
|
const accountsList = getConfigAccounts();
|
|
71
68
|
const mappedPortalData = sortAndMapPortals(accountsList);
|
|
@@ -77,7 +74,7 @@ exports.handler = async (options) => {
|
|
|
77
74
|
]));
|
|
78
75
|
logger.log(i18n(`${i18nKey}.configPath`, { configPath }));
|
|
79
76
|
logger.log(i18n(`${i18nKey}.defaultAccount`, {
|
|
80
|
-
account: getConfigDefaultAccount(
|
|
77
|
+
account: getConfigDefaultAccount(),
|
|
81
78
|
}));
|
|
82
79
|
logger.log(i18n(`${i18nKey}.accounts`));
|
|
83
80
|
logger.log(getTableContents(portalData, { border: { bodyLeft: ' ' } }));
|
|
@@ -3,19 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
// @ts-nocheck
|
|
4
4
|
const { addConfigOptions } = require('../../lib/commonOpts');
|
|
5
5
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
6
|
-
const {
|
|
6
|
+
const { loadConfig, getConfigPath, deleteAccount, getConfigDefaultAccount, getAccountId: getAccountIdFromConfig, updateDefaultAccount, } = require('@hubspot/local-dev-lib/config');
|
|
7
7
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
8
8
|
const { i18n } = require('../../lib/lang');
|
|
9
9
|
const { selectAccountFromConfig } = require('../../lib/prompts/accountsPrompt');
|
|
10
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
11
10
|
const i18nKey = 'commands.account.subcommands.remove';
|
|
12
11
|
exports.command = 'remove [account]';
|
|
13
12
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
14
13
|
exports.handler = async (options) => {
|
|
15
|
-
await loadAndValidateOptions(options, false);
|
|
16
14
|
const { account } = options;
|
|
17
15
|
let accountToRemove = account;
|
|
18
|
-
let config = getConfig();
|
|
19
16
|
if (accountToRemove && !getAccountIdFromConfig(accountToRemove)) {
|
|
20
17
|
logger.error(i18n(`${i18nKey}.errors.accountNotFound`, {
|
|
21
18
|
specifiedAccount: accountToRemove,
|
|
@@ -23,7 +20,7 @@ exports.handler = async (options) => {
|
|
|
23
20
|
}));
|
|
24
21
|
}
|
|
25
22
|
if (!accountToRemove || !getAccountIdFromConfig(accountToRemove)) {
|
|
26
|
-
accountToRemove = await selectAccountFromConfig(
|
|
23
|
+
accountToRemove = await selectAccountFromConfig(i18n(`${i18nKey}.prompts.selectAccountToRemove`));
|
|
27
24
|
}
|
|
28
25
|
trackCommandUsage('accounts-remove', null, getAccountIdFromConfig(accountToRemove));
|
|
29
26
|
const currentDefaultAccount = getConfigDefaultAccount();
|
|
@@ -32,11 +29,11 @@ exports.handler = async (options) => {
|
|
|
32
29
|
accountName: accountToRemove,
|
|
33
30
|
}));
|
|
34
31
|
// Get updated version of the config
|
|
35
|
-
|
|
32
|
+
loadConfig(getConfigPath(), options);
|
|
36
33
|
if (accountToRemove === currentDefaultAccount) {
|
|
37
34
|
logger.log();
|
|
38
35
|
logger.log(i18n(`${i18nKey}.logs.replaceDefaultAccount`));
|
|
39
|
-
const newDefaultAccount = await selectAccountFromConfig(
|
|
36
|
+
const newDefaultAccount = await selectAccountFromConfig();
|
|
40
37
|
updateDefaultAccount(newDefaultAccount);
|
|
41
38
|
}
|
|
42
39
|
};
|
|
@@ -5,13 +5,11 @@ const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
|
5
5
|
const { renameAccount } = require('@hubspot/local-dev-lib/config');
|
|
6
6
|
const { addConfigOptions, addAccountOptions } = require('../../lib/commonOpts');
|
|
7
7
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
8
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
9
8
|
const { i18n } = require('../../lib/lang');
|
|
10
9
|
const i18nKey = 'commands.account.subcommands.rename';
|
|
11
10
|
exports.command = 'rename <accountName> <newName>';
|
|
12
11
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
13
12
|
exports.handler = async (options) => {
|
|
14
|
-
loadAndValidateOptions(options);
|
|
15
13
|
const { accountName, newName, derivedAccountId } = options;
|
|
16
14
|
trackCommandUsage('accounts-rename', null, derivedAccountId);
|
|
17
15
|
await renameAccount(accountName, newName);
|
package/commands/account/use.js
CHANGED
|
@@ -2,27 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// @ts-nocheck
|
|
4
4
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
5
|
-
const {
|
|
5
|
+
const { getConfigPath, updateDefaultAccount, getAccountId: getAccountIdFromConfig, } = require('@hubspot/local-dev-lib/config');
|
|
6
6
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
7
7
|
const { i18n } = require('../../lib/lang');
|
|
8
8
|
const { selectAccountFromConfig } = require('../../lib/prompts/accountsPrompt');
|
|
9
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
10
9
|
const i18nKey = 'commands.account.subcommands.use';
|
|
11
10
|
exports.command = 'use [account]';
|
|
12
11
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
13
12
|
exports.handler = async (options) => {
|
|
14
|
-
await loadAndValidateOptions(options, false);
|
|
15
|
-
const config = getConfig();
|
|
16
13
|
let newDefaultAccount = options.account;
|
|
17
14
|
if (!newDefaultAccount) {
|
|
18
|
-
newDefaultAccount = await selectAccountFromConfig(
|
|
15
|
+
newDefaultAccount = await selectAccountFromConfig();
|
|
19
16
|
}
|
|
20
17
|
else if (!getAccountIdFromConfig(newDefaultAccount)) {
|
|
21
18
|
logger.error(i18n(`${i18nKey}.errors.accountNotFound`, {
|
|
22
19
|
specifiedAccount: newDefaultAccount,
|
|
23
20
|
configPath: getConfigPath(),
|
|
24
21
|
}));
|
|
25
|
-
newDefaultAccount = await selectAccountFromConfig(
|
|
22
|
+
newDefaultAccount = await selectAccountFromConfig();
|
|
26
23
|
}
|
|
27
24
|
trackCommandUsage('accounts-use', null, getAccountIdFromConfig(newDefaultAccount));
|
|
28
25
|
updateDefaultAccount(newDefaultAccount);
|
package/commands/auth.js
CHANGED
|
@@ -8,7 +8,7 @@ const { ENVIRONMENTS, } = require('@hubspot/local-dev-lib/constants/environments
|
|
|
8
8
|
const { DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME, } = require('@hubspot/local-dev-lib/constants/config');
|
|
9
9
|
const { i18n } = require('../lib/lang');
|
|
10
10
|
const { getAccessToken, updateConfigWithAccessToken, } = require('@hubspot/local-dev-lib/personalAccessKey');
|
|
11
|
-
const { updateAccountConfig, writeConfig,
|
|
11
|
+
const { updateAccountConfig, writeConfig, getConfigPath, loadConfig, getConfigDefaultAccount, } = require('@hubspot/local-dev-lib/config');
|
|
12
12
|
const { commaSeparatedValues, toKebabCase, } = require('@hubspot/local-dev-lib/text');
|
|
13
13
|
const { promptUser } = require('../lib/prompts/promptUtils');
|
|
14
14
|
const { personalAccessKeyPrompt, OAUTH_FLOW, } = require('../lib/prompts/personalAccessKeyPrompt');
|
|
@@ -115,9 +115,8 @@ exports.handler = async (options) => {
|
|
|
115
115
|
}));
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
|
-
const config = getConfig();
|
|
119
118
|
logger.info(i18n(`lib.prompts.setAsDefaultAccountPrompt.keepingCurrentDefault`, {
|
|
120
|
-
accountName: getConfigDefaultAccount(
|
|
119
|
+
accountName: getConfigDefaultAccount(),
|
|
121
120
|
}));
|
|
122
121
|
}
|
|
123
122
|
logger.success(i18n(`${i18nKey}.success.configFileUpdated`, {
|
|
@@ -5,7 +5,6 @@ const SpinniesManager = require('../../lib/ui/SpinniesManager');
|
|
|
5
5
|
const { addAccountOptions, addConfigOptions, addUseEnvironmentOptions, } = require('../../lib/commonOpts');
|
|
6
6
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
7
7
|
const { getTableContents, getTableHeader } = require('../../lib/ui/table');
|
|
8
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
9
8
|
const { promptUser } = require('../../lib/prompts/promptUtils');
|
|
10
9
|
const { i18n } = require('../../lib/lang');
|
|
11
10
|
const { fetchThemes } = require('@hubspot/local-dev-lib/api/designManager');
|
|
@@ -53,7 +52,6 @@ const selectTheme = async (accountId) => {
|
|
|
53
52
|
return selectedTheme;
|
|
54
53
|
};
|
|
55
54
|
exports.handler = async (options) => {
|
|
56
|
-
await loadAndValidateOptions(options);
|
|
57
55
|
const { target, verbose, theme, derivedAccountId } = options;
|
|
58
56
|
const includeDesktopScore = target === 'desktop' || !verbose;
|
|
59
57
|
const includeMobileScore = target === 'mobile' || !verbose;
|
package/commands/config/set.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// @ts-nocheck
|
|
4
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
5
4
|
const { i18n } = require('../../lib/lang');
|
|
6
5
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
7
6
|
const { promptUser } = require('../../lib/prompts/promptUtils');
|
|
@@ -47,7 +46,6 @@ const handleConfigUpdate = async (accountId, options) => {
|
|
|
47
46
|
return false;
|
|
48
47
|
};
|
|
49
48
|
exports.handler = async (options) => {
|
|
50
|
-
await loadAndValidateOptions(options);
|
|
51
49
|
const { derivedAccountId } = options;
|
|
52
50
|
trackCommandUsage('config-set', null, derivedAccountId);
|
|
53
51
|
const configUpdated = await handleConfigUpdate(derivedAccountId, options);
|
package/commands/create.js
CHANGED
|
@@ -27,7 +27,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
27
27
|
const fs = require('fs-extra');
|
|
28
28
|
const { logError } = require('../lib/errorHandlers/index');
|
|
29
29
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
30
|
-
const { setLogLevel, addGlobalOptions } = require('../lib/commonOpts');
|
|
30
|
+
const { setLogLevel, addGlobalOptions, addConfigOptions, } = require('../lib/commonOpts');
|
|
31
31
|
const { resolveLocalPath } = require('../lib/filesystem');
|
|
32
32
|
const { trackCommandUsage } = require('../lib/usageTracking');
|
|
33
33
|
const assets = require('./create/index');
|
|
@@ -100,6 +100,7 @@ exports.builder = yargs => {
|
|
|
100
100
|
type: 'boolean',
|
|
101
101
|
hidden: true,
|
|
102
102
|
});
|
|
103
|
+
addConfigOptions(yargs);
|
|
103
104
|
addGlobalOptions(yargs);
|
|
104
105
|
return yargs;
|
|
105
106
|
};
|
|
@@ -5,7 +5,7 @@ const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
|
5
5
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
6
6
|
const { logError } = require('../../lib/errorHandlers/index');
|
|
7
7
|
const { getAbsoluteFilePath } = require('@hubspot/local-dev-lib/path');
|
|
8
|
-
const { checkAndConvertToJson
|
|
8
|
+
const { checkAndConvertToJson } = require('../../lib/validation');
|
|
9
9
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
10
10
|
const { batchCreateObjects, } = require('@hubspot/local-dev-lib/api/customObjects');
|
|
11
11
|
const { i18n } = require('../../lib/lang');
|
|
@@ -16,7 +16,6 @@ exports.describe = i18n(`${i18nKey}.describe`);
|
|
|
16
16
|
exports.handler = async (options) => {
|
|
17
17
|
const { path, name: providedName, derivedAccountId } = options;
|
|
18
18
|
let definitionPath = path;
|
|
19
|
-
await loadAndValidateOptions(options);
|
|
20
19
|
trackCommandUsage('custom-object-batch-create', null, derivedAccountId);
|
|
21
20
|
if (!definitionPath) {
|
|
22
21
|
definitionPath = await (0, promptUtils_1.inputPrompt)(i18n(`${i18nKey}.inputPath`));
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
5
5
|
const { logError } = require('../../../lib/errorHandlers/index');
|
|
6
6
|
const { getAbsoluteFilePath } = require('@hubspot/local-dev-lib/path');
|
|
7
|
-
const { checkAndConvertToJson
|
|
7
|
+
const { checkAndConvertToJson } = require('../../../lib/validation');
|
|
8
8
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
9
9
|
const { addTestingOptions } = require('../../../lib/commonOpts');
|
|
10
10
|
const { getEnv, isConfigFlagEnabled, } = require('@hubspot/local-dev-lib/config');
|
|
@@ -20,7 +20,6 @@ exports.command = 'create';
|
|
|
20
20
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
21
21
|
exports.handler = async (options) => {
|
|
22
22
|
const { path, derivedAccountId } = options;
|
|
23
|
-
await loadAndValidateOptions(options);
|
|
24
23
|
trackCommandUsage('custom-object-schema-create', null, derivedAccountId);
|
|
25
24
|
const filePath = getAbsoluteFilePath(path);
|
|
26
25
|
const schemaJson = checkAndConvertToJson(filePath);
|
|
@@ -5,7 +5,6 @@ const exitCodes_1 = require("../../../lib/enums/exitCodes");
|
|
|
5
5
|
const promptUtils_1 = require("../../../lib/prompts/promptUtils");
|
|
6
6
|
const customObjects_1 = require("@hubspot/local-dev-lib/api/customObjects");
|
|
7
7
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
8
|
-
const { loadAndValidateOptions } = require('../../../lib/validation');
|
|
9
8
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
10
9
|
const { deleteObjectSchema, } = require('@hubspot/local-dev-lib/api/customObjects');
|
|
11
10
|
const { i18n } = require('../../../lib/lang');
|
|
@@ -15,7 +14,6 @@ exports.command = 'delete [name]';
|
|
|
15
14
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
16
15
|
exports.handler = async (options) => {
|
|
17
16
|
const { name: providedName, force, derivedAccountId } = options;
|
|
18
|
-
await loadAndValidateOptions(options);
|
|
19
17
|
trackCommandUsage('custom-object-schema-delete', null, derivedAccountId);
|
|
20
18
|
let name;
|
|
21
19
|
try {
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
// @ts-nocheck
|
|
4
4
|
const promptUtils_1 = require("../../../lib/prompts/promptUtils");
|
|
5
5
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
6
|
-
const { loadAndValidateOptions } = require('../../../lib/validation');
|
|
7
6
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
8
7
|
const { downloadSchemas, getResolvedPath, } = require('@hubspot/local-dev-lib/customObjects');
|
|
9
8
|
const { i18n } = require('../../../lib/lang');
|
|
@@ -13,7 +12,6 @@ const i18nKey = 'commands.customObject.subcommands.schema.subcommands.fetchAll';
|
|
|
13
12
|
exports.command = 'fetch-all [dest]';
|
|
14
13
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
15
14
|
exports.handler = async (options) => {
|
|
16
|
-
await loadAndValidateOptions(options);
|
|
17
15
|
const { derivedAccountId, dest: providedDest } = options;
|
|
18
16
|
trackCommandUsage('custom-object-schema-fetch-all', null, derivedAccountId);
|
|
19
17
|
try {
|
|
@@ -10,7 +10,6 @@ const { CONFIG_FLAGS } = require('../../../lib/constants');
|
|
|
10
10
|
const { downloadSchema, getResolvedPath, } = require('@hubspot/local-dev-lib/customObjects');
|
|
11
11
|
const { fetchSchema } = require('@hubspot/local-dev-lib/api/fileTransport');
|
|
12
12
|
const { getCwd } = require('@hubspot/local-dev-lib/path');
|
|
13
|
-
const { loadAndValidateOptions } = require('../../../lib/validation');
|
|
14
13
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
15
14
|
const { i18n } = require('../../../lib/lang');
|
|
16
15
|
const { logError } = require('../../../lib/errorHandlers');
|
|
@@ -19,7 +18,6 @@ exports.command = 'fetch [name] [dest]';
|
|
|
19
18
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
20
19
|
exports.handler = async (options) => {
|
|
21
20
|
const { name: providedName, dest: providedDest, derivedAccountId } = options;
|
|
22
|
-
await loadAndValidateOptions(options);
|
|
23
21
|
trackCommandUsage('custom-object-schema-fetch', null, derivedAccountId);
|
|
24
22
|
let name;
|
|
25
23
|
try {
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
// @ts-nocheck
|
|
4
4
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
5
5
|
const { logError } = require('../../../lib/errorHandlers/index');
|
|
6
|
-
const { loadAndValidateOptions } = require('../../../lib/validation');
|
|
7
6
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
8
7
|
const { listSchemas } = require('../../../lib/schema');
|
|
9
8
|
const { i18n } = require('../../../lib/lang');
|
|
@@ -11,7 +10,6 @@ const i18nKey = 'commands.customObject.subcommands.schema.subcommands.list';
|
|
|
11
10
|
exports.command = 'list';
|
|
12
11
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
13
12
|
exports.handler = async (options) => {
|
|
14
|
-
await loadAndValidateOptions(options);
|
|
15
13
|
const { derivedAccountId } = options;
|
|
16
14
|
trackCommandUsage('custom-object-schema-list', null, derivedAccountId);
|
|
17
15
|
try {
|
|
@@ -7,7 +7,7 @@ const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
|
7
7
|
const { logError } = require('../../../lib/errorHandlers/index');
|
|
8
8
|
const { getAbsoluteFilePath } = require('@hubspot/local-dev-lib/path');
|
|
9
9
|
const { ENVIRONMENTS, } = require('@hubspot/local-dev-lib/constants/environments');
|
|
10
|
-
const { checkAndConvertToJson
|
|
10
|
+
const { checkAndConvertToJson } = require('../../../lib/validation');
|
|
11
11
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
12
12
|
const { addTestingOptions } = require('../../../lib/commonOpts');
|
|
13
13
|
const { CONFIG_FLAGS } = require('../../../lib/constants');
|
|
@@ -22,7 +22,6 @@ exports.command = 'update [name]';
|
|
|
22
22
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
23
23
|
exports.handler = async (options) => {
|
|
24
24
|
const { path, name: providedName, derivedAccountId } = options;
|
|
25
|
-
await loadAndValidateOptions(options);
|
|
26
25
|
trackCommandUsage('custom-object-schema-update', null, derivedAccountId);
|
|
27
26
|
const filePath = getAbsoluteFilePath(path);
|
|
28
27
|
const schemaJson = checkAndConvertToJson(filePath);
|
package/commands/doctor.js
CHANGED
|
@@ -18,11 +18,11 @@ exports.command = 'doctor';
|
|
|
18
18
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
19
19
|
const handler = async ({ outputDir, }) => {
|
|
20
20
|
const doctor = new Doctor_1.Doctor();
|
|
21
|
-
(0, usageTracking_1.trackCommandUsage)(exports.command, undefined, doctor.accountId);
|
|
21
|
+
(0, usageTracking_1.trackCommandUsage)(exports.command, undefined, doctor.accountId || undefined);
|
|
22
22
|
const output = await doctor.diagnose();
|
|
23
23
|
const totalCount = (output?.errorCount || 0) + (output?.warningCount || 0);
|
|
24
24
|
if (totalCount > 0) {
|
|
25
|
-
(0, usageTracking_1.trackCommandMetadataUsage)(exports.command, {
|
|
25
|
+
(0, usageTracking_1.trackCommandMetadataUsage)(exports.command, { successful: false, type: totalCount }, doctor.accountId || undefined);
|
|
26
26
|
}
|
|
27
27
|
if (!outputDir) {
|
|
28
28
|
if (output?.diagnosis) {
|
package/commands/fetch.js
CHANGED
|
@@ -5,7 +5,7 @@ const { downloadFileOrFolder } = require('@hubspot/local-dev-lib/fileMapper');
|
|
|
5
5
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
6
6
|
const { addConfigOptions, addAccountOptions, addOverwriteOptions, addCmsPublishModeOptions, addUseEnvironmentOptions, getCmsPublishMode, addGlobalOptions, } = require('../lib/commonOpts');
|
|
7
7
|
const { resolveLocalPath } = require('../lib/filesystem');
|
|
8
|
-
const { validateCmsPublishMode
|
|
8
|
+
const { validateCmsPublishMode } = require('../lib/validation');
|
|
9
9
|
const { trackCommandUsage } = require('../lib/usageTracking');
|
|
10
10
|
const { i18n } = require('../lib/lang');
|
|
11
11
|
const i18nKey = 'commands.fetch';
|
|
@@ -15,7 +15,6 @@ exports.command = 'fetch <src> [dest]';
|
|
|
15
15
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
16
16
|
exports.handler = async (options) => {
|
|
17
17
|
const { src, dest } = options;
|
|
18
|
-
await loadAndValidateOptions(options);
|
|
19
18
|
if (!validateCmsPublishMode(options)) {
|
|
20
19
|
process.exit(EXIT_CODES.ERROR);
|
|
21
20
|
}
|
|
@@ -25,7 +24,7 @@ exports.handler = async (options) => {
|
|
|
25
24
|
}
|
|
26
25
|
const { derivedAccountId } = options;
|
|
27
26
|
const cmsPublishMode = getCmsPublishMode(options);
|
|
28
|
-
trackCommandUsage('fetch', { mode: cmsPublishMode },
|
|
27
|
+
trackCommandUsage('fetch', { mode: cmsPublishMode }, derivedAccountId);
|
|
29
28
|
try {
|
|
30
29
|
// Fetch and write file/folder.
|
|
31
30
|
await downloadFileOrFolder(derivedAccountId, src, resolveLocalPath(dest), cmsPublishMode, options);
|
|
@@ -5,7 +5,6 @@ const { downloadFileOrFolder } = require('@hubspot/local-dev-lib/fileManager');
|
|
|
5
5
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
6
6
|
const { resolveLocalPath } = require('../../lib/filesystem');
|
|
7
7
|
const { addConfigOptions, addAccountOptions, addOverwriteOptions, addGlobalOptions, addUseEnvironmentOptions, } = require('../../lib/commonOpts');
|
|
8
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
9
8
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
10
9
|
const { i18n } = require('../../lib/lang');
|
|
11
10
|
const i18nKey = 'commands.filemanager.subcommands.fetch';
|
|
@@ -15,7 +14,6 @@ exports.command = 'fetch <src> [dest]';
|
|
|
15
14
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
16
15
|
exports.handler = async (options) => {
|
|
17
16
|
const { src, includeArchived, derivedAccountId, overwrite } = options;
|
|
18
|
-
await loadAndValidateOptions(options);
|
|
19
17
|
if (typeof src !== 'string') {
|
|
20
18
|
logger.error(i18n(`${i18nKey}.errors.sourceRequired`));
|
|
21
19
|
process.exit(EXIT_CODES.ERROR);
|
|
@@ -11,7 +11,6 @@ const { validateSrcAndDestPaths, } = require('@hubspot/local-dev-lib/cms/modules
|
|
|
11
11
|
const { shouldIgnoreFile } = require('@hubspot/local-dev-lib/ignoreRules');
|
|
12
12
|
const { ApiErrorContext, logError } = require('../../lib/errorHandlers/index');
|
|
13
13
|
const { addConfigOptions, addGlobalOptions, addAccountOptions, addUseEnvironmentOptions, } = require('../../lib/commonOpts');
|
|
14
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
15
14
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
16
15
|
const { i18n } = require('../../lib/lang');
|
|
17
16
|
const i18nKey = 'commands.filemanager.subcommands.upload';
|
|
@@ -20,7 +19,6 @@ exports.command = 'upload <src> <dest>';
|
|
|
20
19
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
21
20
|
exports.handler = async (options) => {
|
|
22
21
|
const { src, dest, derivedAccountId } = options;
|
|
23
|
-
await loadAndValidateOptions(options);
|
|
24
22
|
const absoluteSrcPath = path.resolve(getCwd(), src);
|
|
25
23
|
let stats;
|
|
26
24
|
try {
|
package/commands/filemanager.js
CHANGED
|
@@ -8,9 +8,6 @@ const i18nKey = 'commands.filemanager';
|
|
|
8
8
|
exports.command = 'filemanager';
|
|
9
9
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
10
10
|
exports.builder = yargs => {
|
|
11
|
-
yargs
|
|
12
|
-
.command(upload)
|
|
13
|
-
.command(fetch)
|
|
14
|
-
.demandCommand(1, '');
|
|
11
|
+
yargs.command(upload).command(fetch).demandCommand(1, '');
|
|
15
12
|
return yargs;
|
|
16
13
|
};
|
|
@@ -9,7 +9,6 @@ const { uiAccountDescription } = require('../../lib/ui');
|
|
|
9
9
|
const { poll } = require('../../lib/polling');
|
|
10
10
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
11
11
|
const { buildPackage, getBuildStatus, } = require('@hubspot/local-dev-lib/api/functions');
|
|
12
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
13
12
|
const { outputBuildLog } = require('../../lib/serverlessLogs');
|
|
14
13
|
const { i18n } = require('../../lib/lang');
|
|
15
14
|
const { isHubSpotHttpError } = require('@hubspot/local-dev-lib/errors/index');
|
|
@@ -17,7 +16,6 @@ const i18nKey = 'commands.function.subcommands.deploy';
|
|
|
17
16
|
exports.command = 'deploy <path>';
|
|
18
17
|
exports.describe = false;
|
|
19
18
|
exports.handler = async (options) => {
|
|
20
|
-
await loadAndValidateOptions(options);
|
|
21
19
|
const { path: functionPath, derivedAccountId } = options;
|
|
22
20
|
const splitFunctionPath = functionPath.split('.');
|
|
23
21
|
trackCommandUsage('functions-deploy', null, derivedAccountId);
|
|
@@ -8,14 +8,12 @@ const { logError, ApiErrorContext } = require('../../lib/errorHandlers/index');
|
|
|
8
8
|
const { getTableContents, getTableHeader } = require('../../lib/ui/table');
|
|
9
9
|
const { addConfigOptions, addAccountOptions, addUseEnvironmentOptions, } = require('../../lib/commonOpts');
|
|
10
10
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
11
|
-
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
12
11
|
const { i18n } = require('../../lib/lang');
|
|
13
12
|
const i18nKey = 'commands.function.subcommands.list';
|
|
14
13
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
15
14
|
exports.command = ['list', 'ls'];
|
|
16
15
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
17
16
|
exports.handler = async (options) => {
|
|
18
|
-
loadAndValidateOptions(options);
|
|
19
17
|
const { derivedAccountId } = options;
|
|
20
18
|
trackCommandUsage('functions-list', null, derivedAccountId);
|
|
21
19
|
logger.debug(i18n(`${i18nKey}.debug.gettingFunctions`));
|