@hubspot/cli 3.0.9 → 3.0.10-beta.11
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/README.md +6 -0
- package/bin/cli.js +3 -2
- package/commands/accounts/list.js +18 -26
- package/commands/accounts/rename.js +13 -24
- package/commands/accounts.js +4 -1
- package/commands/app/deploy.js +22 -28
- package/commands/auth.js +30 -13
- package/commands/config/set/allowUsageTracking.js +15 -31
- package/commands/config/set/defaultAccount.js +22 -32
- package/commands/config/set/defaultMode.js +23 -42
- package/commands/config/set/httpTimeout.js +10 -28
- package/commands/config/set.js +4 -1
- package/commands/config.js +4 -1
- package/commands/create/api-sample.js +14 -12
- package/commands/create/module.js +19 -6
- package/commands/create/project.js +8 -1
- package/commands/create/template.js +19 -4
- package/commands/create.js +23 -8
- package/commands/customObject/create.js +22 -24
- package/commands/customObject/schema/create.js +30 -28
- package/commands/customObject/schema/delete.js +20 -20
- package/commands/customObject/schema/fetch-all.js +17 -24
- package/commands/customObject/schema/fetch.js +29 -24
- package/commands/customObject/schema/list.js +8 -17
- package/commands/customObject/schema/update.js +31 -29
- package/commands/customObject/schema.js +4 -1
- package/commands/customObject.js +10 -21
- package/commands/fetch.js +15 -30
- package/commands/filemanager/fetch.js +13 -25
- package/commands/filemanager/upload.js +47 -35
- package/commands/filemanager.js +4 -1
- package/commands/functions/deploy.js +34 -37
- package/commands/functions/list.js +9 -24
- package/commands/functions/server.js +13 -29
- package/commands/functions.js +4 -1
- package/commands/hubdb/clear.js +25 -21
- package/commands/hubdb/create.js +25 -22
- package/commands/hubdb/delete.js +19 -20
- package/commands/hubdb/fetch.js +15 -20
- package/commands/hubdb.js +4 -1
- package/commands/init.js +23 -11
- package/commands/lint.js +14 -23
- package/commands/list.js +19 -25
- package/commands/logs.js +41 -135
- package/commands/mv.js +21 -25
- package/commands/open.js +7 -5
- package/commands/project/create.js +111 -0
- package/commands/project/deploy.js +30 -34
- package/commands/project/listBuilds.js +160 -0
- package/commands/project/logs.js +192 -0
- package/commands/project/upload.js +108 -55
- package/commands/project.js +7 -8
- package/commands/remove.js +12 -20
- package/commands/sandbox/create.js +16 -11
- package/commands/secrets/addSecret.js +18 -21
- package/commands/secrets/deleteSecret.js +18 -21
- package/commands/secrets/listSecrets.js +10 -19
- package/commands/secrets/updateSecret.js +18 -21
- package/commands/secrets.js +4 -1
- package/commands/server.js +13 -5
- package/commands/{marketplaceValidate/validateTheme.js → theme/marketplace-validate.js} +26 -24
- package/commands/theme.js +5 -3
- package/commands/upload.js +66 -45
- package/commands/watch.js +33 -55
- package/lib/__tests__/serverlessLogs.js +8 -9
- package/lib/commonOpts.js +14 -11
- package/lib/enums/exitCodes.js +14 -0
- package/lib/projects.js +246 -235
- package/lib/prompts/projects.js +8 -5
- package/lib/prompts/sandboxes.js +5 -2
- package/lib/prompts.js +26 -27
- package/lib/serverlessLogs.js +11 -12
- package/lib/ui.js +48 -0
- package/lib/validation.js +2 -1
- package/package.json +9 -7
- package/commands/project/init.js +0 -108
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
const {
|
|
2
|
-
loadConfig,
|
|
3
|
-
validateConfig,
|
|
4
|
-
checkAndWarnGitInclusion,
|
|
5
|
-
} = require('@hubspot/cli-lib');
|
|
6
1
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
7
2
|
const { logErrorInstance } = require('@hubspot/cli-lib/errorHandlers');
|
|
8
3
|
|
|
9
|
-
const {
|
|
4
|
+
const { loadAndValidateOptions } = require('../../../lib/validation');
|
|
10
5
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
11
|
-
const {
|
|
12
|
-
const { logDebugInfo } = require('../../../lib/debugInfo');
|
|
6
|
+
const { getAccountId } = require('../../../lib/commonOpts');
|
|
13
7
|
const { deleteSchema } = require('@hubspot/cli-lib/api/schema');
|
|
8
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
9
|
+
|
|
10
|
+
const i18nKey =
|
|
11
|
+
'cli.commands.customObject.subcommands.schema.subcommands.delete';
|
|
14
12
|
|
|
15
13
|
exports.command = 'delete <name>';
|
|
16
|
-
exports.describe =
|
|
14
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
17
15
|
|
|
18
16
|
exports.handler = async options => {
|
|
19
17
|
let { name } = options;
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
logDebugInfo(options);
|
|
23
|
-
loadConfig(options.config);
|
|
24
|
-
checkAndWarnGitInclusion();
|
|
19
|
+
await loadAndValidateOptions(options);
|
|
25
20
|
|
|
26
|
-
if (!(validateConfig() && (await validateAccount(options)))) {
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
21
|
const accountId = getAccountId(options);
|
|
30
22
|
|
|
31
23
|
trackCommandUsage('custom-object-schema-delete', null, accountId);
|
|
32
24
|
|
|
33
25
|
try {
|
|
34
26
|
await deleteSchema(accountId, name);
|
|
35
|
-
logger.success(
|
|
27
|
+
logger.success(
|
|
28
|
+
i18n(`${i18nKey}.success.delete`, {
|
|
29
|
+
name,
|
|
30
|
+
})
|
|
31
|
+
);
|
|
36
32
|
} catch (e) {
|
|
37
33
|
logErrorInstance(e);
|
|
38
|
-
logger.error(
|
|
34
|
+
logger.error(
|
|
35
|
+
i18n(`${i18nKey}.errors.delete`, {
|
|
36
|
+
name,
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
exports.builder = yargs => {
|
|
43
43
|
yargs.example([
|
|
44
|
-
['$0 schema delete schemaName',
|
|
44
|
+
['$0 schema delete schemaName', i18n(`${i18nKey}.examples.default`)],
|
|
45
45
|
]);
|
|
46
46
|
|
|
47
47
|
yargs.positional('name', {
|
|
48
|
-
describe:
|
|
48
|
+
describe: i18n(`${i18nKey}.positionals.name.describe`),
|
|
49
49
|
type: 'string',
|
|
50
50
|
});
|
|
51
51
|
};
|
|
@@ -1,56 +1,49 @@
|
|
|
1
|
-
const {
|
|
2
|
-
loadConfig,
|
|
3
|
-
validateConfig,
|
|
4
|
-
checkAndWarnGitInclusion,
|
|
5
|
-
} = require('@hubspot/cli-lib');
|
|
6
1
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
7
2
|
const { logErrorInstance } = require('@hubspot/cli-lib/errorHandlers');
|
|
8
3
|
|
|
9
|
-
const {
|
|
4
|
+
const { loadAndValidateOptions } = require('../../../lib/validation');
|
|
10
5
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
11
|
-
const {
|
|
12
|
-
const { logDebugInfo } = require('../../../lib/debugInfo');
|
|
6
|
+
const { getAccountId } = require('../../../lib/commonOpts');
|
|
13
7
|
const { downloadSchemas, getResolvedPath } = require('@hubspot/cli-lib/schema');
|
|
8
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
9
|
+
|
|
10
|
+
const i18nKey =
|
|
11
|
+
'cli.commands.customObject.subcommands.schema.subcommands.fetchAll';
|
|
14
12
|
|
|
15
13
|
exports.command = 'fetch-all [dest]';
|
|
16
|
-
exports.describe =
|
|
14
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
17
15
|
|
|
18
16
|
exports.handler = async options => {
|
|
19
|
-
|
|
20
|
-
logDebugInfo(options);
|
|
21
|
-
loadConfig(options.config);
|
|
22
|
-
checkAndWarnGitInclusion();
|
|
17
|
+
await loadAndValidateOptions(options);
|
|
23
18
|
|
|
24
|
-
if (!(validateConfig() && (await validateAccount(options)))) {
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
19
|
const accountId = getAccountId(options);
|
|
28
20
|
|
|
29
21
|
trackCommandUsage('custom-object-schema-fetch-all', null, accountId);
|
|
30
22
|
|
|
31
23
|
try {
|
|
32
24
|
await downloadSchemas(accountId, options.dest);
|
|
33
|
-
logger.success(
|
|
25
|
+
logger.success(
|
|
26
|
+
i18n(`${i18nKey}.success.fetch`, {
|
|
27
|
+
path: getResolvedPath(options.dest),
|
|
28
|
+
})
|
|
29
|
+
);
|
|
34
30
|
} catch (e) {
|
|
35
31
|
logErrorInstance(e);
|
|
36
|
-
logger.error(
|
|
32
|
+
logger.error(i18n(`${i18nKey}.errors.fetch`));
|
|
37
33
|
}
|
|
38
34
|
};
|
|
39
35
|
|
|
40
36
|
exports.builder = yargs => {
|
|
41
37
|
yargs.example([
|
|
42
|
-
[
|
|
43
|
-
'$0 custom-object schema fetch-all',
|
|
44
|
-
'Fetch all schemas for an account and put them in the current working directory',
|
|
45
|
-
],
|
|
38
|
+
['$0 custom-object schema fetch-all', i18n(`${i18nKey}.examples.default`)],
|
|
46
39
|
[
|
|
47
40
|
'$0 custom-object schema fetch-all my/folder',
|
|
48
|
-
|
|
41
|
+
i18n(`${i18nKey}.examples.specifyPath`),
|
|
49
42
|
],
|
|
50
43
|
]);
|
|
51
44
|
|
|
52
45
|
yargs.positional('dest', {
|
|
53
|
-
describe:
|
|
46
|
+
describe: i18n(`${i18nKey}.positionals.dest.describe`),
|
|
54
47
|
type: 'string',
|
|
55
48
|
});
|
|
56
49
|
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
-
const {
|
|
3
|
-
loadConfig,
|
|
4
|
-
validateConfig,
|
|
5
|
-
checkAndWarnGitInclusion,
|
|
6
|
-
isConfigFlagEnabled,
|
|
7
|
-
} = require('@hubspot/cli-lib');
|
|
2
|
+
const { isConfigFlagEnabled } = require('@hubspot/cli-lib');
|
|
8
3
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
9
4
|
const { logErrorInstance } = require('@hubspot/cli-lib/errorHandlers');
|
|
10
5
|
const { ConfigFlags } = require('@hubspot/cli-lib/lib/constants');
|
|
@@ -12,25 +7,22 @@ const { downloadSchema, getResolvedPath } = require('@hubspot/cli-lib/schema');
|
|
|
12
7
|
const { fetchSchema } = require('@hubspot/cli-lib/api/fileTransport');
|
|
13
8
|
const { getCwd } = require('@hubspot/cli-lib/path');
|
|
14
9
|
|
|
15
|
-
const {
|
|
10
|
+
const { loadAndValidateOptions } = require('../../../lib/validation');
|
|
16
11
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
17
|
-
const {
|
|
18
|
-
const {
|
|
12
|
+
const { getAccountId } = require('../../../lib/commonOpts');
|
|
13
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
14
|
+
|
|
15
|
+
const i18nKey =
|
|
16
|
+
'cli.commands.customObject.subcommands.schema.subcommands.fetch';
|
|
19
17
|
|
|
20
18
|
exports.command = 'fetch <name> [dest]';
|
|
21
|
-
exports.describe =
|
|
19
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
22
20
|
|
|
23
21
|
exports.handler = async options => {
|
|
24
22
|
let { name, dest } = options;
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
logDebugInfo(options);
|
|
28
|
-
loadConfig(options.config);
|
|
29
|
-
checkAndWarnGitInclusion();
|
|
24
|
+
await loadAndValidateOptions(options);
|
|
30
25
|
|
|
31
|
-
if (!(validateConfig() && (await validateAccount(options)))) {
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
26
|
const accountId = getAccountId(options);
|
|
35
27
|
|
|
36
28
|
trackCommandUsage('custom-object-schema-fetch', null, accountId);
|
|
@@ -39,14 +31,27 @@ exports.handler = async options => {
|
|
|
39
31
|
if (isConfigFlagEnabled(ConfigFlags.USE_CUSTOM_OBJECT_HUBFILE)) {
|
|
40
32
|
const fullpath = path.resolve(getCwd(), dest);
|
|
41
33
|
await fetchSchema(accountId, name, fullpath);
|
|
42
|
-
logger.success(
|
|
34
|
+
logger.success(
|
|
35
|
+
i18n(`${i18nKey}.success.save`, {
|
|
36
|
+
name,
|
|
37
|
+
path: fullpath,
|
|
38
|
+
})
|
|
39
|
+
);
|
|
43
40
|
} else {
|
|
44
41
|
await downloadSchema(accountId, name, dest);
|
|
45
|
-
logger.success(
|
|
42
|
+
logger.success(
|
|
43
|
+
i18n(`${i18nKey}.success.savedToPath`, {
|
|
44
|
+
path: getResolvedPath(dest, name),
|
|
45
|
+
})
|
|
46
|
+
);
|
|
46
47
|
}
|
|
47
48
|
} catch (e) {
|
|
48
49
|
logErrorInstance(e);
|
|
49
|
-
logger.error(
|
|
50
|
+
logger.error(
|
|
51
|
+
i18n(`${i18nKey}.errors.fetch`, {
|
|
52
|
+
name,
|
|
53
|
+
})
|
|
54
|
+
);
|
|
50
55
|
}
|
|
51
56
|
};
|
|
52
57
|
|
|
@@ -54,21 +59,21 @@ exports.builder = yargs => {
|
|
|
54
59
|
yargs.example([
|
|
55
60
|
[
|
|
56
61
|
'$0 custom-object schema fetch schemaName',
|
|
57
|
-
|
|
62
|
+
i18n(`${i18nKey}.examples.default`),
|
|
58
63
|
],
|
|
59
64
|
[
|
|
60
65
|
'$0 custom-object schema fetch schemaName my/folder',
|
|
61
|
-
|
|
66
|
+
i18n(`${i18nKey}.examples.specifyPath`),
|
|
62
67
|
],
|
|
63
68
|
]);
|
|
64
69
|
|
|
65
70
|
yargs.positional('name', {
|
|
66
|
-
describe:
|
|
71
|
+
describe: i18n(`${i18nKey}.positionals.name.describe`),
|
|
67
72
|
type: 'string',
|
|
68
73
|
});
|
|
69
74
|
|
|
70
75
|
yargs.positional('dest', {
|
|
71
|
-
describe:
|
|
76
|
+
describe: i18n(`${i18nKey}.positionals.dest.describe`),
|
|
72
77
|
type: 'string',
|
|
73
78
|
});
|
|
74
79
|
};
|
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
const {
|
|
2
|
-
loadConfig,
|
|
3
|
-
validateConfig,
|
|
4
|
-
checkAndWarnGitInclusion,
|
|
5
|
-
} = require('@hubspot/cli-lib');
|
|
6
1
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
7
2
|
const { logErrorInstance } = require('@hubspot/cli-lib/errorHandlers');
|
|
8
3
|
|
|
9
|
-
const {
|
|
4
|
+
const { loadAndValidateOptions } = require('../../../lib/validation');
|
|
10
5
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
11
|
-
const {
|
|
12
|
-
const { logDebugInfo } = require('../../../lib/debugInfo');
|
|
6
|
+
const { getAccountId } = require('../../../lib/commonOpts');
|
|
13
7
|
const { listSchemas } = require('@hubspot/cli-lib/schema');
|
|
8
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
9
|
+
|
|
10
|
+
const i18nKey = 'cli.commands.customObject.subcommands.schema.subcommands.list';
|
|
14
11
|
|
|
15
12
|
exports.command = 'list';
|
|
16
|
-
exports.describe =
|
|
13
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
17
14
|
|
|
18
15
|
exports.handler = async options => {
|
|
19
|
-
|
|
20
|
-
logDebugInfo(options);
|
|
21
|
-
loadConfig(options.config);
|
|
22
|
-
checkAndWarnGitInclusion();
|
|
16
|
+
await loadAndValidateOptions(options);
|
|
23
17
|
|
|
24
|
-
if (!(validateConfig() && (await validateAccount(options)))) {
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
18
|
const accountId = getAccountId(options);
|
|
28
19
|
|
|
29
20
|
trackCommandUsage('custom-object-schema-list', null, accountId);
|
|
@@ -32,6 +23,6 @@ exports.handler = async options => {
|
|
|
32
23
|
await listSchemas(accountId);
|
|
33
24
|
} catch (e) {
|
|
34
25
|
logErrorInstance(e);
|
|
35
|
-
logger.error(
|
|
26
|
+
logger.error(i18n(`${i18nKey}.errors.list`));
|
|
36
27
|
}
|
|
37
28
|
};
|
|
@@ -1,65 +1,67 @@
|
|
|
1
|
-
const {
|
|
2
|
-
loadConfig,
|
|
3
|
-
validateConfig,
|
|
4
|
-
checkAndWarnGitInclusion,
|
|
5
|
-
} = require('@hubspot/cli-lib');
|
|
6
1
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
7
2
|
const { logErrorInstance } = require('@hubspot/cli-lib/errorHandlers');
|
|
8
3
|
const { getAbsoluteFilePath } = require('@hubspot/cli-lib/path');
|
|
9
|
-
const { validateAccount, isFileValidJSON } = require('../../../lib/validation');
|
|
10
|
-
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
11
4
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} = require('../../../lib/
|
|
5
|
+
isFileValidJSON,
|
|
6
|
+
loadAndValidateOptions,
|
|
7
|
+
} = require('../../../lib/validation');
|
|
8
|
+
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
9
|
+
const { addTestingOptions, getAccountId } = require('../../../lib/commonOpts');
|
|
16
10
|
const { ENVIRONMENTS, ConfigFlags } = require('@hubspot/cli-lib/lib/constants');
|
|
17
11
|
const { getEnv, isConfigFlagEnabled } = require('@hubspot/cli-lib');
|
|
18
|
-
const { logDebugInfo } = require('../../../lib/debugInfo');
|
|
19
12
|
const { updateSchema } = require('@hubspot/cli-lib/api/schema');
|
|
20
13
|
const {
|
|
21
14
|
updateSchema: updateSchemaFromHubFile,
|
|
22
15
|
} = require('@hubspot/cli-lib/api/fileTransport');
|
|
23
16
|
const { getHubSpotWebsiteOrigin } = require('@hubspot/cli-lib/lib/urls');
|
|
17
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
18
|
+
|
|
19
|
+
const i18nKey =
|
|
20
|
+
'cli.commands.customObject.subcommands.schema.subcommands.update';
|
|
21
|
+
const { EXIT_CODES } = require('../../../lib/enums/exitCodes');
|
|
24
22
|
|
|
25
23
|
exports.command = 'update <name> <definition>';
|
|
26
|
-
exports.describe =
|
|
24
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
27
25
|
|
|
28
26
|
exports.handler = async options => {
|
|
29
27
|
const { definition, name } = options;
|
|
30
|
-
setLogLevel(options);
|
|
31
|
-
logDebugInfo(options);
|
|
32
|
-
const { config: configPath } = options;
|
|
33
|
-
loadConfig(configPath);
|
|
34
|
-
checkAndWarnGitInclusion();
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
29
|
+
await loadAndValidateOptions(options);
|
|
30
|
+
|
|
39
31
|
const accountId = getAccountId(options);
|
|
40
32
|
|
|
41
33
|
trackCommandUsage('custom-object-schema-update', null, accountId);
|
|
42
34
|
|
|
43
35
|
const filePath = getAbsoluteFilePath(definition);
|
|
44
36
|
if (!isFileValidJSON(filePath)) {
|
|
45
|
-
process.exit(
|
|
37
|
+
process.exit(EXIT_CODES.ERROR);
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
try {
|
|
49
41
|
if (isConfigFlagEnabled(ConfigFlags.USE_CUSTOM_OBJECT_HUBFILE)) {
|
|
50
42
|
await updateSchemaFromHubFile(accountId, filePath);
|
|
51
|
-
logger.success(
|
|
43
|
+
logger.success(
|
|
44
|
+
i18n(`${i18nKey}.success.update`, {
|
|
45
|
+
accountId,
|
|
46
|
+
})
|
|
47
|
+
);
|
|
52
48
|
} else {
|
|
53
49
|
const res = await updateSchema(accountId, name, filePath);
|
|
54
50
|
logger.success(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
i18n(`${i18nKey}.success.viewAtUrl`, {
|
|
52
|
+
url: `${getHubSpotWebsiteOrigin(
|
|
53
|
+
getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD
|
|
54
|
+
)}/contacts/${accountId}/objects/${res.objectTypeId}`,
|
|
55
|
+
})
|
|
58
56
|
);
|
|
59
57
|
}
|
|
60
58
|
} catch (e) {
|
|
61
59
|
logErrorInstance(e, { accountId });
|
|
62
|
-
logger.error(
|
|
60
|
+
logger.error(
|
|
61
|
+
i18n(`${i18nKey}.errors.update`, {
|
|
62
|
+
definition,
|
|
63
|
+
})
|
|
64
|
+
);
|
|
63
65
|
}
|
|
64
66
|
};
|
|
65
67
|
|
|
@@ -67,12 +69,12 @@ exports.builder = yargs => {
|
|
|
67
69
|
addTestingOptions(yargs, true);
|
|
68
70
|
|
|
69
71
|
yargs.positional('name', {
|
|
70
|
-
describe:
|
|
72
|
+
describe: i18n(`${i18nKey}.positionals.name.describe`),
|
|
71
73
|
type: 'string',
|
|
72
74
|
});
|
|
73
75
|
|
|
74
76
|
yargs.positional('definition', {
|
|
75
|
-
describe:
|
|
77
|
+
describe: i18n(`${i18nKey}.positionals.definition.describe`),
|
|
76
78
|
type: 'string',
|
|
77
79
|
});
|
|
78
80
|
};
|
|
@@ -4,9 +4,12 @@ const fetchAllCommand = require('./schema/fetch-all');
|
|
|
4
4
|
const deleteCommand = require('./schema/delete');
|
|
5
5
|
const listCommand = require('./schema/list');
|
|
6
6
|
const updateSchema = require('./schema/update');
|
|
7
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
8
|
+
|
|
9
|
+
const i18nKey = 'cli.commands.customObject.subcommands.schema';
|
|
7
10
|
|
|
8
11
|
exports.command = 'schema';
|
|
9
|
-
exports.describe =
|
|
12
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
10
13
|
exports.builder = yargs => {
|
|
11
14
|
yargs
|
|
12
15
|
.command(listCommand)
|
package/commands/customObject.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
const { addConfigOptions, addAccountOptions } = require('../lib/commonOpts');
|
|
2
2
|
const schemaCommand = require('./customObject/schema');
|
|
3
3
|
const createCommand = require('./customObject/create');
|
|
4
|
-
const
|
|
4
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
5
|
+
|
|
6
|
+
const i18nKey = 'cli.commands.customObject';
|
|
5
7
|
|
|
6
8
|
exports.command = ['custom-object', 'custom', 'co'];
|
|
7
|
-
exports.describe =
|
|
8
|
-
'Manage Custom Objects. This feature is currently in beta and the CLI contract is subject to change';
|
|
9
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
9
10
|
|
|
10
11
|
exports.builder = yargs => {
|
|
11
12
|
addConfigOptions(yargs, true);
|
|
@@ -16,26 +17,14 @@ exports.builder = yargs => {
|
|
|
16
17
|
.command(createCommand)
|
|
17
18
|
.demandCommand(1, '');
|
|
18
19
|
|
|
20
|
+
console.warn(i18n(`${i18nKey}.warning`));
|
|
21
|
+
console.warn(i18n(`${i18nKey}.betaMessage`));
|
|
19
22
|
console.warn(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
)
|
|
23
|
-
);
|
|
24
|
-
console.warn(
|
|
25
|
-
chalk.reset.yellow(
|
|
26
|
-
'The Custom Object CLI is currently in beta and is subject to change.'
|
|
27
|
-
)
|
|
28
|
-
);
|
|
29
|
-
console.warn(
|
|
30
|
-
chalk.reset.yellow(
|
|
31
|
-
'See https://developers.hubspot.com/docs/api/crm/crm-custom-objects to find out more.'
|
|
32
|
-
)
|
|
33
|
-
);
|
|
34
|
-
console.warn(
|
|
35
|
-
chalk.reset.yellow(
|
|
36
|
-
'***************************** WARNING WARNING WARNING ****************************'
|
|
37
|
-
)
|
|
23
|
+
i18n(`${i18nKey}.seeMoreLink`, {
|
|
24
|
+
link: 'https://developers.hubspot.com/docs/api/crm/crm-custom-objects',
|
|
25
|
+
})
|
|
38
26
|
);
|
|
27
|
+
console.warn(i18n(`${i18nKey}.warning`));
|
|
39
28
|
|
|
40
29
|
return yargs;
|
|
41
30
|
};
|
package/commands/fetch.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
const { downloadFileOrFolder } = require('@hubspot/cli-lib/fileMapper');
|
|
2
|
-
const {
|
|
3
|
-
loadConfig,
|
|
4
|
-
validateConfig,
|
|
5
|
-
checkAndWarnGitInclusion,
|
|
6
|
-
} = require('@hubspot/cli-lib');
|
|
7
2
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
8
3
|
|
|
9
4
|
const {
|
|
@@ -14,39 +9,30 @@ const {
|
|
|
14
9
|
addUseEnvironmentOptions,
|
|
15
10
|
getAccountId,
|
|
16
11
|
getMode,
|
|
17
|
-
setLogLevel,
|
|
18
12
|
} = require('../lib/commonOpts');
|
|
19
13
|
const { resolveLocalPath } = require('../lib/filesystem');
|
|
20
|
-
const {
|
|
21
|
-
const { logDebugInfo } = require('../lib/debugInfo');
|
|
14
|
+
const { validateMode, loadAndValidateOptions } = require('../lib/validation');
|
|
22
15
|
const { trackCommandUsage } = require('../lib/usageTracking');
|
|
16
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
17
|
+
|
|
18
|
+
const i18nKey = 'cli.commands.fetch';
|
|
19
|
+
const { EXIT_CODES } = require('../lib/enums/exitCodes');
|
|
23
20
|
|
|
24
21
|
exports.command = 'fetch <src> [dest]';
|
|
25
|
-
exports.describe =
|
|
26
|
-
'Fetch a file, directory or module from HubSpot and write to a path on your computer';
|
|
22
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
27
23
|
|
|
28
24
|
exports.handler = async options => {
|
|
29
|
-
const {
|
|
30
|
-
|
|
31
|
-
setLogLevel(options);
|
|
32
|
-
logDebugInfo(options);
|
|
25
|
+
const { src, dest } = options;
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
checkAndWarnGitInclusion();
|
|
27
|
+
await loadAndValidateOptions(options);
|
|
36
28
|
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
validateConfig() &&
|
|
40
|
-
(await validateAccount(options)) &&
|
|
41
|
-
validateMode(options)
|
|
42
|
-
)
|
|
43
|
-
) {
|
|
44
|
-
process.exit(1);
|
|
29
|
+
if (!validateMode(options)) {
|
|
30
|
+
process.exit(EXIT_CODES.ERROR);
|
|
45
31
|
}
|
|
46
32
|
|
|
47
33
|
if (typeof src !== 'string') {
|
|
48
|
-
logger.error(
|
|
49
|
-
process.exit(
|
|
34
|
+
logger.error(i18n(`${i18nKey}.errors.sourceRequired`));
|
|
35
|
+
process.exit(EXIT_CODES.ERROR);
|
|
50
36
|
}
|
|
51
37
|
|
|
52
38
|
const accountId = getAccountId(options);
|
|
@@ -72,19 +58,18 @@ exports.builder = yargs => {
|
|
|
72
58
|
addUseEnvironmentOptions(yargs, true);
|
|
73
59
|
|
|
74
60
|
yargs.positional('src', {
|
|
75
|
-
describe:
|
|
61
|
+
describe: i18n(`${i18nKey}.positionals.src.describe`),
|
|
76
62
|
type: 'string',
|
|
77
63
|
});
|
|
78
64
|
|
|
79
65
|
yargs.positional('dest', {
|
|
80
|
-
describe:
|
|
81
|
-
'Local directory you would like the files to be placed in, relative to your current working directory',
|
|
66
|
+
describe: i18n(`${i18nKey}.positionals.dest.describe`),
|
|
82
67
|
type: 'string',
|
|
83
68
|
});
|
|
84
69
|
|
|
85
70
|
yargs.options({
|
|
86
71
|
staging: {
|
|
87
|
-
describe:
|
|
72
|
+
describe: i18n(`${i18nKey}.options.staging.describe`),
|
|
88
73
|
type: 'boolean',
|
|
89
74
|
default: false,
|
|
90
75
|
hidden: true,
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
const {
|
|
2
|
-
loadConfig,
|
|
3
|
-
validateConfig,
|
|
4
|
-
checkAndWarnGitInclusion,
|
|
5
|
-
} = require('@hubspot/cli-lib');
|
|
6
1
|
const { downloadFileOrFolder } = require('@hubspot/cli-lib/fileManager');
|
|
7
2
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
8
3
|
const { resolveLocalPath } = require('../../lib/filesystem');
|
|
@@ -11,32 +6,26 @@ const {
|
|
|
11
6
|
addConfigOptions,
|
|
12
7
|
addAccountOptions,
|
|
13
8
|
addUseEnvironmentOptions,
|
|
14
|
-
setLogLevel,
|
|
15
9
|
getAccountId,
|
|
16
10
|
} = require('../../lib/commonOpts');
|
|
17
|
-
const {
|
|
18
|
-
const { validateAccount } = require('../../lib/validation');
|
|
11
|
+
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
19
12
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
13
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
14
|
+
|
|
15
|
+
const i18nKey = 'cli.commands.filemanager.subcommands.fetch';
|
|
16
|
+
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
20
17
|
|
|
21
18
|
exports.command = 'fetch <src> [dest]';
|
|
22
|
-
exports.describe =
|
|
23
|
-
'Download a folder or file from the HubSpot File Manager to your computer';
|
|
19
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
24
20
|
|
|
25
21
|
exports.handler = async options => {
|
|
26
|
-
let {
|
|
22
|
+
let { src, dest } = options;
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
logDebugInfo(options);
|
|
30
|
-
loadConfig(configPath, options);
|
|
31
|
-
checkAndWarnGitInclusion();
|
|
32
|
-
|
|
33
|
-
if (!validateConfig() || !(await validateAccount(options))) {
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
24
|
+
await loadAndValidateOptions(options);
|
|
36
25
|
|
|
37
26
|
if (typeof src !== 'string') {
|
|
38
|
-
logger.error(
|
|
39
|
-
process.exit(
|
|
27
|
+
logger.error(i18n(`${i18nKey}.errors.sourceRequired`));
|
|
28
|
+
process.exit(EXIT_CODES.ERROR);
|
|
40
29
|
}
|
|
41
30
|
|
|
42
31
|
dest = resolveLocalPath(dest);
|
|
@@ -55,17 +44,16 @@ exports.builder = yargs => {
|
|
|
55
44
|
addUseEnvironmentOptions(yargs, true);
|
|
56
45
|
|
|
57
46
|
yargs.positional('src', {
|
|
58
|
-
describe:
|
|
47
|
+
describe: i18n(`${i18nKey}.positionals.src.describe`),
|
|
59
48
|
type: 'string',
|
|
60
49
|
});
|
|
61
50
|
yargs.positional('dest', {
|
|
62
|
-
describe:
|
|
63
|
-
'Path to the local directory you would like the files to be placed, relative to your current working directory. If omitted, this argument will default to your current working directory',
|
|
51
|
+
describe: i18n(`${i18nKey}.positionals.dest.describe`),
|
|
64
52
|
type: 'string',
|
|
65
53
|
});
|
|
66
54
|
yargs.option('include-archived', {
|
|
67
55
|
alias: ['i'],
|
|
68
|
-
describe:
|
|
56
|
+
describe: i18n(`${i18nKey}.options.includeArchived.describe`),
|
|
69
57
|
type: 'boolean',
|
|
70
58
|
});
|
|
71
59
|
};
|