@hubspot/cli 7.4.3-experimental.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 +71 -0
- package/api/migrate.js +58 -0
- package/bin/cli.js +8 -183
- package/commands/account/auth.d.ts +10 -0
- package/commands/account/auth.js +168 -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 +4 -5
- package/commands/app/migrate.js +24 -12
- package/commands/auth.js +14 -11
- package/commands/cms/lighthouseScore.js +6 -2
- 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.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.js +17 -13
- package/commands/project/cloneApp.d.ts +5 -1
- package/commands/project/cloneApp.js +17 -12
- 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 +12 -8
- package/commands/project/dev/unifiedFlow.js +2 -3
- package/commands/project/download.js +8 -9
- package/commands/project/installDeps.d.ts +9 -1
- package/commands/project/installDeps.js +46 -31
- package/commands/project/listBuilds.js +15 -11
- package/commands/project/logs.d.ts +13 -1
- package/commands/project/logs.js +72 -63
- package/commands/project/migrate.d.ts +11 -0
- package/commands/project/migrate.js +67 -0
- package/commands/project/migrateApp.d.ts +4 -4
- package/commands/project/migrateApp.js +7 -5
- package/commands/project/open.js +11 -5
- package/commands/project/upload.d.ts +12 -0
- package/commands/project/upload.js +67 -50
- package/commands/project/watch.js +22 -6
- package/commands/project.js +3 -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 +2792 -0
- package/lang/en.js +2648 -3300
- package/lang/en.lyaml +97 -43
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +12 -0
- package/lib/app/migrate.d.ts +10 -6
- package/lib/app/migrate.js +206 -220
- package/lib/app/migrate_legacy.d.ts +4 -0
- package/lib/app/migrate_legacy.js +132 -0
- package/lib/configMigrate.d.ts +2 -0
- package/lib/configMigrate.js +104 -0
- package/lib/constants.d.ts +4 -0
- package/lib/constants.js +5 -1
- package/lib/doctor/Diagnosis.d.ts +1 -2
- package/lib/doctor/Diagnosis.js +10 -6
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -0
- package/lib/doctor/DiagnosticInfoBuilder.js +1 -0
- package/lib/doctor/Doctor.d.ts +1 -0
- package/lib/doctor/Doctor.js +18 -0
- package/lib/errorHandlers/index.js +1 -1
- package/lib/hasFeature.d.ts +3 -1
- package/lib/localDev.d.ts +2 -1
- package/lib/localDev.js +21 -3
- 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 +137 -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/projects/ProjectLogsManager.d.ts +1 -1
- package/lib/projects/ProjectLogsManager.js +1 -1
- package/lib/projects/index.d.ts +4 -3
- package/lib/projects/upload.d.ts +1 -1
- package/lib/prompts/promptUtils.d.ts +1 -1
- package/lib/ui/SpinniesManager.d.ts +1 -1
- package/lib/ui/index.d.ts +1 -0
- package/lib/ui/index.js +5 -0
- package/lib/ui/spinniesUtils.d.ts +5 -5
- package/package.json +7 -6
- package/types/Yargs.d.ts +0 -10
|
@@ -1,83 +1,87 @@
|
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
6
|
+
exports.builder = exports.describe = exports.command = void 0;
|
|
7
|
+
exports.handler = handler;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
11
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
12
|
+
const buildAndDeploy_1 = require("../../lib/projects/buildAndDeploy");
|
|
13
|
+
const ui_1 = require("../../lib/ui");
|
|
14
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
15
|
+
const projects_1 = require("../../lib/projects");
|
|
16
|
+
const upload_1 = require("../../lib/projects/upload");
|
|
17
|
+
const buildAndDeploy_2 = require("../../lib/projects/buildAndDeploy");
|
|
18
|
+
const lang_1 = require("../../lib/lang");
|
|
19
|
+
const constants_1 = require("../../lib/constants");
|
|
20
|
+
const index_2 = require("../../lib/errorHandlers/index");
|
|
21
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
22
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
20
23
|
exports.command = 'upload';
|
|
21
|
-
exports.describe = uiBetaTag(i18n(
|
|
22
|
-
|
|
23
|
-
const { forceCreate, message, derivedAccountId, skipValidation } =
|
|
24
|
-
const accountConfig = getAccountConfig(derivedAccountId);
|
|
24
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.upload.describe`), false);
|
|
25
|
+
async function handler(args) {
|
|
26
|
+
const { forceCreate, message, derivedAccountId, skipValidation } = args;
|
|
27
|
+
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
25
28
|
const accountType = accountConfig && accountConfig.accountType;
|
|
26
|
-
const { projectConfig, projectDir } = await getProjectConfig();
|
|
27
|
-
trackCommandUsage('project-upload', { type: accountType }, derivedAccountId);
|
|
28
|
-
validateProjectConfig(projectConfig, projectDir);
|
|
29
|
-
await ensureProjectExists(derivedAccountId, projectConfig.name, {
|
|
29
|
+
const { projectConfig, projectDir } = await (0, projects_1.getProjectConfig)();
|
|
30
|
+
(0, usageTracking_1.trackCommandUsage)('project-upload', { type: accountType }, derivedAccountId);
|
|
31
|
+
(0, projects_1.validateProjectConfig)(projectConfig, projectDir);
|
|
32
|
+
await (0, projects_1.ensureProjectExists)(derivedAccountId, projectConfig.name, {
|
|
30
33
|
forceCreate,
|
|
31
34
|
uploadCommand: true,
|
|
32
35
|
});
|
|
33
36
|
try {
|
|
34
|
-
const { result, uploadError } = await handleProjectUpload(derivedAccountId, projectConfig, projectDir, pollProjectBuildAndDeploy, message, useV3Api(projectConfig
|
|
37
|
+
const { result, uploadError } = await (0, upload_1.handleProjectUpload)(derivedAccountId, projectConfig, projectDir, buildAndDeploy_2.pollProjectBuildAndDeploy, message, (0, buildAndDeploy_1.useV3Api)(projectConfig.platformVersion), skipValidation);
|
|
35
38
|
if (uploadError) {
|
|
36
|
-
if (isSpecifiedError(uploadError, {
|
|
37
|
-
subCategory: PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
|
39
|
+
if ((0, index_1.isSpecifiedError)(uploadError, {
|
|
40
|
+
subCategory: constants_1.PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
|
38
41
|
})) {
|
|
39
|
-
logger.log();
|
|
40
|
-
logger.error(i18n(
|
|
41
|
-
logger.log();
|
|
42
|
+
logger_1.logger.log();
|
|
43
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.upload.errors.projectLockedError`));
|
|
44
|
+
logger_1.logger.log();
|
|
42
45
|
}
|
|
43
46
|
else {
|
|
44
|
-
logError(uploadError, new ApiErrorContext({
|
|
47
|
+
(0, index_2.logError)(uploadError, new index_2.ApiErrorContext({
|
|
45
48
|
accountId: derivedAccountId,
|
|
46
49
|
request: 'project upload',
|
|
47
50
|
}));
|
|
48
51
|
}
|
|
49
|
-
process.exit(EXIT_CODES.ERROR);
|
|
52
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
50
53
|
}
|
|
51
|
-
if (result.succeeded && !result.buildResult.isAutoDeployEnabled) {
|
|
52
|
-
logger.log(
|
|
54
|
+
if (result && result.succeeded && !result.buildResult.isAutoDeployEnabled) {
|
|
55
|
+
logger_1.logger.log(chalk_1.default.bold((0, lang_1.i18n)(`commands.project.subcommands.upload.logs.buildSucceeded`, {
|
|
53
56
|
buildId: result.buildId,
|
|
54
57
|
})));
|
|
55
|
-
logger.log(i18n(
|
|
56
|
-
deployCommand: uiCommandReference(`hs project deploy --build=${result.buildId}`),
|
|
58
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.project.subcommands.upload.logs.autoDeployDisabled`, {
|
|
59
|
+
deployCommand: (0, ui_1.uiCommandReference)(`hs project deploy --build=${result.buildId}`),
|
|
57
60
|
}));
|
|
58
|
-
logFeedbackMessage(result.buildId);
|
|
59
|
-
await displayWarnLogs(derivedAccountId, projectConfig.name, result.buildId);
|
|
60
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
61
|
+
(0, projects_1.logFeedbackMessage)(result.buildId);
|
|
62
|
+
await (0, buildAndDeploy_2.displayWarnLogs)(derivedAccountId, projectConfig.name, result.buildId);
|
|
63
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
catch (e) {
|
|
64
|
-
logError(e, new ApiErrorContext({
|
|
67
|
+
(0, index_2.logError)(e, new index_2.ApiErrorContext({
|
|
65
68
|
accountId: derivedAccountId,
|
|
66
69
|
request: 'project upload',
|
|
67
70
|
}));
|
|
68
|
-
process.exit(EXIT_CODES.ERROR);
|
|
71
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
69
72
|
}
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
74
|
+
}
|
|
75
|
+
function projectUploadBuilder(yargs) {
|
|
72
76
|
yargs.options({
|
|
73
77
|
'force-create': {
|
|
74
|
-
describe: i18n(
|
|
78
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.upload.options.forceCreate.describe`),
|
|
75
79
|
type: 'boolean',
|
|
76
80
|
default: false,
|
|
77
81
|
},
|
|
78
82
|
message: {
|
|
79
83
|
alias: 'm',
|
|
80
|
-
describe: i18n(
|
|
84
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.upload.options.message.describe`),
|
|
81
85
|
type: 'string',
|
|
82
86
|
default: '',
|
|
83
87
|
},
|
|
@@ -87,9 +91,22 @@ exports.builder = yargs => {
|
|
|
87
91
|
default: false,
|
|
88
92
|
},
|
|
89
93
|
});
|
|
90
|
-
yargs.example([
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
yargs.example([
|
|
95
|
+
[
|
|
96
|
+
'$0 project upload',
|
|
97
|
+
(0, lang_1.i18n)(`commands.project.subcommands.upload.examples.default`),
|
|
98
|
+
],
|
|
99
|
+
]);
|
|
94
100
|
return yargs;
|
|
101
|
+
}
|
|
102
|
+
exports.builder = (0, yargsUtils_1.makeYargsBuilder)(projectUploadBuilder, exports.command, exports.describe, {
|
|
103
|
+
useConfigOptions: true,
|
|
104
|
+
useAccountOptions: true,
|
|
105
|
+
useEnvironmentOptions: true,
|
|
106
|
+
});
|
|
107
|
+
module.exports = {
|
|
108
|
+
command: exports.command,
|
|
109
|
+
describe: exports.describe,
|
|
110
|
+
builder: exports.builder,
|
|
111
|
+
handler,
|
|
95
112
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// @ts-nocheck
|
|
4
|
+
const { uiLink } = require('../../lib/ui');
|
|
5
|
+
const { useV3Api } = require('../../lib/projects/buildAndDeploy');
|
|
6
|
+
const { uiCommandReference } = require('../../lib/ui');
|
|
4
7
|
const { i18n } = require('../../lib/lang');
|
|
5
8
|
const { createWatcher } = require('../../lib/projects/watch');
|
|
6
9
|
const { logError, ApiErrorContext } = require('../../lib/errorHandlers/index');
|
|
@@ -16,9 +19,8 @@ const { cancelStagedBuild, fetchProjectBuilds, } = require('@hubspot/local-dev-l
|
|
|
16
19
|
const { isSpecifiedError } = require('@hubspot/local-dev-lib/errors/index');
|
|
17
20
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
18
21
|
const { handleKeypress, handleExit } = require('../../lib/process');
|
|
19
|
-
const i18nKey = 'commands.project.subcommands.watch';
|
|
20
22
|
exports.command = 'watch';
|
|
21
|
-
exports.describe = uiBetaTag(i18n(
|
|
23
|
+
exports.describe = uiBetaTag(i18n(`commands.project.subcommands.watch.describe`), false);
|
|
22
24
|
const handleBuildStatus = async (accountId, projectName, buildId) => {
|
|
23
25
|
const { isAutoDeployEnabled, deployStatusTaskLocator } = await pollBuildStatus(accountId, projectName, buildId);
|
|
24
26
|
if (isAutoDeployEnabled && deployStatusTaskLocator) {
|
|
@@ -28,7 +30,7 @@ const handleBuildStatus = async (accountId, projectName, buildId) => {
|
|
|
28
30
|
};
|
|
29
31
|
const handleUserInput = (accountId, projectName, currentBuildId) => {
|
|
30
32
|
const onTerminate = async () => {
|
|
31
|
-
logger.log(i18n(
|
|
33
|
+
logger.log(i18n(`commands.project.subcommands.watch.logs.processExited`));
|
|
32
34
|
if (currentBuildId) {
|
|
33
35
|
try {
|
|
34
36
|
await cancelStagedBuild(accountId, projectName);
|
|
@@ -61,6 +63,15 @@ exports.handler = async (options) => {
|
|
|
61
63
|
const { initialUpload, derivedAccountId } = options;
|
|
62
64
|
trackCommandUsage('project-watch', null, derivedAccountId);
|
|
63
65
|
const { projectConfig, projectDir } = await getProjectConfig();
|
|
66
|
+
if (useV3Api(projectConfig?.platformVersion)) {
|
|
67
|
+
logger.error(i18n(`commands.project.subcommands.watch.errors.v3ApiError`, {
|
|
68
|
+
command: uiCommandReference('hs project watch'),
|
|
69
|
+
newCommand: uiCommandReference('hs project dev'),
|
|
70
|
+
platformVersion: projectConfig.platformVersion,
|
|
71
|
+
linkToDocs: uiLink('How to develop locally.', 'https://developers.hubspot.com/docs/guides/crm/ui-extensions/local-development'),
|
|
72
|
+
}));
|
|
73
|
+
return process.exit(EXIT_CODES.ERROR);
|
|
74
|
+
}
|
|
64
75
|
validateProjectConfig(projectConfig, projectDir);
|
|
65
76
|
await ensureProjectExists(derivedAccountId, projectConfig.name);
|
|
66
77
|
try {
|
|
@@ -77,7 +88,7 @@ exports.handler = async (options) => {
|
|
|
77
88
|
subCategory: PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
|
78
89
|
})) {
|
|
79
90
|
logger.log();
|
|
80
|
-
logger.error(i18n(
|
|
91
|
+
logger.error(i18n(`commands.project.subcommands.watch.errors.projectLockedError`));
|
|
81
92
|
logger.log();
|
|
82
93
|
}
|
|
83
94
|
else {
|
|
@@ -100,10 +111,15 @@ exports.handler = async (options) => {
|
|
|
100
111
|
exports.builder = yargs => {
|
|
101
112
|
yargs.option('initial-upload', {
|
|
102
113
|
alias: 'i',
|
|
103
|
-
describe: i18n(
|
|
114
|
+
describe: i18n(`commands.project.subcommands.watch.options.initialUpload.describe`),
|
|
104
115
|
type: 'boolean',
|
|
105
116
|
});
|
|
106
|
-
yargs.example([
|
|
117
|
+
yargs.example([
|
|
118
|
+
[
|
|
119
|
+
'$0 project watch',
|
|
120
|
+
i18n(`commands.project.subcommands.watch.examples.default`),
|
|
121
|
+
],
|
|
122
|
+
]);
|
|
107
123
|
addConfigOptions(yargs);
|
|
108
124
|
addAccountOptions(yargs);
|
|
109
125
|
addUseEnvironmentOptions(yargs);
|
package/commands/project.js
CHANGED
|
@@ -15,11 +15,11 @@ const open = require('./project/open');
|
|
|
15
15
|
const dev = require('./project/dev');
|
|
16
16
|
const add = require('./project/add');
|
|
17
17
|
const migrateApp = require('./project/migrateApp');
|
|
18
|
+
const migrate = require('./project/migrate');
|
|
18
19
|
const cloneApp = require('./project/cloneApp');
|
|
19
20
|
const installDeps = require('./project/installDeps');
|
|
20
|
-
const i18nKey = 'commands.project';
|
|
21
21
|
exports.command = ['project', 'projects'];
|
|
22
|
-
exports.describe = uiBetaTag(i18n(
|
|
22
|
+
exports.describe = uiBetaTag(i18n(`commands.project.describe`), false);
|
|
23
23
|
exports.builder = yargs => {
|
|
24
24
|
addGlobalOptions(yargs);
|
|
25
25
|
yargs
|
|
@@ -34,6 +34,7 @@ exports.builder = yargs => {
|
|
|
34
34
|
.command(download)
|
|
35
35
|
.command(open)
|
|
36
36
|
.command(migrateApp)
|
|
37
|
+
.command(migrate)
|
|
37
38
|
.command(cloneApp)
|
|
38
39
|
.command(installDeps)
|
|
39
40
|
.demandCommand(1, '');
|
package/commands/remove.js
CHANGED
|
@@ -9,18 +9,20 @@ const index_1 = require("../lib/errorHandlers/index");
|
|
|
9
9
|
const commonOpts_1 = require("../lib/commonOpts");
|
|
10
10
|
const usageTracking_1 = require("../lib/usageTracking");
|
|
11
11
|
const lang_1 = require("../lib/lang");
|
|
12
|
-
const i18nKey = 'commands.remove';
|
|
13
12
|
exports.command = 'remove <path>';
|
|
14
|
-
exports.describe = (0, lang_1.i18n)(
|
|
13
|
+
exports.describe = (0, lang_1.i18n)(`commands.remove.describe`);
|
|
15
14
|
async function handler(args) {
|
|
16
15
|
const { path: hsPath, derivedAccountId } = args;
|
|
17
16
|
(0, usageTracking_1.trackCommandUsage)('remove', undefined, derivedAccountId);
|
|
18
17
|
try {
|
|
19
18
|
await (0, fileMapper_1.deleteFile)(derivedAccountId, hsPath);
|
|
20
|
-
logger_1.logger.log((0, lang_1.i18n)(
|
|
19
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.remove.deleted`, {
|
|
20
|
+
accountId: derivedAccountId,
|
|
21
|
+
path: hsPath,
|
|
22
|
+
}));
|
|
21
23
|
}
|
|
22
24
|
catch (error) {
|
|
23
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
25
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.remove.errors.deleteFailed`, {
|
|
24
26
|
accountId: derivedAccountId,
|
|
25
27
|
path: hsPath,
|
|
26
28
|
}));
|
|
@@ -36,7 +38,7 @@ function builder(yargs) {
|
|
|
36
38
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
37
39
|
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
38
40
|
yargs.positional('path', {
|
|
39
|
-
describe: (0, lang_1.i18n)(
|
|
41
|
+
describe: (0, lang_1.i18n)(`commands.remove.positionals.path.describe`),
|
|
40
42
|
type: 'string',
|
|
41
43
|
});
|
|
42
44
|
return yargs;
|
|
@@ -21,9 +21,8 @@ const sandboxSync_1 = require("../../lib/sandboxSync");
|
|
|
21
21
|
const index_2 = require("../../lib/errorHandlers/index");
|
|
22
22
|
const buildAccount_1 = require("../../lib/buildAccount");
|
|
23
23
|
const accountNamePrompt_1 = require("../../lib/prompts/accountNamePrompt");
|
|
24
|
-
const i18nKey = 'commands.sandbox.subcommands.create';
|
|
25
24
|
exports.command = 'create';
|
|
26
|
-
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(
|
|
25
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.subcommands.create.describe`), false);
|
|
27
26
|
async function handler(args) {
|
|
28
27
|
const { name, type, force, derivedAccountId } = args;
|
|
29
28
|
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
@@ -31,7 +30,7 @@ async function handler(args) {
|
|
|
31
30
|
(0, usageTracking_1.trackCommandUsage)('sandbox-create', {}, derivedAccountId);
|
|
32
31
|
// Check if account config exists
|
|
33
32
|
if (!accountConfig) {
|
|
34
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
33
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.create.failure.noAccountConfig`, {
|
|
35
34
|
accountId: derivedAccountId,
|
|
36
35
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
37
36
|
}));
|
|
@@ -40,7 +39,7 @@ async function handler(args) {
|
|
|
40
39
|
// Default account is not a production portal
|
|
41
40
|
if (accountConfig.accountType &&
|
|
42
41
|
accountConfig.accountType !== config_2.HUBSPOT_ACCOUNT_TYPES.STANDARD) {
|
|
43
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
42
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.create.failure.invalidAccountType`, {
|
|
44
43
|
accountType: config_2.HUBSPOT_ACCOUNT_TYPE_STRINGS[config_2.HUBSPOT_ACCOUNT_TYPES[accountConfig.accountType]],
|
|
45
44
|
accountName: accountConfig.name || '',
|
|
46
45
|
}));
|
|
@@ -53,7 +52,7 @@ async function handler(args) {
|
|
|
53
52
|
typePrompt = await (0, sandboxesPrompt_1.sandboxTypePrompt)();
|
|
54
53
|
}
|
|
55
54
|
else {
|
|
56
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
55
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.create.failure.optionMissing.type`));
|
|
57
56
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
58
57
|
}
|
|
59
58
|
}
|
|
@@ -86,7 +85,7 @@ async function handler(args) {
|
|
|
86
85
|
namePrompt = await (0, accountNamePrompt_1.hubspotAccountNamePrompt)({ accountType: sandboxType });
|
|
87
86
|
}
|
|
88
87
|
else {
|
|
89
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
88
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.create.failure.optionMissing.name`));
|
|
90
89
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
91
90
|
}
|
|
92
91
|
}
|
|
@@ -111,7 +110,7 @@ async function handler(args) {
|
|
|
111
110
|
const sandboxAccountConfig = (0, config_1.getAccountConfig)(result.sandbox.sandboxHubId);
|
|
112
111
|
// Check if sandbox account config exists
|
|
113
112
|
if (!sandboxAccountConfig) {
|
|
114
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
113
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.create.failure.noSandboxAccountConfig`, {
|
|
115
114
|
accountId: result.sandbox.sandboxHubId,
|
|
116
115
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
117
116
|
}));
|
|
@@ -151,20 +150,20 @@ function builder(yargs) {
|
|
|
151
150
|
yargs.option('force', {
|
|
152
151
|
type: 'boolean',
|
|
153
152
|
alias: 'f',
|
|
154
|
-
describe: (0, lang_1.i18n)(
|
|
153
|
+
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.create.options.force.describe`),
|
|
155
154
|
});
|
|
156
155
|
yargs.option('name', {
|
|
157
|
-
describe: (0, lang_1.i18n)(
|
|
156
|
+
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.create.options.name.describe`),
|
|
158
157
|
type: 'string',
|
|
159
158
|
});
|
|
160
159
|
yargs.option('type', {
|
|
161
|
-
describe: (0, lang_1.i18n)(
|
|
160
|
+
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.create.options.type.describe`),
|
|
162
161
|
choices: Object.keys(sandboxes_1.SANDBOX_TYPE_MAP),
|
|
163
162
|
});
|
|
164
163
|
yargs.example([
|
|
165
164
|
[
|
|
166
165
|
'$0 sandbox create --name=MySandboxAccount --type=STANDARD',
|
|
167
|
-
(0, lang_1.i18n)(
|
|
166
|
+
(0, lang_1.i18n)(`commands.sandbox.subcommands.create.examples.default`),
|
|
168
167
|
],
|
|
169
168
|
]);
|
|
170
169
|
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
@@ -19,9 +19,8 @@ const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
|
|
|
19
19
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
20
20
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
21
21
|
const ui_1 = require("../../lib/ui");
|
|
22
|
-
const i18nKey = 'commands.sandbox.subcommands.delete';
|
|
23
22
|
exports.command = 'delete';
|
|
24
|
-
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(
|
|
23
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.describe`), false);
|
|
25
24
|
async function handler(args) {
|
|
26
25
|
const { providedAccountId, force } = args;
|
|
27
26
|
(0, usageTracking_1.trackCommandUsage)('sandbox-delete', {}, providedAccountId);
|
|
@@ -33,12 +32,12 @@ async function handler(args) {
|
|
|
33
32
|
else {
|
|
34
33
|
// Account is required, throw error if force flag is present and no account is specified
|
|
35
34
|
logger_1.logger.log('');
|
|
36
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
35
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noAccount`));
|
|
37
36
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
38
37
|
}
|
|
39
38
|
if (!accountPrompt) {
|
|
40
39
|
logger_1.logger.log('');
|
|
41
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
40
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noSandboxAccounts`, {
|
|
42
41
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
43
42
|
}));
|
|
44
43
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
@@ -46,7 +45,7 @@ async function handler(args) {
|
|
|
46
45
|
}
|
|
47
46
|
const sandboxAccountId = (0, config_1.getAccountId)(providedAccountId || accountPrompt.account);
|
|
48
47
|
if (!sandboxAccountId) {
|
|
49
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
48
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noSandboxAccountId`));
|
|
50
49
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
51
50
|
}
|
|
52
51
|
const isDefaultAccount = sandboxAccountId === (0, config_1.getAccountId)();
|
|
@@ -61,7 +60,7 @@ async function handler(args) {
|
|
|
61
60
|
else if (!force) {
|
|
62
61
|
const parentAccountPrompt = await (0, sandboxesPrompt_1.deleteSandboxPrompt)(true);
|
|
63
62
|
if (!parentAccountPrompt) {
|
|
64
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
63
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noParentAccount`, {
|
|
65
64
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
66
65
|
}));
|
|
67
66
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
@@ -69,7 +68,7 @@ async function handler(args) {
|
|
|
69
68
|
parentAccountId = (0, config_1.getAccountId)(parentAccountPrompt.account);
|
|
70
69
|
}
|
|
71
70
|
else {
|
|
72
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
71
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noParentAccount`, {
|
|
73
72
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
74
73
|
}));
|
|
75
74
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
@@ -80,7 +79,7 @@ async function handler(args) {
|
|
|
80
79
|
const command = `hs auth ${(0, config_1.getEnv)(sandboxAccountId) === 'qa' ? '--qa' : ''} --account=${parentAccountId}`;
|
|
81
80
|
if (parentAccountId && !(0, config_1.getAccountId)(parentAccountId)) {
|
|
82
81
|
logger_1.logger.log('');
|
|
83
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
82
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noParentPortalAvailable`, {
|
|
84
83
|
parentAccountId,
|
|
85
84
|
url,
|
|
86
85
|
command,
|
|
@@ -88,11 +87,11 @@ async function handler(args) {
|
|
|
88
87
|
logger_1.logger.log('');
|
|
89
88
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
90
89
|
}
|
|
91
|
-
logger_1.logger.debug((0, lang_1.i18n)(
|
|
90
|
+
logger_1.logger.debug((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.debug.deleting`, {
|
|
92
91
|
account: (0, ui_1.uiAccountDescription)(sandboxAccountId),
|
|
93
92
|
}));
|
|
94
93
|
if (isDefaultAccount) {
|
|
95
|
-
logger_1.logger.info((0, lang_1.i18n)(
|
|
94
|
+
logger_1.logger.info((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.defaultAccountWarning`, {
|
|
96
95
|
account: (0, ui_1.uiAccountDescription)(sandboxAccountId),
|
|
97
96
|
}));
|
|
98
97
|
logger_1.logger.log('');
|
|
@@ -103,7 +102,7 @@ async function handler(args) {
|
|
|
103
102
|
{
|
|
104
103
|
name: 'confirmSandboxDeletePrompt',
|
|
105
104
|
type: 'confirm',
|
|
106
|
-
message: (0, lang_1.i18n)(
|
|
105
|
+
message: (0, lang_1.i18n)(`commands.sandbox.subcommands.delete.confirm`, {
|
|
107
106
|
account: (0, ui_1.uiAccountDescription)(sandboxAccountId),
|
|
108
107
|
}),
|
|
109
108
|
},
|
|
@@ -114,8 +113,8 @@ async function handler(args) {
|
|
|
114
113
|
}
|
|
115
114
|
await (0, sandboxHubs_1.deleteSandbox)(parentAccountId, sandboxAccountId);
|
|
116
115
|
const deleteKey = isDefaultAccount
|
|
117
|
-
?
|
|
118
|
-
:
|
|
116
|
+
? `commands.sandbox.subcommands.delete.success.deleteDefault`
|
|
117
|
+
: `commands.sandbox.subcommands.delete.success.delete`;
|
|
119
118
|
logger_1.logger.log('');
|
|
120
119
|
logger_1.logger.success((0, lang_1.i18n)(deleteKey, {
|
|
121
120
|
account: providedAccountId || accountPrompt.account,
|
|
@@ -139,7 +138,7 @@ async function handler(args) {
|
|
|
139
138
|
// Intercept invalid key error
|
|
140
139
|
// This command uses the parent portal PAK to delete a sandbox, so we must specify which account needs a new key
|
|
141
140
|
logger_1.logger.log('');
|
|
142
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
141
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.invalidKey`, {
|
|
143
142
|
account: (0, ui_1.uiAccountDescription)(parentAccountId),
|
|
144
143
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
145
144
|
}));
|
|
@@ -150,7 +149,7 @@ async function handler(args) {
|
|
|
150
149
|
subCategory: 'SandboxErrors.USER_ACCESS_NOT_ALLOWED',
|
|
151
150
|
})) {
|
|
152
151
|
logger_1.logger.log('');
|
|
153
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
152
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.invalidUser`, {
|
|
154
153
|
accountName: (0, ui_1.uiAccountDescription)(sandboxAccountId),
|
|
155
154
|
parentAccountName: (0, ui_1.uiAccountDescription)(parentAccountId),
|
|
156
155
|
}));
|
|
@@ -162,7 +161,7 @@ async function handler(args) {
|
|
|
162
161
|
subCategory: 'SandboxErrors.SANDBOX_NOT_FOUND',
|
|
163
162
|
})) {
|
|
164
163
|
logger_1.logger.log('');
|
|
165
|
-
logger_1.logger.warn((0, lang_1.i18n)(
|
|
164
|
+
logger_1.logger.warn((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.objectNotFound`, {
|
|
166
165
|
account: (0, ui_1.uiAccountDescription)(sandboxAccountId),
|
|
167
166
|
}));
|
|
168
167
|
logger_1.logger.log('');
|
|
@@ -185,18 +184,18 @@ async function handler(args) {
|
|
|
185
184
|
}
|
|
186
185
|
function builder(yargs) {
|
|
187
186
|
yargs.option('account', {
|
|
188
|
-
describe: (0, lang_1.i18n)(
|
|
187
|
+
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.delete.options.account.describe`),
|
|
189
188
|
type: 'string',
|
|
190
189
|
});
|
|
191
190
|
yargs.option('force', {
|
|
192
191
|
type: 'boolean',
|
|
193
192
|
alias: 'f',
|
|
194
|
-
describe: (0, lang_1.i18n)(
|
|
193
|
+
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.delete.options.force.describe`),
|
|
195
194
|
});
|
|
196
195
|
yargs.example([
|
|
197
196
|
[
|
|
198
197
|
'$0 sandbox delete --account=MySandboxAccount',
|
|
199
|
-
(0, lang_1.i18n)(
|
|
198
|
+
(0, lang_1.i18n)(`commands.sandbox.subcommands.delete.examples.default`),
|
|
200
199
|
],
|
|
201
200
|
]);
|
|
202
201
|
(0, commonOpts_1.addConfigOptions)(yargs);
|
package/commands/sandbox.js
CHANGED
|
@@ -40,9 +40,8 @@ const lang_1 = require("../lib/lang");
|
|
|
40
40
|
const ui_1 = require("../lib/ui");
|
|
41
41
|
const create = __importStar(require("./sandbox/create"));
|
|
42
42
|
const del = __importStar(require("./sandbox/delete"));
|
|
43
|
-
const i18nKey = 'commands.sandbox';
|
|
44
43
|
exports.command = ['sandbox', 'sandboxes'];
|
|
45
|
-
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(
|
|
44
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.describe`), false);
|
|
46
45
|
function builder(yargs) {
|
|
47
46
|
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
48
47
|
yargs.command(create).command(del).demandCommand(1, '');
|
|
@@ -13,9 +13,8 @@ const secretPrompt_1 = require("../../lib/prompts/secretPrompt");
|
|
|
13
13
|
const lang_1 = require("../../lib/lang");
|
|
14
14
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
15
15
|
const ui_2 = require("../../lib/ui");
|
|
16
|
-
const i18nKey = 'commands.secret.subcommands.add';
|
|
17
16
|
exports.command = 'add [name]';
|
|
18
|
-
exports.describe = (0, lang_1.i18n)(
|
|
17
|
+
exports.describe = (0, lang_1.i18n)(`commands.secret.subcommands.add.describe`);
|
|
19
18
|
async function handler(args) {
|
|
20
19
|
const { name, derivedAccountId } = args;
|
|
21
20
|
let secretName = name;
|
|
@@ -27,7 +26,7 @@ async function handler(args) {
|
|
|
27
26
|
}
|
|
28
27
|
const { data: { results: secrets }, } = await (0, secrets_1.fetchSecrets)(derivedAccountId);
|
|
29
28
|
if (secrets.includes(secretName)) {
|
|
30
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
29
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.secret.subcommands.add.errors.alreadyExists`, {
|
|
31
30
|
secretName,
|
|
32
31
|
command: (0, ui_2.uiCommandReference)('hs secret update'),
|
|
33
32
|
}));
|
|
@@ -35,13 +34,13 @@ async function handler(args) {
|
|
|
35
34
|
}
|
|
36
35
|
const { secretValue } = await (0, secretPrompt_1.secretValuePrompt)();
|
|
37
36
|
await (0, secrets_1.addSecret)(derivedAccountId, secretName, secretValue);
|
|
38
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
37
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.secret.subcommands.add.success.add`, {
|
|
39
38
|
accountIdentifier: (0, ui_1.uiAccountDescription)(derivedAccountId),
|
|
40
39
|
secretName,
|
|
41
40
|
}));
|
|
42
41
|
}
|
|
43
42
|
catch (err) {
|
|
44
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
43
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.secret.subcommands.add.errors.add`, {
|
|
45
44
|
secretName: secretName || '',
|
|
46
45
|
}));
|
|
47
46
|
(0, index_1.logError)(err, new index_1.ApiErrorContext({
|
|
@@ -55,7 +54,7 @@ function builder(yargs) {
|
|
|
55
54
|
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
56
55
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
57
56
|
yargs.positional('name', {
|
|
58
|
-
describe: (0, lang_1.i18n)(
|
|
57
|
+
describe: (0, lang_1.i18n)(`commands.secret.subcommands.add.positionals.name.describe`),
|
|
59
58
|
type: 'string',
|
|
60
59
|
});
|
|
61
60
|
return yargs;
|
|
@@ -13,9 +13,8 @@ const usageTracking_1 = require("../../lib/usageTracking");
|
|
|
13
13
|
const ui_1 = require("../../lib/ui");
|
|
14
14
|
const commonOpts_1 = require("../../lib/commonOpts");
|
|
15
15
|
const lang_1 = require("../../lib/lang");
|
|
16
|
-
const i18nKey = 'commands.secret.subcommands.delete';
|
|
17
16
|
exports.command = 'delete [name]';
|
|
18
|
-
exports.describe = (0, lang_1.i18n)(
|
|
17
|
+
exports.describe = (0, lang_1.i18n)(`commands.secret.subcommands.delete.describe`);
|
|
19
18
|
async function handler(args) {
|
|
20
19
|
const { name, derivedAccountId, force } = args;
|
|
21
20
|
let secretName = name;
|
|
@@ -23,30 +22,34 @@ async function handler(args) {
|
|
|
23
22
|
try {
|
|
24
23
|
const { data: { results: secrets }, } = await (0, secrets_1.fetchSecrets)(derivedAccountId);
|
|
25
24
|
if (secretName && !secrets.includes(secretName)) {
|
|
26
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
25
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.secret.subcommands.delete.errors.noSecret`, {
|
|
26
|
+
secretName,
|
|
27
|
+
}));
|
|
27
28
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
28
29
|
}
|
|
29
30
|
if (!secretName) {
|
|
30
|
-
const { secretToModify } = await (0, secretPrompt_1.secretListPrompt)(secrets, (0, lang_1.i18n)(
|
|
31
|
+
const { secretToModify } = await (0, secretPrompt_1.secretListPrompt)(secrets, (0, lang_1.i18n)(`commands.secret.subcommands.delete.selectSecret`));
|
|
31
32
|
secretName = secretToModify;
|
|
32
33
|
}
|
|
33
34
|
const confirmDelete = force ||
|
|
34
|
-
(await (0, promptUtils_1.confirmPrompt)((0, lang_1.i18n)(
|
|
35
|
+
(await (0, promptUtils_1.confirmPrompt)((0, lang_1.i18n)(`commands.secret.subcommands.delete.confirmDelete`, {
|
|
36
|
+
secretName,
|
|
37
|
+
}), {
|
|
35
38
|
defaultAnswer: false,
|
|
36
39
|
}));
|
|
37
40
|
if (!confirmDelete) {
|
|
38
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
41
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.secret.subcommands.delete.deleteCanceled`));
|
|
39
42
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
40
43
|
}
|
|
41
44
|
await (0, secrets_1.deleteSecret)(derivedAccountId, secretName);
|
|
42
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
45
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.secret.subcommands.delete.success.delete`, {
|
|
43
46
|
accountIdentifier: (0, ui_1.uiAccountDescription)(derivedAccountId),
|
|
44
47
|
secretName,
|
|
45
48
|
}));
|
|
46
49
|
}
|
|
47
50
|
catch (err) {
|
|
48
51
|
if (secretName) {
|
|
49
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
52
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.secret.subcommands.delete.errors.delete`, {
|
|
50
53
|
secretName,
|
|
51
54
|
}));
|
|
52
55
|
}
|
|
@@ -62,7 +65,7 @@ function builder(yargs) {
|
|
|
62
65
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
63
66
|
yargs
|
|
64
67
|
.positional('name', {
|
|
65
|
-
describe: (0, lang_1.i18n)(
|
|
68
|
+
describe: (0, lang_1.i18n)(`commands.secret.subcommands.delete.positionals.name.describe`),
|
|
66
69
|
type: 'string',
|
|
67
70
|
})
|
|
68
71
|
.options('force', {
|