@hubspot/cli 7.4.3-beta.0 → 7.4.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/migrate.d.ts +11 -2
- package/api/migrate.js +4 -0
- package/commands/app/migrate.d.ts +0 -1
- package/commands/app/migrate.js +15 -9
- package/commands/auth.js +9 -10
- package/commands/cms.js +1 -2
- package/commands/completion.js +2 -3
- package/commands/create.js +7 -8
- package/commands/customObject.js +3 -4
- package/commands/doctor.js +5 -6
- package/commands/feedback.js +7 -8
- package/commands/fetch.js +6 -7
- package/commands/filemanager.js +1 -2
- package/commands/function.js +1 -2
- package/commands/hubdb/clear.js +5 -6
- package/commands/hubdb/create.js +7 -8
- package/commands/hubdb/delete.js +8 -7
- package/commands/hubdb/fetch.js +4 -5
- package/commands/hubdb.js +1 -2
- package/commands/init.js +10 -11
- package/commands/lint.js +3 -4
- package/commands/list.js +5 -6
- package/commands/logs.js +12 -13
- package/commands/module/marketplace-validate.js +5 -6
- package/commands/module.js +1 -3
- package/commands/mv.js +4 -5
- package/commands/open.js +4 -5
- package/commands/project/add.js +17 -13
- package/commands/project/cloneApp.js +16 -11
- package/commands/project/create.js +18 -14
- package/commands/project/deploy.js +17 -15
- package/commands/project/dev/deprecatedFlow.js +19 -12
- package/commands/project/dev/index.js +11 -7
- package/commands/project/dev/unifiedFlow.js +2 -3
- package/commands/project/download.js +8 -9
- package/commands/project/installDeps.js +9 -7
- package/commands/project/listBuilds.js +15 -11
- package/commands/project/logs.js +19 -17
- package/commands/project/migrate.js +20 -7
- package/commands/project/migrateApp.d.ts +1 -1
- package/commands/project/migrateApp.js +7 -5
- package/commands/project/open.js +11 -5
- package/commands/project/upload.js +12 -8
- package/commands/project/watch.js +10 -6
- package/commands/project.js +1 -2
- package/commands/remove.js +7 -5
- package/commands/sandbox/create.js +10 -11
- package/commands/sandbox/delete.js +18 -19
- package/commands/sandbox.js +1 -2
- package/commands/secret/addSecret.js +5 -6
- package/commands/secret/deleteSecret.js +12 -9
- package/commands/secret/listSecret.js +3 -4
- package/commands/secret/updateSecret.js +9 -8
- package/commands/secret.js +1 -2
- package/commands/theme/generate-selectors.js +5 -6
- package/commands/theme/marketplace-validate.js +5 -6
- package/commands/theme/preview.js +14 -14
- package/commands/theme.js +1 -2
- package/commands/upload.js +23 -24
- package/commands/watch.js +18 -19
- package/lang/en.d.ts +2212 -2262
- package/lang/en.js +14 -14
- package/lang/en.lyaml +3 -9
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +12 -0
- package/lib/app/migrate.js +53 -21
- package/lib/app/migrate_legacy.js +2 -1
- package/lib/constants.d.ts +4 -0
- package/lib/constants.js +5 -1
- package/lib/hasFeature.d.ts +3 -1
- package/lib/localDev.d.ts +2 -1
- package/lib/localDev.js +21 -3
- package/package.json +1 -1
package/api/migrate.d.ts
CHANGED
|
@@ -10,10 +10,14 @@ interface BaseMigrationApp {
|
|
|
10
10
|
}
|
|
11
11
|
export interface MigratableApp extends BaseMigrationApp {
|
|
12
12
|
isMigratable: true;
|
|
13
|
+
unmigratableReason?: undefined;
|
|
13
14
|
}
|
|
15
|
+
export declare const CLI_UNMIGRATABLE_REASONS: {
|
|
16
|
+
readonly PART_OF_PROJECT_ALREADY: "PART_OF_PROJECT_ALREADY";
|
|
17
|
+
};
|
|
14
18
|
export interface UnmigratableApp extends BaseMigrationApp {
|
|
15
19
|
isMigratable: false;
|
|
16
|
-
unmigratableReason: keyof typeof UNMIGRATABLE_REASONS;
|
|
20
|
+
unmigratableReason: keyof typeof UNMIGRATABLE_REASONS | keyof typeof CLI_UNMIGRATABLE_REASONS;
|
|
17
21
|
}
|
|
18
22
|
export type MigrationApp = MigratableApp | UnmigratableApp;
|
|
19
23
|
export interface ListAppsResponse {
|
|
@@ -48,10 +52,15 @@ export interface MigrationSuccess extends MigrationBaseStatus {
|
|
|
48
52
|
status: typeof MIGRATION_STATUS.SUCCESS;
|
|
49
53
|
buildId: number;
|
|
50
54
|
}
|
|
55
|
+
interface ComponentError {
|
|
56
|
+
componentType: string;
|
|
57
|
+
developerSymbol?: string;
|
|
58
|
+
errorMessage: string;
|
|
59
|
+
}
|
|
51
60
|
export interface MigrationFailed extends MigrationBaseStatus {
|
|
52
61
|
status: typeof MIGRATION_STATUS.FAILURE;
|
|
53
62
|
projectErrorDetail: string;
|
|
54
|
-
|
|
63
|
+
componentErrors: ComponentError[];
|
|
55
64
|
}
|
|
56
65
|
export type MigrationStatus = MigrationInProgress | MigrationInputRequired | MigrationSuccess | MigrationFailed;
|
|
57
66
|
export declare function isMigrationStatus(error: unknown): error is MigrationStatus;
|
package/api/migrate.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLI_UNMIGRATABLE_REASONS = void 0;
|
|
3
4
|
exports.isMigrationStatus = isMigrationStatus;
|
|
4
5
|
exports.listAppsForMigration = listAppsForMigration;
|
|
5
6
|
exports.initializeMigration = initializeMigration;
|
|
@@ -8,6 +9,9 @@ exports.checkMigrationStatusV2 = checkMigrationStatusV2;
|
|
|
8
9
|
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
9
10
|
const http_1 = require("@hubspot/local-dev-lib/http");
|
|
10
11
|
const MIGRATIONS_API_PATH_V2 = 'dfs/migrations/v2';
|
|
12
|
+
exports.CLI_UNMIGRATABLE_REASONS = {
|
|
13
|
+
PART_OF_PROJECT_ALREADY: 'PART_OF_PROJECT_ALREADY',
|
|
14
|
+
};
|
|
11
15
|
function isMigrationStatus(error) {
|
|
12
16
|
return (typeof error === 'object' &&
|
|
13
17
|
error !== null &&
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ArgumentsCamelCase, Argv, CommandModule } from 'yargs';
|
|
2
2
|
import { MigrateAppArgs } from '../../lib/app/migrate';
|
|
3
|
-
export declare const validMigrationTargets: string[];
|
|
4
3
|
export declare function handler(options: ArgumentsCamelCase<MigrateAppArgs>): Promise<never>;
|
|
5
4
|
export declare function builder(yargs: Argv): Argv<MigrateAppArgs>;
|
|
6
5
|
declare const migrateCommand: CommandModule<unknown, MigrateAppArgs>;
|
package/commands/app/migrate.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validMigrationTargets = void 0;
|
|
4
3
|
exports.handler = handler;
|
|
5
4
|
exports.builder = builder;
|
|
6
5
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
@@ -15,12 +14,11 @@ const migrate_1 = require("../../lib/app/migrate");
|
|
|
15
14
|
const ui_1 = require("../../lib/ui");
|
|
16
15
|
const migrate_legacy_1 = require("../../lib/app/migrate_legacy");
|
|
17
16
|
const projects_2 = require("../../lib/projects");
|
|
18
|
-
const { v2023_2, v2025_2
|
|
19
|
-
exports.validMigrationTargets = [v2023_2, v2025_2, unstable];
|
|
17
|
+
const { v2023_2, v2025_2 } = projects_1.PLATFORM_VERSIONS;
|
|
20
18
|
const command = 'migrate';
|
|
21
19
|
const describe = undefined; // uiBetaTag(i18n(`commands.project.subcommands.migrateApp.header.text.describe`), false);
|
|
22
20
|
async function handler(options) {
|
|
23
|
-
const { derivedAccountId, platformVersion } = options;
|
|
21
|
+
const { derivedAccountId, platformVersion, unstable } = options;
|
|
24
22
|
await (0, usageTracking_1.trackCommandUsage)('migrate-app', {}, derivedAccountId);
|
|
25
23
|
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
26
24
|
if (!accountConfig) {
|
|
@@ -32,11 +30,14 @@ async function handler(options) {
|
|
|
32
30
|
logger_1.logger.log((0, ui_1.uiLink)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.header.link`), 'https://developers.hubspot.com/docs/platform/migrate-a-public-app-to-projects'));
|
|
33
31
|
logger_1.logger.log('');
|
|
34
32
|
try {
|
|
35
|
-
if (platformVersion === v2025_2 ||
|
|
33
|
+
if (platformVersion === v2025_2 || unstable) {
|
|
36
34
|
if ((0, projects_2.getIsInProject)()) {
|
|
37
35
|
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.errors.notAllowedWithinProject`, { command: (0, ui_1.uiCommandReference)('hs project migrate') }));
|
|
38
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
36
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
39
37
|
}
|
|
38
|
+
options.platformVersion = unstable
|
|
39
|
+
? projects_1.PLATFORM_VERSIONS.unstable
|
|
40
|
+
: platformVersion;
|
|
40
41
|
await (0, migrate_1.migrateApp2025_2)(derivedAccountId, options);
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
@@ -54,7 +55,7 @@ async function handler(options) {
|
|
|
54
55
|
(0, errorHandlers_1.logError)(error, new errorHandlers_1.ApiErrorContext({ accountId: derivedAccountId }));
|
|
55
56
|
}
|
|
56
57
|
await (0, usageTracking_1.trackCommandMetadataUsage)('migrate-app', { successful: false }, derivedAccountId);
|
|
57
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
58
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
58
59
|
}
|
|
59
60
|
await (0, usageTracking_1.trackCommandMetadataUsage)('migrate-app', { successful: true }, derivedAccountId);
|
|
60
61
|
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
@@ -78,9 +79,14 @@ function builder(yargs) {
|
|
|
78
79
|
},
|
|
79
80
|
'platform-version': {
|
|
80
81
|
type: 'string',
|
|
81
|
-
choices:
|
|
82
|
+
choices: [v2023_2, v2025_2],
|
|
83
|
+
hidden: true,
|
|
84
|
+
default: v2025_2,
|
|
85
|
+
},
|
|
86
|
+
unstable: {
|
|
87
|
+
type: 'boolean',
|
|
88
|
+
default: false,
|
|
82
89
|
hidden: true,
|
|
83
|
-
default: '2023.2',
|
|
84
90
|
},
|
|
85
91
|
});
|
|
86
92
|
yargs.example([
|
package/commands/auth.js
CHANGED
|
@@ -22,7 +22,6 @@ const oauth_1 = require("../lib/oauth");
|
|
|
22
22
|
const exitCodes_1 = require("../lib/enums/exitCodes");
|
|
23
23
|
const ui_1 = require("../lib/ui");
|
|
24
24
|
const index_1 = require("../lib/errorHandlers/index");
|
|
25
|
-
const i18nKey = 'commands.auth';
|
|
26
25
|
const TRACKING_STATUS = {
|
|
27
26
|
STARTED: 'started',
|
|
28
27
|
ERROR: 'error',
|
|
@@ -34,7 +33,7 @@ const ALLOWED_AUTH_METHODS = [
|
|
|
34
33
|
];
|
|
35
34
|
const SUPPORTED_AUTHENTICATION_PROTOCOLS_TEXT = (0, text_1.commaSeparatedValues)(ALLOWED_AUTH_METHODS);
|
|
36
35
|
exports.command = 'auth';
|
|
37
|
-
exports.describe = (0, lang_1.i18n)(
|
|
36
|
+
exports.describe = (0, lang_1.i18n)('commands.auth.describe');
|
|
38
37
|
async function handler(args) {
|
|
39
38
|
const { authType: authTypeFlagValue, config: configFlagValue, qa, providedAccountId, } = args;
|
|
40
39
|
const authType = (authTypeFlagValue && authTypeFlagValue.toLowerCase()) ||
|
|
@@ -49,7 +48,7 @@ async function handler(args) {
|
|
|
49
48
|
}
|
|
50
49
|
if ((0, config_2.configFileExists)(true)) {
|
|
51
50
|
const globalConfigPath = (0, config_2.getConfigPath)('', true);
|
|
52
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
51
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.auth.errors.globalConfigFileExists`, {
|
|
53
52
|
configPath: globalConfigPath,
|
|
54
53
|
authCommand: (0, ui_1.uiCommandReference)('hs account auth'),
|
|
55
54
|
}));
|
|
@@ -103,7 +102,7 @@ async function handler(args) {
|
|
|
103
102
|
successAuthMethod = auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.name;
|
|
104
103
|
break;
|
|
105
104
|
default:
|
|
106
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
105
|
+
logger_1.logger.error((0, lang_1.i18n)('commands.auth.errors.unsupportedAuthType', {
|
|
107
106
|
supportedProtocols: SUPPORTED_AUTHENTICATION_PROTOCOLS_TEXT,
|
|
108
107
|
type: authType,
|
|
109
108
|
}));
|
|
@@ -118,16 +117,16 @@ async function handler(args) {
|
|
|
118
117
|
const setAsDefault = await (0, setAsDefaultAccountPrompt_1.setAsDefaultAccountPrompt)(accountName);
|
|
119
118
|
logger_1.logger.log('');
|
|
120
119
|
if (setAsDefault) {
|
|
121
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
120
|
+
logger_1.logger.success((0, lang_1.i18n)('lib.prompts.setAsDefaultAccountPrompt.setAsDefaultAccount', {
|
|
122
121
|
accountName,
|
|
123
122
|
}));
|
|
124
123
|
}
|
|
125
124
|
else {
|
|
126
|
-
logger_1.logger.info((0, lang_1.i18n)(
|
|
125
|
+
logger_1.logger.info((0, lang_1.i18n)('lib.prompts.setAsDefaultAccountPrompt.keepingCurrentDefault', {
|
|
127
126
|
accountName: (0, config_2.getConfigDefaultAccount)(),
|
|
128
127
|
}));
|
|
129
128
|
}
|
|
130
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
129
|
+
logger_1.logger.success((0, lang_1.i18n)('commands.auth.success.configFileUpdated', {
|
|
131
130
|
configFilename: config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
132
131
|
authType: successAuthMethod,
|
|
133
132
|
accountName,
|
|
@@ -144,7 +143,7 @@ async function handler(args) {
|
|
|
144
143
|
function authBuilder(yargs) {
|
|
145
144
|
yargs.options({
|
|
146
145
|
'auth-type': {
|
|
147
|
-
describe: (0, lang_1.i18n)(
|
|
146
|
+
describe: (0, lang_1.i18n)('commands.auth.options.authType.describe'),
|
|
148
147
|
type: 'string',
|
|
149
148
|
choices: [
|
|
150
149
|
`${auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value}`,
|
|
@@ -153,14 +152,14 @@ function authBuilder(yargs) {
|
|
|
153
152
|
default: auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value,
|
|
154
153
|
},
|
|
155
154
|
account: {
|
|
156
|
-
describe: (0, lang_1.i18n)(
|
|
155
|
+
describe: (0, lang_1.i18n)('commands.auth.options.account.describe'),
|
|
157
156
|
type: 'string',
|
|
158
157
|
alias: 'a',
|
|
159
158
|
},
|
|
160
159
|
});
|
|
161
160
|
return yargs;
|
|
162
161
|
}
|
|
163
|
-
exports.builder = (0, yargsUtils_1.makeYargsBuilder)(authBuilder, exports.command, (0, lang_1.i18n)(
|
|
162
|
+
exports.builder = (0, yargsUtils_1.makeYargsBuilder)(authBuilder, exports.command, (0, lang_1.i18n)('commands.auth.verboseDescribe', {
|
|
164
163
|
authMethod: auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value,
|
|
165
164
|
configName: config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
166
165
|
}), {
|
package/commands/cms.js
CHANGED
|
@@ -6,9 +6,8 @@ const { addConfigOptions, addAccountOptions, addGlobalOptions, } = require('../l
|
|
|
6
6
|
const lighthouseScore = require('./cms/lighthouseScore');
|
|
7
7
|
const convertFields = require('./cms/convertFields');
|
|
8
8
|
const getReactModule = require('./cms/getReactModule');
|
|
9
|
-
const i18nKey = 'commands.cms';
|
|
10
9
|
exports.command = 'cms';
|
|
11
|
-
exports.describe = i18n(
|
|
10
|
+
exports.describe = i18n(`commands.cms.describe`);
|
|
12
11
|
exports.builder = yargs => {
|
|
13
12
|
addConfigOptions(yargs);
|
|
14
13
|
addAccountOptions(yargs);
|
package/commands/completion.js
CHANGED
|
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const yargsParser = require('yargs-parser');
|
|
5
5
|
const { i18n } = require('../lib/lang');
|
|
6
6
|
const { trackCommandUsage } = require('../lib/usageTracking');
|
|
7
|
-
const i18nKey = 'commands.completion';
|
|
8
7
|
exports.command = 'completion';
|
|
9
|
-
exports.describe = i18n(
|
|
8
|
+
exports.describe = i18n('commands.completion.describe');
|
|
10
9
|
exports.handler = async () => {
|
|
11
10
|
await trackCommandUsage('completion');
|
|
12
11
|
};
|
|
@@ -16,7 +15,7 @@ exports.builder = yargs => {
|
|
|
16
15
|
yargs.completion();
|
|
17
16
|
}
|
|
18
17
|
yargs.example([
|
|
19
|
-
['$0 completion >> ~/.zshrc', i18n(
|
|
18
|
+
['$0 completion >> ~/.zshrc', i18n('commands.completion.examples.default')],
|
|
20
19
|
]);
|
|
21
20
|
return yargs;
|
|
22
21
|
};
|
package/commands/create.js
CHANGED
|
@@ -32,12 +32,11 @@ const { resolveLocalPath } = require('../lib/filesystem');
|
|
|
32
32
|
const { trackCommandUsage } = require('../lib/usageTracking');
|
|
33
33
|
const assets = require('./create/index');
|
|
34
34
|
const { i18n } = require('../lib/lang');
|
|
35
|
-
const i18nKey = 'commands.create';
|
|
36
35
|
const SUPPORTED_ASSET_TYPES = Object.keys(assets)
|
|
37
36
|
.filter(t => !assets[t].hidden)
|
|
38
37
|
.join(', ');
|
|
39
38
|
exports.command = 'create <type> [name] [dest]';
|
|
40
|
-
exports.describe = i18n(
|
|
39
|
+
exports.describe = i18n(`commands.create.describe`, {
|
|
41
40
|
supportedAssetTypes: SUPPORTED_ASSET_TYPES,
|
|
42
41
|
});
|
|
43
42
|
exports.handler = async (options) => {
|
|
@@ -46,7 +45,7 @@ exports.handler = async (options) => {
|
|
|
46
45
|
setLogLevel(options);
|
|
47
46
|
assetType = typeof assetType === 'string' && assetType.toLowerCase();
|
|
48
47
|
if (assetType === 'global-partial') {
|
|
49
|
-
logger.error(i18n(
|
|
48
|
+
logger.error(i18n(`commands.create.errors.deprecatedAssetType`, {
|
|
50
49
|
assetType,
|
|
51
50
|
newCommand: 'hs create template',
|
|
52
51
|
type: 'global partial',
|
|
@@ -54,7 +53,7 @@ exports.handler = async (options) => {
|
|
|
54
53
|
return;
|
|
55
54
|
}
|
|
56
55
|
if (!assetType || !assets[assetType]) {
|
|
57
|
-
logger.error(i18n(
|
|
56
|
+
logger.error(i18n(`commands.create.errors.unsupportedAssetType`, {
|
|
58
57
|
assetType,
|
|
59
58
|
supportedAssetTypes: SUPPORTED_ASSET_TYPES,
|
|
60
59
|
}));
|
|
@@ -69,7 +68,7 @@ exports.handler = async (options) => {
|
|
|
69
68
|
await fs.ensureDir(dest);
|
|
70
69
|
}
|
|
71
70
|
catch (e) {
|
|
72
|
-
logger.error(i18n(
|
|
71
|
+
logger.error(i18n(`commands.create.errors.unusablePath`, {
|
|
73
72
|
path: dest,
|
|
74
73
|
}));
|
|
75
74
|
logError(e, {
|
|
@@ -84,15 +83,15 @@ exports.handler = async (options) => {
|
|
|
84
83
|
};
|
|
85
84
|
exports.builder = yargs => {
|
|
86
85
|
yargs.positional('type', {
|
|
87
|
-
describe: i18n(
|
|
86
|
+
describe: i18n(`commands.create.positionals.type.describe`),
|
|
88
87
|
type: 'string',
|
|
89
88
|
});
|
|
90
89
|
yargs.positional('name', {
|
|
91
|
-
describe: i18n(
|
|
90
|
+
describe: i18n(`commands.create.positionals.name.describe`),
|
|
92
91
|
type: 'string',
|
|
93
92
|
});
|
|
94
93
|
yargs.positional('dest', {
|
|
95
|
-
describe: i18n(
|
|
94
|
+
describe: i18n(`commands.create.positionals.dest.describe`),
|
|
96
95
|
type: 'string',
|
|
97
96
|
});
|
|
98
97
|
yargs.option('internal', {
|
package/commands/customObject.js
CHANGED
|
@@ -41,12 +41,11 @@ const createCommand = __importStar(require("./customObject/create"));
|
|
|
41
41
|
const lang_1 = require("../lib/lang");
|
|
42
42
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
43
43
|
const ui_1 = require("../lib/ui");
|
|
44
|
-
const i18nKey = 'commands.customObject';
|
|
45
44
|
exports.command = ['custom-object', 'custom-objects', 'co'];
|
|
46
|
-
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(
|
|
45
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.customObject.describe`), false);
|
|
47
46
|
function logBetaMessage() {
|
|
48
|
-
(0, ui_1.uiBetaTag)((0, lang_1.i18n)(
|
|
49
|
-
logger_1.logger.log((0, ui_1.uiLink)((0, lang_1.i18n)(
|
|
47
|
+
(0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.customObject.betaMessage`));
|
|
48
|
+
logger_1.logger.log((0, ui_1.uiLink)((0, lang_1.i18n)(`commands.customObject.seeMoreLink`), 'https://developers.hubspot.com/docs/api/crm/crm-custom-objects'));
|
|
50
49
|
logger_1.logger.log();
|
|
51
50
|
}
|
|
52
51
|
function builder(yargs) {
|
package/commands/doctor.js
CHANGED
|
@@ -13,9 +13,8 @@ const path_1 = __importDefault(require("path"));
|
|
|
13
13
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
14
14
|
const commonOpts_1 = require("../lib/commonOpts");
|
|
15
15
|
const { i18n } = require('../lib/lang');
|
|
16
|
-
const i18nKey = 'commands.doctor';
|
|
17
16
|
exports.command = 'doctor';
|
|
18
|
-
exports.describe = i18n(
|
|
17
|
+
exports.describe = i18n(`commands.doctor.describe`);
|
|
19
18
|
const handler = async ({ outputDir, }) => {
|
|
20
19
|
const doctor = new Doctor_1.Doctor();
|
|
21
20
|
(0, usageTracking_1.trackCommandUsage)(exports.command, undefined, doctor.accountId || undefined);
|
|
@@ -29,7 +28,7 @@ const handler = async ({ outputDir, }) => {
|
|
|
29
28
|
logger_1.logger.log(output.diagnosis);
|
|
30
29
|
}
|
|
31
30
|
else {
|
|
32
|
-
logger_1.logger.error(i18n(
|
|
31
|
+
logger_1.logger.error(i18n(`commands.doctor.errors.generatingDiagnosis`));
|
|
33
32
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
34
33
|
}
|
|
35
34
|
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
@@ -40,10 +39,10 @@ const handler = async ({ outputDir, }) => {
|
|
|
40
39
|
const outputFile = path_1.default.join(outputDir, `hubspot-doctor-${new Date().toISOString()}.json`);
|
|
41
40
|
try {
|
|
42
41
|
fs_1.default.writeFileSync(outputFile, JSON.stringify(output, null, 4));
|
|
43
|
-
logger_1.logger.success(i18n(
|
|
42
|
+
logger_1.logger.success(i18n(`commands.doctor.outputWritten`, { filename: outputFile }));
|
|
44
43
|
}
|
|
45
44
|
catch (e) {
|
|
46
|
-
logger_1.logger.error(i18n(
|
|
45
|
+
logger_1.logger.error(i18n(`commands.doctor.errors.unableToWriteOutputFile`, {
|
|
47
46
|
file: outputFile,
|
|
48
47
|
errorMessage: e instanceof Error ? e.message : e,
|
|
49
48
|
}));
|
|
@@ -54,7 +53,7 @@ const handler = async ({ outputDir, }) => {
|
|
|
54
53
|
exports.handler = handler;
|
|
55
54
|
const builder = yargs => {
|
|
56
55
|
yargs.option('output-dir', {
|
|
57
|
-
describe: i18n(
|
|
56
|
+
describe: i18n(`commands.doctor.options.outputDir`),
|
|
58
57
|
type: 'string',
|
|
59
58
|
});
|
|
60
59
|
(0, commonOpts_1.addGlobalOptions)(yargs);
|
package/commands/feedback.js
CHANGED
|
@@ -6,7 +6,6 @@ const { i18n } = require('../lib/lang');
|
|
|
6
6
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
7
7
|
const { confirmPrompt, listPrompt } = require('../lib/prompts/promptUtils');
|
|
8
8
|
const { addGlobalOptions } = require('../lib/commonOpts');
|
|
9
|
-
const i18nKey = 'commands.project.subcommands.feedback';
|
|
10
9
|
const FEEDBACK_OPTIONS = {
|
|
11
10
|
BUG: 'bug',
|
|
12
11
|
GENERAL: 'general',
|
|
@@ -16,35 +15,35 @@ const FEEDBACK_URLS = {
|
|
|
16
15
|
GENERAL: 'https://docs.google.com/forms/d/e/1FAIpQLSejZZewYzuH3oKBU01tseX-cSWOUsTHLTr-YsiMGpzwcvgIMg/viewform?usp=sf_link',
|
|
17
16
|
};
|
|
18
17
|
exports.command = 'feedback';
|
|
19
|
-
exports.describe = i18n(
|
|
18
|
+
exports.describe = i18n(`commands.project.subcommands.feedback.describe`);
|
|
20
19
|
exports.handler = async (options) => {
|
|
21
20
|
const { bug: bugFlag, general: generalFlag } = options;
|
|
22
21
|
const usedTypeFlag = bugFlag !== generalFlag;
|
|
23
|
-
await listPrompt(i18n(
|
|
22
|
+
await listPrompt(i18n(`commands.project.subcommands.feedback.feedbackType.prompt`), {
|
|
24
23
|
choices: Object.values(FEEDBACK_OPTIONS).map(option => ({
|
|
25
|
-
name: i18n(
|
|
24
|
+
name: i18n(`commands.project.subcommands.feedback.feedbackType.${option}`),
|
|
26
25
|
value: option,
|
|
27
26
|
})),
|
|
28
27
|
when: !usedTypeFlag,
|
|
29
28
|
});
|
|
30
|
-
const shouldOpen = await confirmPrompt(i18n(
|
|
29
|
+
const shouldOpen = await confirmPrompt(i18n(`commands.project.subcommands.feedback.openPrompt`), {
|
|
31
30
|
when: !usedTypeFlag,
|
|
32
31
|
});
|
|
33
32
|
if (shouldOpen || usedTypeFlag) {
|
|
34
33
|
// NOTE: for now, all feedback should go to the hubspot-cli repository
|
|
35
34
|
const url = FEEDBACK_URLS.BUG;
|
|
36
35
|
open(url, { url: true });
|
|
37
|
-
logger.success(i18n(
|
|
36
|
+
logger.success(i18n(`commands.project.subcommands.feedback.success`, { url }));
|
|
38
37
|
}
|
|
39
38
|
};
|
|
40
39
|
exports.builder = yargs => {
|
|
41
40
|
yargs.options({
|
|
42
41
|
bug: {
|
|
43
|
-
describe: i18n(
|
|
42
|
+
describe: i18n(`commands.project.subcommands.feedback.options.bug.describe`),
|
|
44
43
|
type: 'boolean',
|
|
45
44
|
},
|
|
46
45
|
general: {
|
|
47
|
-
describe: i18n(
|
|
46
|
+
describe: i18n(`commands.project.subcommands.feedback.options.general.describe`),
|
|
48
47
|
type: 'boolean',
|
|
49
48
|
},
|
|
50
49
|
});
|
package/commands/fetch.js
CHANGED
|
@@ -8,18 +8,17 @@ const { resolveLocalPath } = require('../lib/filesystem');
|
|
|
8
8
|
const { validateCmsPublishMode } = require('../lib/validation');
|
|
9
9
|
const { trackCommandUsage } = require('../lib/usageTracking');
|
|
10
10
|
const { i18n } = require('../lib/lang');
|
|
11
|
-
const i18nKey = 'commands.fetch';
|
|
12
11
|
const { EXIT_CODES } = require('../lib/enums/exitCodes');
|
|
13
12
|
const { logError } = require('../lib/errorHandlers/index');
|
|
14
13
|
exports.command = 'fetch <src> [dest]';
|
|
15
|
-
exports.describe = i18n(
|
|
14
|
+
exports.describe = i18n('commands.fetch.describe');
|
|
16
15
|
exports.handler = async (options) => {
|
|
17
16
|
const { src, dest } = options;
|
|
18
17
|
if (!validateCmsPublishMode(options)) {
|
|
19
18
|
process.exit(EXIT_CODES.ERROR);
|
|
20
19
|
}
|
|
21
20
|
if (typeof src !== 'string') {
|
|
22
|
-
logger.error(i18n(
|
|
21
|
+
logger.error(i18n('commands.fetch.errors.sourceRequired'));
|
|
23
22
|
process.exit(EXIT_CODES.ERROR);
|
|
24
23
|
}
|
|
25
24
|
const { derivedAccountId } = options;
|
|
@@ -36,16 +35,16 @@ exports.handler = async (options) => {
|
|
|
36
35
|
};
|
|
37
36
|
exports.builder = yargs => {
|
|
38
37
|
yargs.positional('src', {
|
|
39
|
-
describe: i18n(
|
|
38
|
+
describe: i18n('commands.fetch.positionals.src.describe'),
|
|
40
39
|
type: 'string',
|
|
41
40
|
});
|
|
42
41
|
yargs.positional('dest', {
|
|
43
|
-
describe: i18n(
|
|
42
|
+
describe: i18n('commands.fetch.positionals.dest.describe'),
|
|
44
43
|
type: 'string',
|
|
45
44
|
});
|
|
46
45
|
yargs.options({
|
|
47
46
|
staging: {
|
|
48
|
-
describe: i18n(
|
|
47
|
+
describe: i18n('commands.fetch.options.staging.describe'),
|
|
49
48
|
type: 'boolean',
|
|
50
49
|
default: false,
|
|
51
50
|
hidden: true,
|
|
@@ -54,7 +53,7 @@ exports.builder = yargs => {
|
|
|
54
53
|
yargs.options({
|
|
55
54
|
assetVersion: {
|
|
56
55
|
type: 'number',
|
|
57
|
-
describe: i18n(
|
|
56
|
+
describe: i18n('commands.fetch.options.assetVersion.describe'),
|
|
58
57
|
},
|
|
59
58
|
});
|
|
60
59
|
addConfigOptions(yargs);
|
package/commands/filemanager.js
CHANGED
|
@@ -38,9 +38,8 @@ exports.builder = builder;
|
|
|
38
38
|
const upload = __importStar(require("./filemanager/upload"));
|
|
39
39
|
const fetch = __importStar(require("./filemanager/fetch"));
|
|
40
40
|
const lang_1 = require("../lib/lang");
|
|
41
|
-
const i18nKey = 'commands.filemanager';
|
|
42
41
|
exports.command = 'filemanager';
|
|
43
|
-
exports.describe = (0, lang_1.i18n)(
|
|
42
|
+
exports.describe = (0, lang_1.i18n)(`commands.filemanager.describe`);
|
|
44
43
|
function builder(yargs) {
|
|
45
44
|
yargs.command(upload).command(fetch).demandCommand(1, '');
|
|
46
45
|
return yargs;
|
package/commands/function.js
CHANGED
|
@@ -6,9 +6,8 @@ const list = require('./function/list');
|
|
|
6
6
|
const deploy = require('./function/deploy');
|
|
7
7
|
const server = require('./function/server');
|
|
8
8
|
const { i18n } = require('../lib/lang');
|
|
9
|
-
const i18nKey = 'commands.function';
|
|
10
9
|
exports.command = ['function', 'functions'];
|
|
11
|
-
exports.describe = i18n(
|
|
10
|
+
exports.describe = i18n(`commands.function.describe`);
|
|
12
11
|
exports.builder = yargs => {
|
|
13
12
|
addGlobalOptions(yargs);
|
|
14
13
|
yargs.command(list).command(deploy).command(server).demandCommand(1, '');
|
package/commands/hubdb/clear.js
CHANGED
|
@@ -11,9 +11,8 @@ const selectHubDBTablePrompt_1 = require("../../lib/prompts/selectHubDBTableProm
|
|
|
11
11
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
12
12
|
const commonOpts_1 = require("../../lib/commonOpts");
|
|
13
13
|
const lang_1 = require("../../lib/lang");
|
|
14
|
-
const i18nKey = 'commands.hubdb.subcommands.clear';
|
|
15
14
|
exports.command = 'clear [table-id]';
|
|
16
|
-
exports.describe = (0, lang_1.i18n)(
|
|
15
|
+
exports.describe = (0, lang_1.i18n)('commands.hubdb.subcommands.clear.describe');
|
|
17
16
|
async function handler(args) {
|
|
18
17
|
const { derivedAccountId } = args;
|
|
19
18
|
(0, usageTracking_1.trackCommandUsage)('hubdb-clear', {}, derivedAccountId);
|
|
@@ -26,18 +25,18 @@ async function handler(args) {
|
|
|
26
25
|
});
|
|
27
26
|
const { deletedRowCount } = await (0, hubdb_1.clearHubDbTableRows)(derivedAccountId, tableId);
|
|
28
27
|
if (deletedRowCount > 0) {
|
|
29
|
-
logger_1.logger.log((0, lang_1.i18n)(
|
|
28
|
+
logger_1.logger.log((0, lang_1.i18n)('commands.hubdb.subcommands.clear.logs.removedRows', {
|
|
30
29
|
deletedRowCount,
|
|
31
30
|
tableId,
|
|
32
31
|
}));
|
|
33
32
|
const { data: { rowCount }, } = await (0, hubdb_2.publishTable)(derivedAccountId, tableId);
|
|
34
|
-
logger_1.logger.log((0, lang_1.i18n)(
|
|
33
|
+
logger_1.logger.log((0, lang_1.i18n)('commands.hubdb.subcommands.clear.logs.rowCount', {
|
|
35
34
|
rowCount,
|
|
36
35
|
tableId,
|
|
37
36
|
}));
|
|
38
37
|
}
|
|
39
38
|
else {
|
|
40
|
-
logger_1.logger.log((0, lang_1.i18n)(
|
|
39
|
+
logger_1.logger.log((0, lang_1.i18n)('commands.hubdb.subcommands.clear.logs.emptyTable', {
|
|
41
40
|
tableId,
|
|
42
41
|
}));
|
|
43
42
|
}
|
|
@@ -51,7 +50,7 @@ function builder(yargs) {
|
|
|
51
50
|
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
52
51
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
53
52
|
yargs.positional('table-id', {
|
|
54
|
-
describe: (0, lang_1.i18n)(
|
|
53
|
+
describe: (0, lang_1.i18n)('commands.hubdb.subcommands.clear.positionals.tableId.describe'),
|
|
55
54
|
type: 'string',
|
|
56
55
|
});
|
|
57
56
|
return yargs;
|
package/commands/hubdb/create.js
CHANGED
|
@@ -17,21 +17,20 @@ const usageTracking_1 = require("../../lib/usageTracking");
|
|
|
17
17
|
const commonOpts_1 = require("../../lib/commonOpts");
|
|
18
18
|
const lang_1 = require("../../lib/lang");
|
|
19
19
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
20
|
-
const i18nKey = 'commands.hubdb.subcommands.create';
|
|
21
20
|
exports.command = 'create';
|
|
22
|
-
exports.describe = (0, lang_1.i18n)(
|
|
21
|
+
exports.describe = (0, lang_1.i18n)(`commands.hubdb.subcommands.create.describe`);
|
|
23
22
|
function selectPathPrompt(options) {
|
|
24
23
|
return (0, promptUtils_1.promptUser)([
|
|
25
24
|
{
|
|
26
25
|
name: 'path',
|
|
27
|
-
message: (0, lang_1.i18n)(
|
|
26
|
+
message: (0, lang_1.i18n)(`commands.hubdb.subcommands.create.enterPath`),
|
|
28
27
|
when: !options.path,
|
|
29
28
|
validate: (input) => {
|
|
30
29
|
if (!input) {
|
|
31
|
-
return (0, lang_1.i18n)(
|
|
30
|
+
return (0, lang_1.i18n)(`commands.hubdb.subcommands.create.errors.pathRequired`);
|
|
32
31
|
}
|
|
33
32
|
if (!(0, path_2.isValidPath)(input)) {
|
|
34
|
-
return (0, lang_1.i18n)(
|
|
33
|
+
return (0, lang_1.i18n)(`commands.hubdb.subcommands.create.errors.invalidCharacters`);
|
|
35
34
|
}
|
|
36
35
|
return true;
|
|
37
36
|
},
|
|
@@ -54,14 +53,14 @@ async function handler(args) {
|
|
|
54
53
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
55
54
|
}
|
|
56
55
|
const table = await (0, hubdb_1.createHubDbTable)(derivedAccountId, path_1.default.resolve((0, path_2.getCwd)(), filePath));
|
|
57
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
56
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.hubdb.subcommands.create.success.create`, {
|
|
58
57
|
accountId: derivedAccountId,
|
|
59
58
|
rowCount: table.rowCount,
|
|
60
59
|
tableId: table.tableId,
|
|
61
60
|
}));
|
|
62
61
|
}
|
|
63
62
|
catch (e) {
|
|
64
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
63
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.hubdb.subcommands.create.errors.create`, {
|
|
65
64
|
filePath: filePath || '',
|
|
66
65
|
}));
|
|
67
66
|
(0, index_1.logError)(e);
|
|
@@ -72,7 +71,7 @@ function builder(yargs) {
|
|
|
72
71
|
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
73
72
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
74
73
|
yargs.options('path', {
|
|
75
|
-
describe: (0, lang_1.i18n)(
|
|
74
|
+
describe: (0, lang_1.i18n)(`commands.hubdb.subcommands.create.options.path.describe`),
|
|
76
75
|
type: 'string',
|
|
77
76
|
});
|
|
78
77
|
return yargs;
|
package/commands/hubdb/delete.js
CHANGED
|
@@ -12,9 +12,8 @@ const selectHubDBTablePrompt_1 = require("../../lib/prompts/selectHubDBTableProm
|
|
|
12
12
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
13
13
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
14
14
|
const lang_1 = require("../../lib/lang");
|
|
15
|
-
const i18nKey = 'commands.hubdb.subcommands.delete';
|
|
16
15
|
exports.command = 'delete [table-id]';
|
|
17
|
-
exports.describe = (0, lang_1.i18n)(
|
|
16
|
+
exports.describe = (0, lang_1.i18n)('commands.hubdb.subcommands.delete.describe');
|
|
18
17
|
async function handler(args) {
|
|
19
18
|
const { force, derivedAccountId } = args;
|
|
20
19
|
(0, usageTracking_1.trackCommandUsage)('hubdb-delete', {}, derivedAccountId);
|
|
@@ -29,21 +28,23 @@ async function handler(args) {
|
|
|
29
28
|
const { shouldDeleteTable } = await (0, promptUtils_1.promptUser)({
|
|
30
29
|
name: 'shouldDeleteTable',
|
|
31
30
|
type: 'confirm',
|
|
32
|
-
message: (0, lang_1.i18n)(
|
|
31
|
+
message: (0, lang_1.i18n)('commands.hubdb.subcommands.delete.shouldDeleteTable', {
|
|
32
|
+
tableId,
|
|
33
|
+
}),
|
|
33
34
|
});
|
|
34
35
|
if (!shouldDeleteTable) {
|
|
35
36
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
await (0, hubdb_1.deleteTable)(derivedAccountId, tableId);
|
|
39
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
40
|
+
logger_1.logger.success((0, lang_1.i18n)('commands.hubdb.subcommands.delete.success.delete', {
|
|
40
41
|
accountId: derivedAccountId,
|
|
41
42
|
tableId,
|
|
42
43
|
}));
|
|
43
44
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
44
45
|
}
|
|
45
46
|
catch (e) {
|
|
46
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
47
|
+
logger_1.logger.error((0, lang_1.i18n)('commands.hubdb.subcommands.delete.errors.delete', {
|
|
47
48
|
tableId: args.tableId || '',
|
|
48
49
|
}));
|
|
49
50
|
(0, index_1.logError)(e);
|
|
@@ -54,11 +55,11 @@ function builder(yargs) {
|
|
|
54
55
|
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
55
56
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
56
57
|
yargs.positional('table-id', {
|
|
57
|
-
describe: (0, lang_1.i18n)(
|
|
58
|
+
describe: (0, lang_1.i18n)('commands.hubdb.subcommands.delete.positionals.tableId.describe'),
|
|
58
59
|
type: 'string',
|
|
59
60
|
});
|
|
60
61
|
yargs.option('force', {
|
|
61
|
-
describe: (0, lang_1.i18n)(
|
|
62
|
+
describe: (0, lang_1.i18n)('commands.hubdb.subcommands.delete.options.force.describe'),
|
|
62
63
|
type: 'boolean',
|
|
63
64
|
});
|
|
64
65
|
return yargs;
|