@hubspot/cli 4.0.2-beta.2 → 4.0.2-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.
- package/bin/cli.js +8 -1
- package/commands/accounts/list.js +1 -1
- package/commands/accounts/rename.js +1 -1
- package/commands/accounts/use.js +1 -1
- package/commands/config/set/allowUsageTracking.js +1 -1
- package/commands/config/set/defaultMode.js +1 -1
- package/commands/config/set/httpTimeout.js +1 -1
- package/commands/config/set.js +1 -1
- package/commands/create.js +2 -6
- package/commands/filemanager/fetch.js +1 -1
- package/commands/functions/deploy.js +1 -1
- package/commands/functions/list.js +1 -2
- package/commands/functions/server.js +1 -1
- package/commands/hubdb/clear.js +1 -1
- package/commands/hubdb/create.js +1 -1
- package/commands/hubdb/delete.js +1 -1
- package/commands/hubdb/fetch.js +1 -1
- package/commands/lint.js +1 -1
- package/commands/list.js +1 -1
- package/commands/module/marketplace-validate.js +1 -1
- package/commands/mv.js +1 -1
- package/commands/open.js +1 -1
- package/commands/process.js +6 -2
- package/commands/project/create.js +3 -1
- package/commands/project/deploy.js +4 -1
- package/commands/project/download.js +16 -2
- package/commands/project/listBuilds.js +1 -1
- package/commands/project/logs.js +6 -6
- package/commands/project/open.js +1 -1
- package/commands/project/upload.js +4 -1
- package/commands/project/watch.js +1 -1
- package/commands/remove.js +1 -1
- package/commands/sandbox/create.js +1 -3
- package/commands/sandbox/delete.js +1 -3
- package/commands/secrets/addSecret.js +1 -1
- package/commands/secrets/deleteSecret.js +1 -1
- package/commands/secrets/listSecrets.js +1 -1
- package/commands/secrets/updateSecret.js +1 -1
- package/commands/theme/marketplace-validate.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/prompts/createProjectPrompt.js +6 -12
- package/lib/ui.js +4 -3
- package/lib/usageTracking.js +19 -0
- package/package.json +4 -4
package/bin/cli.js
CHANGED
|
@@ -7,7 +7,10 @@ const chalk = require('chalk');
|
|
|
7
7
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
8
8
|
const { logErrorInstance } = require('@hubspot/cli-lib/errorHandlers');
|
|
9
9
|
const { setLogLevel, getCommandName } = require('../lib/commonOpts');
|
|
10
|
-
const {
|
|
10
|
+
const {
|
|
11
|
+
trackHelpUsage,
|
|
12
|
+
trackProcessFieldsUsage,
|
|
13
|
+
} = require('../lib/usageTracking');
|
|
11
14
|
const { getIsInProject } = require('../lib/projects');
|
|
12
15
|
const pkg = require('../package.json');
|
|
13
16
|
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
@@ -166,3 +169,7 @@ const argv = yargs
|
|
|
166
169
|
if (argv.help) {
|
|
167
170
|
trackHelpUsage(getCommandName(argv));
|
|
168
171
|
}
|
|
172
|
+
|
|
173
|
+
if (argv.processFieldsJs) {
|
|
174
|
+
trackProcessFieldsUsage(getCommandName(argv));
|
|
175
|
+
}
|
|
@@ -72,7 +72,7 @@ exports.handler = async options => {
|
|
|
72
72
|
|
|
73
73
|
const accountId = getAccountId(options);
|
|
74
74
|
|
|
75
|
-
trackCommandUsage('accounts-list',
|
|
75
|
+
trackCommandUsage('accounts-list', null, accountId);
|
|
76
76
|
|
|
77
77
|
const config = getConfig();
|
|
78
78
|
const configPath = getConfigPath();
|
|
@@ -21,7 +21,7 @@ exports.handler = async options => {
|
|
|
21
21
|
const { accountName, newName } = options;
|
|
22
22
|
const accountId = getAccountId(options);
|
|
23
23
|
|
|
24
|
-
trackCommandUsage('accounts-rename',
|
|
24
|
+
trackCommandUsage('accounts-rename', null, accountId);
|
|
25
25
|
|
|
26
26
|
await renameAccount(accountName, newName);
|
|
27
27
|
|
package/commands/accounts/use.js
CHANGED
|
@@ -33,7 +33,7 @@ const enableOrDisableUsageTracking = async () => {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const setAllowUsageTracking = async ({ accountId, allowUsageTracking }) => {
|
|
36
|
-
trackCommandUsage('config-set-allow-usage-tracking',
|
|
36
|
+
trackCommandUsage('config-set-allow-usage-tracking', null, accountId);
|
|
37
37
|
|
|
38
38
|
let isEnabled;
|
|
39
39
|
|
|
@@ -27,7 +27,7 @@ const selectMode = async () => {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const setDefaultMode = async ({ accountId, defaultMode }) => {
|
|
30
|
-
trackCommandUsage('config-set-default-mode',
|
|
30
|
+
trackCommandUsage('config-set-default-mode', null, accountId);
|
|
31
31
|
|
|
32
32
|
let newDefault;
|
|
33
33
|
|
|
@@ -20,7 +20,7 @@ const enterTimeout = async () => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
const setHttpTimeout = async ({ accountId, httpTimeout }) => {
|
|
23
|
-
trackCommandUsage('config-set-http-timeout',
|
|
23
|
+
trackCommandUsage('config-set-http-timeout', null, accountId);
|
|
24
24
|
|
|
25
25
|
let newHttpTimeout;
|
|
26
26
|
|
package/commands/config/set.js
CHANGED
|
@@ -54,7 +54,7 @@ exports.handler = async options => {
|
|
|
54
54
|
|
|
55
55
|
const accountId = getAccountId(options);
|
|
56
56
|
|
|
57
|
-
trackCommandUsage('config-set',
|
|
57
|
+
trackCommandUsage('config-set', null, accountId);
|
|
58
58
|
|
|
59
59
|
const configUpdated = await handleConfigUpdate(accountId, options);
|
|
60
60
|
|
package/commands/create.js
CHANGED
|
@@ -93,13 +93,9 @@ exports.handler = async options => {
|
|
|
93
93
|
|
|
94
94
|
if (asset.validate && !asset.validate(argsToPass)) return;
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
await asset.execute(argsToPass);
|
|
97
97
|
|
|
98
|
-
trackCommandUsage(
|
|
99
|
-
'create',
|
|
100
|
-
{ assetType, ...additionalTracking },
|
|
101
|
-
getAccountId(options)
|
|
102
|
-
);
|
|
98
|
+
trackCommandUsage('create', { assetType }, getAccountId(options));
|
|
103
99
|
};
|
|
104
100
|
|
|
105
101
|
exports.builder = yargs => {
|
|
@@ -32,7 +32,7 @@ exports.handler = async options => {
|
|
|
32
32
|
|
|
33
33
|
const accountId = getAccountId(options);
|
|
34
34
|
|
|
35
|
-
trackCommandUsage('filemanager-fetch',
|
|
35
|
+
trackCommandUsage('filemanager-fetch', null, accountId);
|
|
36
36
|
|
|
37
37
|
// Fetch and write file/folder.
|
|
38
38
|
await downloadFileOrFolder(accountId, src, dest, options);
|
|
@@ -50,7 +50,7 @@ exports.handler = async options => {
|
|
|
50
50
|
const splitFunctionPath = functionPath.split('.');
|
|
51
51
|
let spinner;
|
|
52
52
|
|
|
53
|
-
trackCommandUsage('functions-deploy',
|
|
53
|
+
trackCommandUsage('functions-deploy', null, accountId);
|
|
54
54
|
|
|
55
55
|
if (
|
|
56
56
|
!splitFunctionPath.length ||
|
|
@@ -29,10 +29,9 @@ exports.describe = i18n(`${i18nKey}.describe`);
|
|
|
29
29
|
exports.handler = async options => {
|
|
30
30
|
loadAndValidateOptions(options);
|
|
31
31
|
|
|
32
|
-
const { json, compact } = options;
|
|
33
32
|
const accountId = getAccountId(options);
|
|
34
33
|
|
|
35
|
-
trackCommandUsage('functions-list',
|
|
34
|
+
trackCommandUsage('functions-list', null, accountId);
|
|
36
35
|
|
|
37
36
|
logger.debug(i18n(`${i18nKey}.debug.gettingFunctions`));
|
|
38
37
|
|
|
@@ -21,7 +21,7 @@ exports.handler = async options => {
|
|
|
21
21
|
const { path: functionPath } = options;
|
|
22
22
|
const accountId = getAccountId(options);
|
|
23
23
|
|
|
24
|
-
trackCommandUsage('functions-server',
|
|
24
|
+
trackCommandUsage('functions-server', null, accountId);
|
|
25
25
|
|
|
26
26
|
logger.debug(
|
|
27
27
|
i18n(`${i18nKey}.debug.startingServer`, {
|
package/commands/hubdb/clear.js
CHANGED
|
@@ -26,7 +26,7 @@ exports.handler = async options => {
|
|
|
26
26
|
|
|
27
27
|
const accountId = getAccountId(options);
|
|
28
28
|
|
|
29
|
-
trackCommandUsage('hubdb-clear',
|
|
29
|
+
trackCommandUsage('hubdb-clear', null, accountId);
|
|
30
30
|
|
|
31
31
|
try {
|
|
32
32
|
const { deletedRowCount } = await clearHubDbTableRows(accountId, tableId);
|
package/commands/hubdb/create.js
CHANGED
package/commands/hubdb/delete.js
CHANGED
package/commands/hubdb/fetch.js
CHANGED
|
@@ -25,7 +25,7 @@ exports.handler = async options => {
|
|
|
25
25
|
|
|
26
26
|
const accountId = getAccountId(options);
|
|
27
27
|
|
|
28
|
-
trackCommandUsage('hubdb-fetch',
|
|
28
|
+
trackCommandUsage('hubdb-fetch', null, accountId);
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
31
|
const { filePath } = await downloadHubDbTable(accountId, tableId, dest);
|
package/commands/lint.js
CHANGED
package/commands/list.js
CHANGED
|
@@ -37,7 +37,7 @@ exports.handler = async options => {
|
|
|
37
37
|
const accountId = getAccountId(options);
|
|
38
38
|
let contentsResp;
|
|
39
39
|
|
|
40
|
-
trackCommandUsage('list',
|
|
40
|
+
trackCommandUsage('list', null, accountId);
|
|
41
41
|
|
|
42
42
|
logger.debug(
|
|
43
43
|
i18n(`${i18nKey}.gettingPathContents`, {
|
package/commands/mv.js
CHANGED
|
@@ -36,7 +36,7 @@ exports.handler = async options => {
|
|
|
36
36
|
const { srcPath, destPath } = options;
|
|
37
37
|
const accountId = getAccountId(options);
|
|
38
38
|
|
|
39
|
-
trackCommandUsage('mv',
|
|
39
|
+
trackCommandUsage('mv', null, accountId);
|
|
40
40
|
|
|
41
41
|
try {
|
|
42
42
|
await moveFile(accountId, srcPath, getCorrectedDestPath(srcPath, destPath));
|
package/commands/open.js
CHANGED
|
@@ -34,7 +34,7 @@ exports.handler = async options => {
|
|
|
34
34
|
const { shortcut, list } = options;
|
|
35
35
|
const accountId = getAccountId(options);
|
|
36
36
|
|
|
37
|
-
trackCommandUsage('open',
|
|
37
|
+
trackCommandUsage('open', null, accountId);
|
|
38
38
|
|
|
39
39
|
if (shortcut === undefined && !list) {
|
|
40
40
|
const choice = await createListPrompt(accountId);
|
package/commands/process.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const { createIgnoreFilter } = require('@hubspot/cli-lib/ignoreRules');
|
|
4
|
-
const { isAllowedExtension } = require('@hubspot/cli-lib
|
|
4
|
+
const { isAllowedExtension, getCwd } = require('@hubspot/cli-lib/path');
|
|
5
5
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
6
6
|
const { walk } = require('@hubspot/cli-lib/lib/walk');
|
|
7
7
|
const { getThemeJSONPath } = require('@hubspot/cli-lib/lib/files');
|
|
@@ -10,6 +10,8 @@ const {
|
|
|
10
10
|
FieldsJs,
|
|
11
11
|
isProcessableFieldsJs,
|
|
12
12
|
} = require('@hubspot/cli-lib/lib/handleFieldsJs');
|
|
13
|
+
|
|
14
|
+
const { trackProcessFieldsUsage } = require('../lib/usageTracking');
|
|
13
15
|
const i18nKey = 'cli.commands.process';
|
|
14
16
|
|
|
15
17
|
exports.command = 'process';
|
|
@@ -24,7 +26,7 @@ const invalidPath = src => {
|
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
exports.handler = async options => {
|
|
27
|
-
const src = options.src;
|
|
29
|
+
const src = path.resolve(getCwd(), options.src);
|
|
28
30
|
const projectRoot = path.dirname(getThemeJSONPath(src));
|
|
29
31
|
let stats;
|
|
30
32
|
try {
|
|
@@ -37,6 +39,8 @@ exports.handler = async options => {
|
|
|
37
39
|
invalidPath(src);
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
trackProcessFieldsUsage('process');
|
|
43
|
+
|
|
40
44
|
if (stats.isFile()) {
|
|
41
45
|
const fieldsJs = await new FieldsJs(
|
|
42
46
|
projectRoot,
|
|
@@ -14,6 +14,7 @@ const {
|
|
|
14
14
|
} = require('../../lib/prompts/createProjectPrompt');
|
|
15
15
|
const { createProjectConfig } = require('../../lib/projects');
|
|
16
16
|
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
17
|
+
const { PROJECT_TEMPLATES } = require('@hubspot/cli-lib/lib/constants');
|
|
17
18
|
const { uiFeatureHighlight } = require('../../lib/ui');
|
|
18
19
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
19
20
|
|
|
@@ -29,7 +30,7 @@ exports.handler = async options => {
|
|
|
29
30
|
|
|
30
31
|
const { name, template, location } = await createProjectPrompt(options);
|
|
31
32
|
|
|
32
|
-
trackCommandUsage('project-create',
|
|
33
|
+
trackCommandUsage('project-create', null, accountId);
|
|
33
34
|
|
|
34
35
|
await createProjectConfig(
|
|
35
36
|
path.resolve(getCwd(), options.location || location),
|
|
@@ -60,6 +61,7 @@ exports.builder = yargs => {
|
|
|
60
61
|
template: {
|
|
61
62
|
describe: i18n(`${i18nKey}.options.template.describe`),
|
|
62
63
|
type: 'string',
|
|
64
|
+
choices: PROJECT_TEMPLATES.map(template => template.name),
|
|
63
65
|
},
|
|
64
66
|
});
|
|
65
67
|
|
|
@@ -15,6 +15,7 @@ const { loadAndValidateOptions } = require('../../lib/validation');
|
|
|
15
15
|
const { getProjectConfig, pollDeployStatus } = require('../../lib/projects');
|
|
16
16
|
const { projectNamePrompt } = require('../../lib/prompts/projectNamePrompt');
|
|
17
17
|
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
18
|
+
// const { getAccountConfig } = require('@hubspot/cli-lib');
|
|
18
19
|
|
|
19
20
|
const i18nKey = 'cli.commands.project.subcommands.deploy';
|
|
20
21
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
@@ -26,9 +27,11 @@ exports.handler = async options => {
|
|
|
26
27
|
await loadAndValidateOptions(options);
|
|
27
28
|
|
|
28
29
|
const accountId = getAccountId(options);
|
|
30
|
+
// const accountConfig = getAccountConfig(accountId);
|
|
29
31
|
const { project, buildId } = options;
|
|
32
|
+
// const sandboxType = accountConfig && accountConfig.sandboxAccountType;
|
|
30
33
|
|
|
31
|
-
trackCommandUsage('project-deploy',
|
|
34
|
+
trackCommandUsage('project-deploy', null, accountId);
|
|
32
35
|
|
|
33
36
|
const { projectConfig } = await getProjectConfig();
|
|
34
37
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const chalk = require('chalk');
|
|
2
3
|
|
|
3
4
|
const {
|
|
4
5
|
getAccountId,
|
|
@@ -35,9 +36,22 @@ exports.handler = async options => {
|
|
|
35
36
|
const { name: projectName, dest, buildNumber } = options;
|
|
36
37
|
const accountId = getAccountId(options);
|
|
37
38
|
|
|
38
|
-
trackCommandUsage('project-download',
|
|
39
|
+
trackCommandUsage('project-download', null, accountId);
|
|
39
40
|
|
|
40
|
-
await ensureProjectExists(accountId, projectName, {
|
|
41
|
+
const projectExists = await ensureProjectExists(accountId, projectName, {
|
|
42
|
+
allowCreate: false,
|
|
43
|
+
noLogs: true,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (!projectExists) {
|
|
47
|
+
logger.error(
|
|
48
|
+
i18n(`${i18nKey}.errors.projectNotFound`, {
|
|
49
|
+
projectName: chalk.bold(projectName),
|
|
50
|
+
accountId: chalk.bold(accountId),
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
process.exit(EXIT_CODES.ERROR);
|
|
54
|
+
}
|
|
41
55
|
|
|
42
56
|
const absoluteDestPath = dest ? path.resolve(getCwd(), dest) : getCwd();
|
|
43
57
|
|
|
@@ -40,7 +40,7 @@ exports.handler = async options => {
|
|
|
40
40
|
const { path: projectPath, limit } = options;
|
|
41
41
|
const accountId = getAccountId(options);
|
|
42
42
|
|
|
43
|
-
trackCommandUsage('project-list-builds',
|
|
43
|
+
trackCommandUsage('project-list-builds', null, accountId);
|
|
44
44
|
|
|
45
45
|
const cwd = projectPath ? path.resolve(getCwd(), projectPath) : getCwd();
|
|
46
46
|
const { projectConfig, projectDir } = await getProjectConfig(cwd);
|
package/commands/project/logs.js
CHANGED
|
@@ -188,7 +188,7 @@ exports.handler = async options => {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
trackCommandUsage('project-logs',
|
|
191
|
+
trackCommandUsage('project-logs', null, accountId);
|
|
192
192
|
|
|
193
193
|
const logsInfo = [accountId, `"${projectName}"`];
|
|
194
194
|
let tableHeader;
|
|
@@ -276,18 +276,18 @@ exports.builder = yargs => {
|
|
|
276
276
|
describe: i18n(`${i18nKey}.options.compact.describe`),
|
|
277
277
|
type: 'boolean',
|
|
278
278
|
},
|
|
279
|
-
|
|
280
|
-
alias: ['t', '
|
|
281
|
-
describe: i18n(`${i18nKey}.options.
|
|
279
|
+
tail: {
|
|
280
|
+
alias: ['t', 'follow'],
|
|
281
|
+
describe: i18n(`${i18nKey}.options.tail.describe`),
|
|
282
282
|
type: 'boolean',
|
|
283
283
|
},
|
|
284
284
|
limit: {
|
|
285
|
-
alias: ['limit', 'n', 'max-count'],
|
|
286
285
|
describe: i18n(`${i18nKey}.options.limit.describe`),
|
|
287
286
|
type: 'number',
|
|
287
|
+
default: 10,
|
|
288
288
|
},
|
|
289
289
|
})
|
|
290
|
-
.conflicts('
|
|
290
|
+
.conflicts('tail', 'limit');
|
|
291
291
|
|
|
292
292
|
yargs.example([['$0 project logs', i18n(`${i18nKey}.examples.default`)]]);
|
|
293
293
|
yargs.example([
|
package/commands/project/open.js
CHANGED
|
@@ -29,7 +29,7 @@ exports.handler = async options => {
|
|
|
29
29
|
const accountId = getAccountId(options);
|
|
30
30
|
const { project } = options;
|
|
31
31
|
|
|
32
|
-
trackCommandUsage('project-open',
|
|
32
|
+
trackCommandUsage('project-open', null, accountId);
|
|
33
33
|
|
|
34
34
|
const { projectConfig } = await getProjectConfig();
|
|
35
35
|
|
|
@@ -18,6 +18,7 @@ const {
|
|
|
18
18
|
validateProjectConfig,
|
|
19
19
|
} = require('../../lib/projects');
|
|
20
20
|
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
21
|
+
// const { getAccountConfig } = require('@hubspot/cli-lib');
|
|
21
22
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
22
23
|
|
|
23
24
|
const i18nKey = 'cli.commands.project.subcommands.upload';
|
|
@@ -30,8 +31,10 @@ exports.handler = async options => {
|
|
|
30
31
|
|
|
31
32
|
const { forceCreate, path: projectPath } = options;
|
|
32
33
|
const accountId = getAccountId(options);
|
|
34
|
+
// const accountConfig = getAccountConfig(accountId);
|
|
35
|
+
// const sandboxType = accountConfig && accountConfig.sandboxAccountType;
|
|
33
36
|
|
|
34
|
-
trackCommandUsage('project-upload',
|
|
37
|
+
trackCommandUsage('project-upload', null, accountId);
|
|
35
38
|
|
|
36
39
|
const { projectConfig, projectDir } = await getProjectConfig(projectPath);
|
|
37
40
|
|
|
@@ -83,7 +83,7 @@ exports.handler = async options => {
|
|
|
83
83
|
const { initialUpload, path: projectPath } = options;
|
|
84
84
|
const accountId = getAccountId(options);
|
|
85
85
|
|
|
86
|
-
trackCommandUsage('project-watch',
|
|
86
|
+
trackCommandUsage('project-watch', null, accountId);
|
|
87
87
|
|
|
88
88
|
const { projectConfig, projectDir } = await getProjectConfig(projectPath);
|
|
89
89
|
|
package/commands/remove.js
CHANGED
|
@@ -120,7 +120,7 @@ exports.handler = async options => {
|
|
|
120
120
|
succeedColor: 'white',
|
|
121
121
|
});
|
|
122
122
|
|
|
123
|
-
trackCommandUsage('sandbox-create',
|
|
123
|
+
trackCommandUsage('sandbox-create', null, accountId);
|
|
124
124
|
|
|
125
125
|
let namePrompt;
|
|
126
126
|
|
|
@@ -151,8 +151,6 @@ exports.handler = async options => {
|
|
|
151
151
|
} catch (err) {
|
|
152
152
|
debugErrorAndContext(err);
|
|
153
153
|
|
|
154
|
-
trackCommandUsage('sandbox-create', { success: false }, accountId);
|
|
155
|
-
|
|
156
154
|
spinnies.fail('sandboxCreate', {
|
|
157
155
|
text: i18n(`${i18nKey}.loading.fail`, {
|
|
158
156
|
sandboxName,
|
|
@@ -49,7 +49,7 @@ exports.handler = async options => {
|
|
|
49
49
|
account: account || accountPrompt.account,
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
trackCommandUsage('sandbox-delete',
|
|
52
|
+
trackCommandUsage('sandbox-delete', null, sandboxAccountId);
|
|
53
53
|
|
|
54
54
|
let parentAccountId;
|
|
55
55
|
for (const portal of config.portals) {
|
|
@@ -126,8 +126,6 @@ exports.handler = async options => {
|
|
|
126
126
|
} catch (err) {
|
|
127
127
|
debugErrorAndContext(err);
|
|
128
128
|
|
|
129
|
-
trackCommandUsage('sandbox-delete', { success: false }, sandboxAccountId);
|
|
130
|
-
|
|
131
129
|
if (
|
|
132
130
|
err.error &&
|
|
133
131
|
err.error.category === OBJECT_NOT_FOUND &&
|
|
@@ -28,7 +28,7 @@ exports.handler = async options => {
|
|
|
28
28
|
await loadAndValidateOptions(options);
|
|
29
29
|
|
|
30
30
|
const accountId = getAccountId(options);
|
|
31
|
-
trackCommandUsage('secrets-add',
|
|
31
|
+
trackCommandUsage('secrets-add', null, accountId);
|
|
32
32
|
|
|
33
33
|
try {
|
|
34
34
|
const { secretValue } = await secretValuePrompt();
|
|
@@ -27,7 +27,7 @@ exports.handler = async options => {
|
|
|
27
27
|
await loadAndValidateOptions(options);
|
|
28
28
|
|
|
29
29
|
const accountId = getAccountId(options);
|
|
30
|
-
trackCommandUsage('secrets-delete',
|
|
30
|
+
trackCommandUsage('secrets-delete', null, accountId);
|
|
31
31
|
|
|
32
32
|
try {
|
|
33
33
|
await deleteSecret(accountId, secretName);
|
|
@@ -25,7 +25,7 @@ exports.handler = async options => {
|
|
|
25
25
|
await loadAndValidateOptions(options);
|
|
26
26
|
|
|
27
27
|
const accountId = getAccountId(options);
|
|
28
|
-
trackCommandUsage('secrets-list',
|
|
28
|
+
trackCommandUsage('secrets-list', null, accountId);
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
31
|
const { results } = await fetchSecrets(accountId);
|
|
@@ -28,7 +28,7 @@ exports.handler = async options => {
|
|
|
28
28
|
await loadAndValidateOptions(options);
|
|
29
29
|
|
|
30
30
|
const accountId = getAccountId(options);
|
|
31
|
-
trackCommandUsage('secrets-update',
|
|
31
|
+
trackCommandUsage('secrets-update', null, accountId);
|
|
32
32
|
|
|
33
33
|
try {
|
|
34
34
|
const { secretValue } = await secretValuePrompt();
|
package/lib/projects.js
CHANGED
|
@@ -115,7 +115,7 @@ const createProjectConfig = async (projectPath, projectName, template) => {
|
|
|
115
115
|
}`
|
|
116
116
|
);
|
|
117
117
|
|
|
118
|
-
if (template === '
|
|
118
|
+
if (template === 'no-template') {
|
|
119
119
|
fs.ensureDirSync(path.join(projectPath, 'src'));
|
|
120
120
|
|
|
121
121
|
writeProjectConfig(projectConfigPath, {
|
|
@@ -47,18 +47,12 @@ const createProjectPrompt = (promptOptions = {}) => {
|
|
|
47
47
|
!promptOptions.template ||
|
|
48
48
|
!PROJECT_TEMPLATES.find(t => t.name === promptOptions.template),
|
|
49
49
|
type: 'list',
|
|
50
|
-
choices:
|
|
51
|
-
{
|
|
52
|
-
name:
|
|
53
|
-
value:
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
name: template.label,
|
|
58
|
-
value: template.name,
|
|
59
|
-
};
|
|
60
|
-
}),
|
|
61
|
-
],
|
|
50
|
+
choices: PROJECT_TEMPLATES.map(template => {
|
|
51
|
+
return {
|
|
52
|
+
name: template.label,
|
|
53
|
+
value: template.name,
|
|
54
|
+
};
|
|
55
|
+
}),
|
|
62
56
|
},
|
|
63
57
|
]);
|
|
64
58
|
};
|
package/lib/ui.js
CHANGED
|
@@ -37,10 +37,11 @@ const getTerminalUISupport = () => {
|
|
|
37
37
|
*/
|
|
38
38
|
const uiLink = (linkText, url) => {
|
|
39
39
|
const terminalUISupport = getTerminalUISupport();
|
|
40
|
+
const encodedUrl = encodeURI(url);
|
|
40
41
|
if (terminalUISupport.hyperlinks) {
|
|
41
42
|
const result = [
|
|
42
43
|
'\u001B]8;;',
|
|
43
|
-
|
|
44
|
+
encodedUrl,
|
|
44
45
|
'\u0007',
|
|
45
46
|
linkText,
|
|
46
47
|
'\u001B]8;;\u0007',
|
|
@@ -48,8 +49,8 @@ const uiLink = (linkText, url) => {
|
|
|
48
49
|
return terminalUISupport.color ? chalk.cyan(result) : result;
|
|
49
50
|
} else {
|
|
50
51
|
return terminalUISupport.color
|
|
51
|
-
? `${linkText}: ${chalk.cyan(
|
|
52
|
-
: `${linkText}: ${
|
|
52
|
+
? `${linkText}: ${chalk.cyan(encodedUrl)}`
|
|
53
|
+
: `${linkText}: ${encodedUrl}`;
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
56
|
|
package/lib/usageTracking.js
CHANGED
|
@@ -78,6 +78,24 @@ async function trackHelpUsage(command) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
async function trackProcessFieldsUsage(command) {
|
|
82
|
+
if (!isTrackingAllowed()) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
logger.debug('Attempting to track usage of "%s" command', command);
|
|
87
|
+
await trackUsage('cli-interaction', EventClass.INTERACTION, {
|
|
88
|
+
action: 'cli-process-fields',
|
|
89
|
+
os: getPlatform(),
|
|
90
|
+
...getNodeVersionData(),
|
|
91
|
+
version,
|
|
92
|
+
command,
|
|
93
|
+
});
|
|
94
|
+
} catch (e) {
|
|
95
|
+
logger.debug('Usage tracking failed: %s', e.message);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
81
99
|
const addHelpUsageTracking = (program, command) => {
|
|
82
100
|
program.on('--help', () => {
|
|
83
101
|
setLogLevel(program);
|
|
@@ -118,5 +136,6 @@ module.exports = {
|
|
|
118
136
|
trackCommandUsage,
|
|
119
137
|
trackHelpUsage,
|
|
120
138
|
addHelpUsageTracking,
|
|
139
|
+
trackProcessFieldsUsage,
|
|
121
140
|
trackAuthAction,
|
|
122
141
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "4.0.2-beta.
|
|
3
|
+
"version": "4.0.2-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": "4.0.2-beta.
|
|
12
|
-
"@hubspot/serverless-dev-runtime": "4.0.2-beta.
|
|
11
|
+
"@hubspot/cli-lib": "4.0.2-beta.4",
|
|
12
|
+
"@hubspot/serverless-dev-runtime": "4.0.2-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": "
|
|
40
|
+
"gitHead": "56347c4026ac958b9a721ed0057b68c7c4c4918d"
|
|
41
41
|
}
|