@hubspot/cli 7.4.7-experimental.0 → 7.4.7
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 +14 -4
- package/api/migrate.js +16 -2
- package/bin/cli.js +8 -183
- package/commands/account/auth.d.ts +10 -0
- package/commands/account/auth.js +188 -0
- package/commands/account/clean.js +38 -5
- package/commands/account/createOverride.d.ts +10 -0
- package/commands/account/createOverride.js +104 -0
- package/commands/account/info.js +38 -4
- package/commands/account/list.js +23 -5
- package/commands/account/remove.js +36 -2
- package/commands/account/removeOverride.d.ts +10 -0
- package/commands/account/removeOverride.js +76 -0
- package/commands/account/use.js +25 -3
- package/commands/account.js +7 -2
- package/commands/app/migrate.d.ts +6 -6
- package/commands/app/migrate.js +62 -45
- package/commands/app.js +0 -2
- package/commands/auth.js +14 -11
- package/commands/cms/lighthouseScore.js +7 -3
- package/commands/cms.js +1 -2
- package/commands/completion.js +2 -3
- package/commands/config/migrate.d.ts +10 -0
- package/commands/config/migrate.js +84 -0
- package/commands/config/set.d.ts +10 -0
- package/commands/config/set.js +34 -29
- package/commands/config.d.ts +4 -1
- package/commands/config.js +45 -11
- package/commands/create/api-sample.js +3 -1
- package/commands/create/website-theme.js +1 -1
- package/commands/create.js +7 -8
- package/commands/customObject/schema/delete.js +4 -1
- package/commands/customObject/schema/fetch-all.js +2 -1
- package/commands/customObject/schema/fetch.js +2 -1
- 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 +18 -20
- 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.d.ts +3 -7
- package/commands/project/add.js +28 -23
- package/commands/project/cloneApp.d.ts +6 -8
- package/commands/project/cloneApp.js +49 -45
- package/commands/project/create.d.ts +10 -1
- package/commands/project/create.js +85 -63
- package/commands/project/deploy.d.ts +3 -6
- package/commands/project/deploy.js +27 -25
- package/commands/project/dev/deprecatedFlow.js +32 -25
- package/commands/project/dev/index.d.ts +4 -2
- package/commands/project/dev/index.js +31 -18
- package/commands/project/dev/unifiedFlow.js +10 -11
- package/commands/project/download.d.ts +3 -7
- package/commands/project/download.js +18 -19
- package/commands/project/installDeps.d.ts +6 -1
- package/commands/project/installDeps.js +48 -32
- package/commands/project/listBuilds.d.ts +3 -7
- package/commands/project/listBuilds.js +32 -27
- package/commands/project/logs.d.ts +10 -1
- package/commands/project/logs.js +73 -65
- package/commands/project/migrate.d.ts +6 -0
- package/commands/project/migrate.js +71 -0
- package/commands/project/migrateApp.d.ts +3 -8
- package/commands/project/migrateApp.js +23 -20
- package/commands/project/open.d.ts +3 -7
- package/commands/project/open.js +29 -21
- package/commands/project/upload.d.ts +9 -1
- package/commands/project/upload.js +78 -54
- package/commands/project/watch.d.ts +6 -1
- package/commands/project/watch.js +95 -61
- package/commands/project.d.ts +3 -1
- package/commands/project.js +47 -35
- 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 +16 -16
- package/commands/theme.js +1 -2
- package/commands/upload.js +23 -24
- package/commands/watch.js +18 -19
- package/lang/en.d.ts +2806 -0
- package/lang/en.js +2659 -3300
- package/lang/en.lyaml +98 -41
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +12 -0
- package/lib/app/migrate.d.ts +10 -4
- package/lib/app/migrate.js +208 -94
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/app/migrate_legacy.js +10 -7
- package/lib/buildAccount.d.ts +1 -2
- package/lib/buildAccount.js +11 -10
- package/lib/commonOpts.d.ts +3 -4
- package/lib/commonOpts.js +46 -18
- package/lib/configMigrate.d.ts +2 -0
- package/lib/configMigrate.js +104 -0
- package/lib/configOptions.js +11 -10
- package/lib/constants.d.ts +4 -0
- package/lib/constants.js +5 -1
- package/lib/dependencyManagement.js +2 -2
- package/lib/doctor/Diagnosis.d.ts +1 -2
- package/lib/doctor/Diagnosis.js +19 -16
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +2 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +10 -9
- package/lib/doctor/Doctor.d.ts +1 -0
- package/lib/doctor/Doctor.js +57 -44
- package/lib/errorHandlers/index.js +6 -7
- package/lib/errorHandlers/suppressError.js +6 -7
- package/lib/generateSelectors.js +1 -2
- package/lib/hasFeature.d.ts +3 -1
- package/lib/middleware/__test__/configMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/configMiddleware.test.js +194 -0
- package/lib/middleware/__test__/gitMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/gitMiddleware.test.js +76 -0
- package/lib/middleware/__test__/notificationsMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/notificationsMiddleware.test.js +10 -0
- package/lib/middleware/__test__/requestMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/requestMiddleware.test.js +20 -0
- package/lib/middleware/__test__/utils.test.d.ts +1 -0
- package/lib/middleware/__test__/utils.test.js +53 -0
- package/lib/middleware/__test__/yargsChecksMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +81 -0
- package/lib/middleware/configMiddleware.d.ts +13 -0
- package/lib/middleware/configMiddleware.js +116 -0
- package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
- package/lib/middleware/fireAlarmMiddleware.js +123 -0
- package/lib/middleware/gitMiddleware.d.ts +2 -0
- package/lib/middleware/gitMiddleware.js +14 -0
- package/lib/middleware/notificationsMiddleware.d.ts +1 -0
- package/lib/middleware/notificationsMiddleware.js +38 -0
- package/lib/middleware/requestMiddleware.d.ts +1 -0
- package/lib/middleware/requestMiddleware.js +11 -0
- package/lib/middleware/utils.d.ts +8 -0
- package/lib/middleware/utils.js +17 -0
- package/lib/middleware/yargsChecksMiddleware.d.ts +4 -0
- package/lib/middleware/yargsChecksMiddleware.js +24 -0
- package/lib/oauth.js +1 -2
- package/lib/process.js +1 -2
- package/lib/projects/ProjectLogsManager.d.ts +1 -1
- package/lib/projects/ProjectLogsManager.js +16 -21
- package/lib/projects/buildAndDeploy.js +28 -39
- package/lib/projects/config.d.ts +9 -0
- package/lib/projects/config.js +79 -0
- package/lib/projects/create.js +5 -6
- package/lib/projects/ensureProjectExists.d.ts +11 -0
- package/lib/projects/ensureProjectExists.js +97 -0
- package/lib/{DevServerManager.d.ts → projects/localDev/DevServerManager.d.ts} +1 -1
- package/lib/{DevServerManager.js → projects/localDev/DevServerManager.js} +6 -6
- package/lib/{DevServerManagerV2.d.ts → projects/localDev/DevServerManagerV2.d.ts} +1 -1
- package/lib/{DevServerManagerV2.js → projects/localDev/DevServerManagerV2.js} +3 -4
- package/lib/{LocalDevManager.d.ts → projects/localDev/LocalDevManager.d.ts} +1 -1
- package/lib/{LocalDevManager.js → projects/localDev/LocalDevManager.js} +49 -82
- package/lib/{LocalDevManagerV2.d.ts → projects/localDev/LocalDevManagerV2.d.ts} +2 -2
- package/lib/{LocalDevManagerV2.js → projects/localDev/LocalDevManagerV2.js} +43 -75
- package/lib/{localDev.d.ts → projects/localDev/helpers.d.ts} +5 -4
- package/lib/{localDev.js → projects/localDev/helpers.js} +97 -114
- package/lib/projects/ui.d.ts +1 -0
- package/lib/projects/ui.js +15 -0
- package/lib/projects/upload.d.ts +13 -2
- package/lib/projects/upload.js +18 -34
- package/lib/projects/urls.d.ts +1 -0
- package/lib/projects/urls.js +6 -0
- package/lib/projects/watch.d.ts +1 -1
- package/lib/projects/watch.js +21 -18
- package/lib/prompts/accountNamePrompt.js +16 -13
- package/lib/prompts/accountsPrompt.js +1 -2
- package/lib/prompts/cmsFieldPrompt.js +1 -2
- package/lib/prompts/createApiSamplePrompt.js +4 -5
- package/lib/prompts/createFunctionPrompt.js +13 -14
- package/lib/prompts/createModulePrompt.js +8 -9
- package/lib/prompts/createProjectPrompt.d.ts +11 -4
- package/lib/prompts/createProjectPrompt.js +14 -9
- package/lib/prompts/createTemplatePrompt.js +1 -2
- package/lib/prompts/downloadProjectPrompt.js +3 -4
- package/lib/prompts/installPublicAppPrompt.js +6 -5
- package/lib/prompts/personalAccessKeyPrompt.js +17 -18
- package/lib/prompts/previewPrompt.js +5 -6
- package/lib/prompts/projectAddPrompt.js +4 -5
- package/lib/prompts/projectDevTargetAccountPrompt.js +11 -12
- package/lib/prompts/projectNamePrompt.js +5 -6
- package/lib/prompts/projectsLogsPrompt.js +3 -2
- package/lib/prompts/promptUtils.d.ts +1 -1
- package/lib/prompts/sandboxesPrompt.js +5 -6
- package/lib/prompts/secretPrompt.js +2 -3
- package/lib/prompts/selectHubDBTablePrompt.js +11 -8
- package/lib/prompts/selectPublicAppPrompt.js +6 -7
- package/lib/prompts/setAsDefaultAccountPrompt.js +1 -2
- package/lib/prompts/uploadPrompt.js +4 -5
- package/lib/sandboxSync.js +15 -14
- package/lib/sandboxes.js +12 -13
- package/lib/serverlessLogs.js +4 -6
- package/lib/ui/SpinniesManager.d.ts +1 -1
- package/lib/ui/boxen.d.ts +5 -0
- package/lib/ui/boxen.js +30 -0
- package/lib/ui/git.js +8 -9
- package/lib/ui/index.d.ts +4 -2
- package/lib/ui/index.js +16 -16
- package/lib/ui/logger.d.ts +10 -0
- package/lib/ui/logger.js +15 -0
- package/lib/ui/serverlessFunctionLogs.js +2 -3
- package/lib/ui/spinniesUtils.d.ts +5 -5
- package/lib/yargsUtils.d.ts +1 -1
- package/package.json +7 -6
- package/types/Yargs.d.ts +5 -11
- package/lib/projects/index.d.ts +0 -20
- package/lib/projects/index.js +0 -195
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.command = exports.describe = void 0;
|
|
7
|
+
exports.handler = handler;
|
|
8
|
+
exports.builder = builder;
|
|
9
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
12
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
13
|
+
const config_1 = require("@hubspot/local-dev-lib/constants/config");
|
|
14
|
+
const config_2 = require("@hubspot/local-dev-lib/config");
|
|
15
|
+
const lang_1 = require("../../lib/lang");
|
|
16
|
+
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
17
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
18
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
19
|
+
const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
|
|
20
|
+
const index_1 = require("../../lib/errorHandlers/index");
|
|
21
|
+
exports.describe = (0, lang_1.i18n)('commands.account.subcommands.createOverride.describe', {
|
|
22
|
+
hsAccountFileName: config_1.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
|
|
23
|
+
});
|
|
24
|
+
exports.command = 'create-override [account]';
|
|
25
|
+
async function handler(args) {
|
|
26
|
+
let overrideDefaultAccount = args.account;
|
|
27
|
+
const accountOverride = (0, config_2.getCWDAccountOverride)();
|
|
28
|
+
const overrideFilePath = (0, config_2.getDefaultAccountOverrideFilePath)();
|
|
29
|
+
if (accountOverride && overrideFilePath) {
|
|
30
|
+
logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.createOverride.accountOverride', {
|
|
31
|
+
accountOverride,
|
|
32
|
+
overrideFilePath,
|
|
33
|
+
}));
|
|
34
|
+
const { replaceOverrideFile } = await (0, promptUtils_1.promptUser)({
|
|
35
|
+
type: 'confirm',
|
|
36
|
+
name: 'replaceOverrideFile',
|
|
37
|
+
message: (0, lang_1.i18n)('commands.account.subcommands.createOverride.prompts.replaceOverrideFile'),
|
|
38
|
+
});
|
|
39
|
+
logger_1.logger.log('');
|
|
40
|
+
if (!replaceOverrideFile) {
|
|
41
|
+
const accountId = (0, config_2.getAccountId)(accountOverride) || undefined;
|
|
42
|
+
(0, usageTracking_1.trackCommandMetadataUsage)('account-createOverride', {
|
|
43
|
+
command: 'hs account create-override',
|
|
44
|
+
step: 'Reject overwriting an override via prompt',
|
|
45
|
+
}, accountId);
|
|
46
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (!overrideDefaultAccount) {
|
|
50
|
+
overrideDefaultAccount = await (0, accountsPrompt_1.selectAccountFromConfig)();
|
|
51
|
+
}
|
|
52
|
+
else if (!(0, config_2.getAccountId)(overrideDefaultAccount)) {
|
|
53
|
+
logger_1.logger.error((0, lang_1.i18n)('commands.account.subcommands.createOverride.errors.accountNotFound', {
|
|
54
|
+
configPath: (0, config_2.getConfigPath)() || '',
|
|
55
|
+
}));
|
|
56
|
+
overrideDefaultAccount = await (0, accountsPrompt_1.selectAccountFromConfig)();
|
|
57
|
+
}
|
|
58
|
+
const accountId = (0, config_2.getAccountId)(overrideDefaultAccount);
|
|
59
|
+
try {
|
|
60
|
+
const overrideFilePath = path_1.default.join((0, path_2.getCwd)(), config_1.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME);
|
|
61
|
+
await fs_extra_1.default.writeFile(overrideFilePath, accountId.toString(), 'utf8');
|
|
62
|
+
logger_1.logger.success((0, lang_1.i18n)('commands.account.subcommands.createOverride.success', {
|
|
63
|
+
overrideFilePath,
|
|
64
|
+
}));
|
|
65
|
+
const trackingId = accountId || undefined;
|
|
66
|
+
(0, usageTracking_1.trackCommandMetadataUsage)('config-migrate', {
|
|
67
|
+
command: 'hs config migrate',
|
|
68
|
+
step: 'Confirm overwriting an override via prompt',
|
|
69
|
+
successful: true,
|
|
70
|
+
}, trackingId);
|
|
71
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
(0, index_1.logError)(e);
|
|
75
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function builder(yargs) {
|
|
79
|
+
yargs.positional('account', {
|
|
80
|
+
describe: (0, lang_1.i18n)('commands.account.subcommands.createOverride.options.account.describe'),
|
|
81
|
+
type: 'string',
|
|
82
|
+
});
|
|
83
|
+
yargs.example([
|
|
84
|
+
[
|
|
85
|
+
'$0 account create-override',
|
|
86
|
+
(0, lang_1.i18n)('commands.account.subcommands.createOverride.examples.default', {
|
|
87
|
+
hsAccountFileName: config_1.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
|
|
88
|
+
}),
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
'$0 account create-override 12345678',
|
|
92
|
+
(0, lang_1.i18n)('commands.account.subcommands.createOverride.examples.idBased', {
|
|
93
|
+
hsAccountFileName: config_1.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
|
|
94
|
+
}),
|
|
95
|
+
],
|
|
96
|
+
[
|
|
97
|
+
'$0 account create-override MyAccount',
|
|
98
|
+
(0, lang_1.i18n)('commands.account.subcommands.createOverride.examples.nameBased', {
|
|
99
|
+
hsAccountFileName: config_1.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
|
|
100
|
+
}),
|
|
101
|
+
],
|
|
102
|
+
]);
|
|
103
|
+
return yargs;
|
|
104
|
+
}
|
package/commands/account/info.js
CHANGED
|
@@ -7,6 +7,7 @@ const config_1 = require("@hubspot/local-dev-lib/config");
|
|
|
7
7
|
const personalAccessKey_1 = require("@hubspot/local-dev-lib/personalAccessKey");
|
|
8
8
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
9
9
|
const lang_1 = require("../../lib/lang");
|
|
10
|
+
const index_1 = require("../../lib/ui/index");
|
|
10
11
|
const table_1 = require("../../lib/ui/table");
|
|
11
12
|
exports.describe = (0, lang_1.i18n)(`commands.account.subcommands.info.describe`);
|
|
12
13
|
exports.command = 'info [account]';
|
|
@@ -19,8 +20,32 @@ async function handler(args) {
|
|
|
19
20
|
let scopeGroups = [];
|
|
20
21
|
const response = await (0, personalAccessKey_1.getAccessToken)(personalAccessKey, env, derivedAccountId);
|
|
21
22
|
scopeGroups = response.scopeGroups.map(s => [s]);
|
|
23
|
+
// If a default account is present in the config, display it
|
|
24
|
+
const configPath = (0, config_1.getConfigPath)();
|
|
25
|
+
if (configPath) {
|
|
26
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.defaultAccountTitle`));
|
|
27
|
+
logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.info.configPath`, {
|
|
28
|
+
configPath,
|
|
29
|
+
})}`);
|
|
30
|
+
logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.info.defaultAccount`, {
|
|
31
|
+
account: (0, config_1.getDisplayDefaultAccount)(),
|
|
32
|
+
})}`);
|
|
33
|
+
}
|
|
34
|
+
// If a default account override is present, display it
|
|
35
|
+
const overrideFilePath = (0, config_1.getDefaultAccountOverrideFilePath)();
|
|
36
|
+
if (overrideFilePath) {
|
|
37
|
+
logger_1.logger.log('');
|
|
38
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.overrideFilePathTitle`));
|
|
39
|
+
logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.info.overrideFilePath`, { overrideFilePath })}`);
|
|
40
|
+
logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.info.overrideAccount`, {
|
|
41
|
+
account: (0, config_1.getConfigDefaultAccount)(),
|
|
42
|
+
})}`);
|
|
43
|
+
}
|
|
44
|
+
logger_1.logger.log('');
|
|
22
45
|
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.name`, { name: name }));
|
|
23
|
-
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.accountId`, {
|
|
46
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.accountId`, {
|
|
47
|
+
accountId: derivedAccountId,
|
|
48
|
+
}));
|
|
24
49
|
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.scopeGroups`));
|
|
25
50
|
logger_1.logger.log((0, table_1.getTableContents)(scopeGroups, { border: { bodyLeft: ' ' } }));
|
|
26
51
|
}
|
|
@@ -34,9 +59,18 @@ function accountInfoBuilder(yargs) {
|
|
|
34
59
|
type: 'string',
|
|
35
60
|
});
|
|
36
61
|
yargs.example([
|
|
37
|
-
[
|
|
38
|
-
|
|
39
|
-
|
|
62
|
+
[
|
|
63
|
+
'$0 accounts info',
|
|
64
|
+
(0, lang_1.i18n)(`commands.account.subcommands.info.examples.default`),
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
'$0 accounts info MyAccount',
|
|
68
|
+
(0, lang_1.i18n)(`commands.account.subcommands.info.examples.nameBased`),
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
'$0 accounts info 1234567',
|
|
72
|
+
(0, lang_1.i18n)(`commands.account.subcommands.info.examples.idBased`),
|
|
73
|
+
],
|
|
40
74
|
]);
|
|
41
75
|
return yargs;
|
|
42
76
|
}
|
package/commands/account/list.js
CHANGED
|
@@ -7,6 +7,7 @@ const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
|
7
7
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
8
8
|
const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
|
|
9
9
|
const commonOpts_1 = require("../../lib/commonOpts");
|
|
10
|
+
const index_1 = require("../../lib/ui/index");
|
|
10
11
|
const table_1 = require("../../lib/ui/table");
|
|
11
12
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
12
13
|
const accountTypes_1 = require("../../lib/accountTypes");
|
|
@@ -80,11 +81,28 @@ async function handler(args) {
|
|
|
80
81
|
(0, lang_1.i18n)('commands.account.subcommands.list.labels.accountId'),
|
|
81
82
|
(0, lang_1.i18n)('commands.account.subcommands.list.labels.authType'),
|
|
82
83
|
]));
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
// If a default account is present in the config, display it
|
|
85
|
+
if (configPath) {
|
|
86
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.list.defaultAccountTitle`));
|
|
87
|
+
logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.list.configPath`, {
|
|
88
|
+
configPath,
|
|
89
|
+
})}`);
|
|
90
|
+
logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.list.defaultAccount`, {
|
|
91
|
+
account: (0, config_1.getDisplayDefaultAccount)(),
|
|
92
|
+
})}`);
|
|
93
|
+
logger_1.logger.log('');
|
|
94
|
+
}
|
|
95
|
+
// If a default account override is present, display it
|
|
96
|
+
const overrideFilePath = (0, config_1.getDefaultAccountOverrideFilePath)();
|
|
97
|
+
if (overrideFilePath) {
|
|
98
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.list.overrideFilePathTitle`));
|
|
99
|
+
logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.list.overrideFilePath`, { overrideFilePath })}`);
|
|
100
|
+
logger_1.logger.log(`${(0, index_1.indent)(1)}${(0, lang_1.i18n)(`commands.account.subcommands.list.overrideAccount`, {
|
|
101
|
+
account: (0, config_1.getConfigDefaultAccount)(),
|
|
102
|
+
})}`);
|
|
103
|
+
logger_1.logger.log('');
|
|
104
|
+
}
|
|
105
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.list.accounts`));
|
|
88
106
|
logger_1.logger.log((0, table_1.getTableContents)(accountData, { border: { bodyLeft: ' ' } }));
|
|
89
107
|
}
|
|
90
108
|
function builder(yargs) {
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.describe = exports.command = void 0;
|
|
4
7
|
exports.handler = handler;
|
|
5
8
|
exports.builder = builder;
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
6
10
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
11
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
8
12
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
9
13
|
const lang_1 = require("../../lib/lang");
|
|
14
|
+
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
15
|
+
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
10
16
|
const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
|
|
11
17
|
const commonOpts_1 = require("../../lib/commonOpts");
|
|
12
18
|
exports.command = 'remove [account]';
|
|
@@ -25,6 +31,28 @@ async function handler(args) {
|
|
|
25
31
|
}
|
|
26
32
|
(0, usageTracking_1.trackCommandUsage)('accounts-remove', undefined, (0, config_1.getAccountId)(accountToRemove));
|
|
27
33
|
const currentDefaultAccount = (0, config_1.getConfigDefaultAccount)();
|
|
34
|
+
const accountOverride = (0, config_1.getCWDAccountOverride)();
|
|
35
|
+
const overrideFilePath = (0, config_1.getDefaultAccountOverrideFilePath)();
|
|
36
|
+
if (overrideFilePath &&
|
|
37
|
+
accountOverride &&
|
|
38
|
+
accountOverride === accountToRemove) {
|
|
39
|
+
const { deleteOverrideFile } = await (0, promptUtils_1.promptUser)({
|
|
40
|
+
type: 'confirm',
|
|
41
|
+
name: 'deleteOverrideFile',
|
|
42
|
+
message: (0, lang_1.i18n)(`commands.account.subcommands.remove.prompts.deleteOverrideFile`, {
|
|
43
|
+
overrideFilePath,
|
|
44
|
+
accountName: accountToRemove,
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
try {
|
|
48
|
+
if (deleteOverrideFile) {
|
|
49
|
+
fs_1.default.unlinkSync(overrideFilePath);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
(0, errorHandlers_1.logError)(error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
28
56
|
await (0, config_1.deleteAccount)(accountToRemove);
|
|
29
57
|
logger_1.logger.success((0, lang_1.i18n)(`commands.account.subcommands.remove.success.accountRemoved`, {
|
|
30
58
|
accountName: accountToRemove,
|
|
@@ -45,8 +73,14 @@ function builder(yargs) {
|
|
|
45
73
|
type: 'string',
|
|
46
74
|
});
|
|
47
75
|
yargs.example([
|
|
48
|
-
[
|
|
49
|
-
|
|
76
|
+
[
|
|
77
|
+
'$0 accounts remove',
|
|
78
|
+
(0, lang_1.i18n)(`commands.account.subcommands.remove.examples.default`),
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
'$0 accounts remove MyAccount',
|
|
82
|
+
(0, lang_1.i18n)(`commands.account.subcommands.remove.examples.byName`),
|
|
83
|
+
],
|
|
50
84
|
]);
|
|
51
85
|
return yargs;
|
|
52
86
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Argv, ArgumentsCamelCase } from 'yargs';
|
|
2
|
+
import { CommonArgs } from '../../types/Yargs';
|
|
3
|
+
export declare const describe: string;
|
|
4
|
+
export declare const command = "remove-override";
|
|
5
|
+
type RemoveOverrideArgs = CommonArgs & {
|
|
6
|
+
force?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function handler(args: ArgumentsCamelCase<RemoveOverrideArgs>): Promise<void>;
|
|
9
|
+
export declare function builder(yargs: Argv): Argv<RemoveOverrideArgs>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.command = exports.describe = void 0;
|
|
7
|
+
exports.handler = handler;
|
|
8
|
+
exports.builder = builder;
|
|
9
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
11
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
12
|
+
const config_2 = require("@hubspot/local-dev-lib/constants/config");
|
|
13
|
+
const lang_1 = require("../../lib/lang");
|
|
14
|
+
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
15
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
16
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
17
|
+
const index_1 = require("../../lib/errorHandlers/index");
|
|
18
|
+
exports.describe = (0, lang_1.i18n)('commands.account.subcommands.removeOverride.describe', {
|
|
19
|
+
overrideFile: config_2.DEFAULT_ACCOUNT_OVERRIDE_FILE_NAME,
|
|
20
|
+
});
|
|
21
|
+
exports.command = 'remove-override';
|
|
22
|
+
async function handler(args) {
|
|
23
|
+
const { force } = args;
|
|
24
|
+
const accountOverride = (0, config_1.getCWDAccountOverride)();
|
|
25
|
+
const overrideFilePath = (0, config_1.getDefaultAccountOverrideFilePath)();
|
|
26
|
+
if (accountOverride && overrideFilePath) {
|
|
27
|
+
const accountId = (0, config_1.getAccountId)(accountOverride) || undefined;
|
|
28
|
+
if (!force) {
|
|
29
|
+
logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.removeOverride.accountOverride', {
|
|
30
|
+
accountOverride,
|
|
31
|
+
overrideFilePath,
|
|
32
|
+
}));
|
|
33
|
+
const { deleteOverrideFile } = await (0, promptUtils_1.promptUser)({
|
|
34
|
+
type: 'confirm',
|
|
35
|
+
name: 'deleteOverrideFile',
|
|
36
|
+
message: (0, lang_1.i18n)('commands.account.subcommands.removeOverride.prompts.deleteOverrideFile', {
|
|
37
|
+
accountOverride,
|
|
38
|
+
overrideFilePath,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
logger_1.logger.log('');
|
|
42
|
+
if (!deleteOverrideFile) {
|
|
43
|
+
(0, usageTracking_1.trackCommandMetadataUsage)('account-removeOverride', {
|
|
44
|
+
command: 'hs account remove-override',
|
|
45
|
+
step: 'Reject removing override via prompt',
|
|
46
|
+
}, accountId);
|
|
47
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
fs_extra_1.default.unlinkSync(overrideFilePath);
|
|
52
|
+
logger_1.logger.success((0, lang_1.i18n)('commands.account.subcommands.removeOverride.success'));
|
|
53
|
+
(0, usageTracking_1.trackCommandMetadataUsage)('account-removeOverride', {
|
|
54
|
+
command: 'hs account remove-override',
|
|
55
|
+
step: 'Confirm removing override file (via prompt/force)',
|
|
56
|
+
successful: true,
|
|
57
|
+
}, accountId);
|
|
58
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
(0, index_1.logError)(error);
|
|
62
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.removeOverride.noOverrideFile'));
|
|
67
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function builder(yargs) {
|
|
71
|
+
yargs.options('force', {
|
|
72
|
+
describe: (0, lang_1.i18n)('commands.account.subcommands.removeOverride.options.force.describe'),
|
|
73
|
+
type: 'boolean',
|
|
74
|
+
});
|
|
75
|
+
return yargs;
|
|
76
|
+
}
|
package/commands/account/use.js
CHANGED
|
@@ -8,6 +8,7 @@ const config_1 = require("@hubspot/local-dev-lib/config");
|
|
|
8
8
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
9
9
|
const lang_1 = require("../../lib/lang");
|
|
10
10
|
const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
|
|
11
|
+
const ui_1 = require("../../lib/ui");
|
|
11
12
|
exports.command = 'use [account]';
|
|
12
13
|
exports.describe = (0, lang_1.i18n)('commands.account.subcommands.use.describe');
|
|
13
14
|
async function handler(args) {
|
|
@@ -23,6 +24,18 @@ async function handler(args) {
|
|
|
23
24
|
newDefaultAccount = await (0, accountsPrompt_1.selectAccountFromConfig)();
|
|
24
25
|
}
|
|
25
26
|
(0, usageTracking_1.trackCommandUsage)('accounts-use', undefined, (0, config_1.getAccountId)(newDefaultAccount));
|
|
27
|
+
const accountOverride = (0, config_1.getCWDAccountOverride)();
|
|
28
|
+
const overrideFilePath = (0, config_1.getDefaultAccountOverrideFilePath)();
|
|
29
|
+
if (accountOverride && overrideFilePath) {
|
|
30
|
+
logger_1.logger.warn((0, lang_1.i18n)(`commands.account.subcommands.use.accountOverride`, {
|
|
31
|
+
accountOverride,
|
|
32
|
+
}));
|
|
33
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.use.accountOverrideCommands`, {
|
|
34
|
+
createOverrideCommand: (0, ui_1.uiCommandReference)('hs account create-override'),
|
|
35
|
+
removeOverrideCommand: (0, ui_1.uiCommandReference)('hs account remove-override'),
|
|
36
|
+
}));
|
|
37
|
+
logger_1.logger.log('');
|
|
38
|
+
}
|
|
26
39
|
(0, config_1.updateDefaultAccount)(newDefaultAccount);
|
|
27
40
|
return logger_1.logger.success((0, lang_1.i18n)('commands.account.subcommands.use.success.defaultAccountUpdated', {
|
|
28
41
|
accountName: newDefaultAccount,
|
|
@@ -34,9 +47,18 @@ function builder(yargs) {
|
|
|
34
47
|
type: 'string',
|
|
35
48
|
});
|
|
36
49
|
yargs.example([
|
|
37
|
-
[
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
[
|
|
51
|
+
'$0 accounts use',
|
|
52
|
+
(0, lang_1.i18n)('commands.account.subcommands.use.examples.default'),
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
'$0 accounts use MyAccount',
|
|
56
|
+
(0, lang_1.i18n)('commands.account.subcommands.use.examples.nameBased'),
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
'$0 accounts use 1234567',
|
|
60
|
+
(0, lang_1.i18n)('commands.account.subcommands.use.examples.idBased'),
|
|
61
|
+
],
|
|
40
62
|
]);
|
|
41
63
|
return yargs;
|
|
42
64
|
}
|
package/commands/account.js
CHANGED
|
@@ -37,24 +37,29 @@ exports.describe = exports.command = void 0;
|
|
|
37
37
|
exports.builder = builder;
|
|
38
38
|
const commonOpts_1 = require("../lib/commonOpts");
|
|
39
39
|
const lang_1 = require("../lib/lang");
|
|
40
|
+
const auth = __importStar(require("./account/auth"));
|
|
40
41
|
const list = __importStar(require("./account/list"));
|
|
41
42
|
const rename = __importStar(require("./account/rename"));
|
|
42
43
|
const use = __importStar(require("./account/use"));
|
|
43
44
|
const info = __importStar(require("./account/info"));
|
|
44
45
|
const remove = __importStar(require("./account/remove"));
|
|
45
46
|
const clean = __importStar(require("./account/clean"));
|
|
46
|
-
const
|
|
47
|
+
const createOverride = __importStar(require("./account/createOverride"));
|
|
48
|
+
const removeOverride = __importStar(require("./account/removeOverride"));
|
|
47
49
|
exports.command = ['account', 'accounts'];
|
|
48
|
-
exports.describe = (0, lang_1.i18n)(
|
|
50
|
+
exports.describe = (0, lang_1.i18n)('commands.account.describe');
|
|
49
51
|
function builder(yargs) {
|
|
50
52
|
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
51
53
|
yargs
|
|
54
|
+
.command(auth)
|
|
52
55
|
.command(list)
|
|
53
56
|
.command(rename)
|
|
54
57
|
.command(use)
|
|
55
58
|
.command(info)
|
|
56
59
|
.command(remove)
|
|
57
60
|
.command(clean)
|
|
61
|
+
.command(createOverride)
|
|
62
|
+
.command(removeOverride)
|
|
58
63
|
.demandCommand(1, '');
|
|
59
64
|
return yargs;
|
|
60
65
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ArgumentsCamelCase
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
export declare
|
|
6
|
-
declare const migrateCommand:
|
|
1
|
+
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
+
import { YargsCommandModule } from '../../types/Yargs';
|
|
3
|
+
import { MigrateAppArgs } from '../../lib/app/migrate';
|
|
4
|
+
export declare function handlerGenerator(commandTrackingName: string): (options: ArgumentsCamelCase<MigrateAppArgs>) => Promise<void>;
|
|
5
|
+
export declare const handler: (options: ArgumentsCamelCase<MigrateAppArgs>) => Promise<void>;
|
|
6
|
+
declare const migrateCommand: YargsCommandModule<unknown, MigrateAppArgs>;
|
|
7
7
|
export default migrateCommand;
|
package/commands/app/migrate.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.builder = builder;
|
|
3
|
+
exports.handler = void 0;
|
|
4
|
+
exports.handlerGenerator = handlerGenerator;
|
|
6
5
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
6
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
8
7
|
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
9
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
10
8
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
11
9
|
const lang_1 = require("../../lib/lang");
|
|
12
10
|
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
@@ -14,50 +12,58 @@ const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
|
14
12
|
const migrate_1 = require("../../lib/app/migrate");
|
|
15
13
|
const ui_1 = require("../../lib/ui");
|
|
16
14
|
const migrate_legacy_1 = require("../../lib/app/migrate_legacy");
|
|
17
|
-
const
|
|
18
|
-
|
|
15
|
+
const config_2 = require("../../lib/projects/config");
|
|
16
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
17
|
+
const { v2023_2, v2025_2 } = projects_1.PLATFORM_VERSIONS;
|
|
19
18
|
const command = 'migrate';
|
|
20
19
|
const describe = undefined; // uiBetaTag(i18n(`commands.project.subcommands.migrateApp.header.text.describe`), false);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
logger_1.logger.log('');
|
|
30
|
-
logger_1.logger.log((0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.header.text`), false));
|
|
31
|
-
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'));
|
|
32
|
-
logger_1.logger.log('');
|
|
33
|
-
try {
|
|
34
|
-
if (platformVersion === v2025_2 || platformVersion === unstable) {
|
|
35
|
-
await (0, migrate_1.migrateApp2025_2)(derivedAccountId, options);
|
|
20
|
+
function handlerGenerator(commandTrackingName) {
|
|
21
|
+
return async function handler(options) {
|
|
22
|
+
const { derivedAccountId, platformVersion, unstable } = options;
|
|
23
|
+
await (0, usageTracking_1.trackCommandUsage)(commandTrackingName, {}, derivedAccountId);
|
|
24
|
+
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
25
|
+
if (!accountConfig) {
|
|
26
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.errors.noAccountConfig`));
|
|
27
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
36
28
|
}
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
logger_1.logger.log('');
|
|
30
|
+
logger_1.logger.log((0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.header.text`), false));
|
|
31
|
+
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'));
|
|
32
|
+
logger_1.logger.log('');
|
|
33
|
+
try {
|
|
34
|
+
if (platformVersion === v2025_2 || unstable) {
|
|
35
|
+
if ((0, config_2.getIsInProject)()) {
|
|
36
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.errors.notAllowedWithinProject`, { command: (0, ui_1.uiCommandReference)('hs project migrate') }));
|
|
37
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
38
|
+
}
|
|
39
|
+
options.platformVersion = unstable
|
|
40
|
+
? projects_1.PLATFORM_VERSIONS.unstable
|
|
41
|
+
: platformVersion;
|
|
42
|
+
await (0, migrate_1.migrateApp2025_2)(derivedAccountId, options);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
await (0, migrate_legacy_1.migrateApp2023_2)(derivedAccountId, options, accountConfig);
|
|
46
|
+
}
|
|
39
47
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (error &&
|
|
50
|
+
typeof error === 'object' &&
|
|
51
|
+
'errors' in error &&
|
|
52
|
+
Array.isArray(error.errors)) {
|
|
53
|
+
error.errors.forEach(err => (0, errorHandlers_1.logError)(err));
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
(0, errorHandlers_1.logError)(error, new errorHandlers_1.ApiErrorContext({ accountId: derivedAccountId }));
|
|
57
|
+
}
|
|
58
|
+
await (0, usageTracking_1.trackCommandMetadataUsage)(commandTrackingName, { successful: false }, derivedAccountId);
|
|
59
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
47
60
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
await (0, usageTracking_1.trackCommandMetadataUsage)('migrate-app', { successful: false }, derivedAccountId);
|
|
52
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
53
|
-
}
|
|
54
|
-
await (0, usageTracking_1.trackCommandMetadataUsage)('migrate-app', { successful: true }, derivedAccountId);
|
|
55
|
-
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
61
|
+
await (0, usageTracking_1.trackCommandMetadataUsage)(commandTrackingName, { successful: true }, derivedAccountId);
|
|
62
|
+
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
63
|
+
};
|
|
56
64
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
60
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
65
|
+
exports.handler = handlerGenerator('app-migrate');
|
|
66
|
+
function appMigrateBuilder(yargs) {
|
|
61
67
|
yargs.options({
|
|
62
68
|
name: {
|
|
63
69
|
describe: (0, lang_1.i18n)(`commands.project.subcommands.migrateApp.options.name.describe`),
|
|
@@ -73,9 +79,14 @@ function builder(yargs) {
|
|
|
73
79
|
},
|
|
74
80
|
'platform-version': {
|
|
75
81
|
type: 'string',
|
|
76
|
-
choices:
|
|
82
|
+
choices: [v2023_2, v2025_2],
|
|
83
|
+
hidden: true,
|
|
84
|
+
default: v2025_2,
|
|
85
|
+
},
|
|
86
|
+
unstable: {
|
|
87
|
+
type: 'boolean',
|
|
88
|
+
default: false,
|
|
77
89
|
hidden: true,
|
|
78
|
-
default: '2023.2',
|
|
79
90
|
},
|
|
80
91
|
});
|
|
81
92
|
yargs.example([
|
|
@@ -86,10 +97,16 @@ function builder(yargs) {
|
|
|
86
97
|
]);
|
|
87
98
|
return yargs;
|
|
88
99
|
}
|
|
100
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(appMigrateBuilder, command, (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.describe`), false), {
|
|
101
|
+
useGlobalOptions: true,
|
|
102
|
+
useConfigOptions: true,
|
|
103
|
+
useAccountOptions: true,
|
|
104
|
+
useEnvironmentOptions: true,
|
|
105
|
+
});
|
|
89
106
|
const migrateCommand = {
|
|
90
107
|
command,
|
|
91
108
|
describe,
|
|
92
|
-
handler,
|
|
109
|
+
handler: exports.handler,
|
|
93
110
|
builder,
|
|
94
111
|
};
|
|
95
112
|
exports.default = migrateCommand;
|
package/commands/app.js
CHANGED
|
@@ -6,12 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.describe = exports.command = void 0;
|
|
7
7
|
exports.builder = builder;
|
|
8
8
|
const migrate_1 = __importDefault(require("./app/migrate"));
|
|
9
|
-
const commonOpts_1 = require("../lib/commonOpts");
|
|
10
9
|
exports.command = ['app', 'apps'];
|
|
11
10
|
// Keep the command hidden for now
|
|
12
11
|
exports.describe = undefined;
|
|
13
12
|
function builder(yargs) {
|
|
14
|
-
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
15
13
|
return yargs.command(migrate_1.default).demandCommand(1, '');
|
|
16
14
|
}
|
|
17
15
|
const appCommand = {
|