@hubspot/cli 7.5.11-experimental.0 → 7.7.0-experimental.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/bin/cli.js +5 -6
- package/bin/hsmcp.d.ts +2 -0
- package/bin/hsmcp.js +13 -0
- package/commands/account/auth.d.ts +3 -7
- package/commands/account/auth.js +19 -9
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +16 -9
- package/commands/account/createOverride.d.ts +3 -7
- package/commands/account/createOverride.js +23 -6
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +13 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +15 -8
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +21 -9
- package/commands/account/removeOverride.d.ts +3 -7
- package/commands/account/removeOverride.js +23 -6
- package/commands/account/rename.d.ts +3 -7
- package/commands/account/rename.js +16 -9
- package/commands/account/use.d.ts +5 -9
- package/commands/account/use.js +14 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +35 -58
- package/commands/app/migrate.d.ts +1 -2
- package/commands/app/migrate.js +7 -8
- package/commands/app/secret/add.d.ts +7 -0
- package/commands/app/secret/add.js +64 -0
- package/commands/app/secret/delete.d.ts +8 -0
- package/commands/app/secret/delete.js +87 -0
- package/commands/app/secret/list.d.ts +6 -0
- package/commands/app/secret/list.js +64 -0
- package/commands/app/secret/update.d.ts +7 -0
- package/commands/app/secret/update.js +77 -0
- package/commands/app/secret.d.ts +3 -0
- package/commands/app/secret.js +30 -0
- package/commands/app.d.ts +2 -5
- package/commands/app.js +12 -8
- package/commands/auth.d.ts +3 -7
- package/commands/auth.js +12 -5
- package/commands/cms/convertFields.d.ts +7 -1
- package/commands/cms/convertFields.js +57 -41
- package/commands/cms/getReactModule.d.ts +7 -1
- package/commands/cms/getReactModule.js +52 -34
- package/commands/cms/lighthouseScore.d.ts +8 -1
- package/commands/cms/lighthouseScore.js +129 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +24 -15
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +25 -12
- package/commands/config/migrate.d.ts +3 -7
- package/commands/config/migrate.js +25 -15
- package/commands/config/set.d.ts +5 -6
- package/commands/config/set.js +38 -14
- package/commands/config.d.ts +3 -4
- package/commands/config.js +20 -44
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -38
- package/commands/create/app.d.ts +3 -1
- package/commands/create/app.js +9 -7
- package/commands/create/function.d.ts +3 -1
- package/commands/create/function.js +11 -10
- package/commands/create/index.d.ts +5 -1
- package/commands/create/index.js +23 -11
- package/commands/create/module.d.ts +3 -1
- package/commands/create/module.js +14 -13
- package/commands/create/react-app.d.ts +3 -1
- package/commands/create/react-app.js +10 -7
- package/commands/create/template.d.ts +3 -1
- package/commands/create/template.js +14 -14
- package/commands/create/vue-app.d.ts +3 -1
- package/commands/create/vue-app.js +10 -7
- package/commands/create/webpack-serverless.d.ts +3 -1
- package/commands/create/webpack-serverless.js +10 -7
- package/commands/create/website-theme.d.ts +3 -1
- package/commands/create/website-theme.js +10 -9
- package/commands/create.d.ts +4 -24
- package/commands/create.js +64 -74
- package/commands/customObject/create.d.ts +4 -9
- package/commands/customObject/create.js +17 -10
- package/commands/customObject/schema/create.d.ts +4 -9
- package/commands/customObject/schema/create.js +18 -11
- package/commands/customObject/schema/delete.d.ts +4 -9
- package/commands/customObject/schema/delete.js +17 -10
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +17 -10
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +17 -10
- package/commands/customObject/schema/list.d.ts +4 -8
- package/commands/customObject/schema/list.js +17 -10
- package/commands/customObject/schema/update.d.ts +4 -9
- package/commands/customObject/schema/update.js +18 -11
- package/commands/customObject/schema.d.ts +3 -5
- package/commands/customObject/schema.js +27 -54
- package/commands/customObject.d.ts +3 -4
- package/commands/customObject.js +20 -45
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +32 -21
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +40 -47
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -33
- package/commands/filemanager/fetch.d.ts +4 -9
- package/commands/filemanager/fetch.js +18 -11
- package/commands/filemanager/upload.d.ts +4 -9
- package/commands/filemanager/upload.js +17 -11
- package/commands/filemanager.d.ts +3 -4
- package/commands/filemanager.js +20 -41
- package/commands/function/deploy.d.ts +6 -1
- package/commands/function/deploy.js +70 -50
- package/commands/function/list.d.ts +6 -1
- package/commands/function/list.js +44 -32
- package/commands/function/server.d.ts +10 -1
- package/commands/function/server.js +49 -38
- package/commands/function.d.ts +5 -1
- package/commands/function.js +24 -10
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +17 -10
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +17 -10
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +17 -10
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +17 -10
- package/commands/hubdb.d.ts +3 -2
- package/commands/hubdb.js +23 -45
- package/commands/init.d.ts +3 -7
- package/commands/init.js +12 -5
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +44 -43
- package/commands/list.d.ts +3 -7
- package/commands/list.js +19 -11
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -44
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -27
- package/commands/module.d.ts +3 -1
- package/commands/module.js +22 -10
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +19 -11
- package/commands/open.d.ts +3 -7
- package/commands/open.js +19 -11
- package/commands/project/cloneApp.d.ts +1 -1
- package/commands/project/cloneApp.js +2 -2
- package/commands/project/create.js +3 -3
- package/commands/project/deploy.d.ts +1 -0
- package/commands/project/deploy.js +40 -12
- package/commands/project/dev/index.d.ts +1 -4
- package/commands/project/dev/index.js +48 -16
- package/commands/project/dev/unifiedFlow.d.ts +2 -1
- package/commands/project/dev/unifiedFlow.js +85 -30
- package/commands/project/migrate.d.ts +1 -0
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +209 -0
- package/commands/project/profile/delete.d.ts +6 -0
- package/commands/project/profile/delete.js +123 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +25 -0
- package/commands/project/upload.d.ts +1 -0
- package/commands/project/upload.js +38 -8
- package/commands/project/validate.d.ts +4 -0
- package/commands/project/validate.js +53 -0
- package/commands/project.js +4 -0
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +19 -11
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +18 -11
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +18 -11
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +20 -43
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +17 -10
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +17 -10
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +17 -10
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +17 -10
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +25 -48
- package/commands/setupMcp.d.ts +8 -0
- package/commands/setupMcp.js +229 -0
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +14 -6
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +17 -10
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +16 -9
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +23 -46
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +118 -97
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +76 -65
- package/lang/en.d.ts +838 -574
- package/lang/en.js +630 -373
- package/lang/en.lyaml +30 -23
- package/lib/accountTypes.js +2 -1
- package/lib/app/migrate.d.ts +23 -0
- package/lib/app/migrate.js +14 -3
- package/lib/app/migrate_legacy.js +7 -7
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/configMigrate.js +24 -10
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -46
- package/lib/constants.d.ts +6 -0
- package/lib/constants.js +7 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +13 -39
- package/lib/doctor/Doctor.js +2 -1
- package/lib/filesystem.d.ts +1 -1
- package/lib/interpolation.d.ts +2 -3
- package/lib/lang.d.ts +2 -3
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +8 -0
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/projectProfiles.d.ts +6 -0
- package/lib/projectProfiles.js +65 -0
- package/lib/projects/buildAndDeploy.js +17 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +26 -0
- package/lib/projects/localDev/AppDevModeInterface.js +156 -0
- package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
- package/lib/projects/localDev/DevServerManagerV2.js +19 -15
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +158 -0
- package/lib/projects/localDev/LocalDevManager.js +12 -5
- package/lib/projects/localDev/LocalDevProcess.d.ts +27 -0
- package/lib/projects/localDev/LocalDevProcess.js +171 -0
- package/lib/projects/localDev/LocalDevState.d.ts +37 -0
- package/lib/projects/localDev/LocalDevState.js +78 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +56 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +17 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +92 -0
- package/lib/projects/localDev/helpers.d.ts +3 -2
- package/lib/projects/localDev/helpers.js +32 -2
- package/lib/projects/upload.d.ts +2 -1
- package/lib/projects/upload.js +2 -2
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/installAppPrompt.d.ts +1 -0
- package/lib/prompts/installAppPrompt.js +35 -0
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +6 -6
- package/lib/prompts/promptUtils.d.ts +2 -1
- package/lib/prompts/promptUtils.js +2 -1
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -8
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/ui/index.js +4 -1
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +4 -0
- package/lib/yargsUtils.js +6 -0
- package/mcp-server/index.d.ts +1 -0
- package/mcp-server/index.js +17 -0
- package/mcp-server/mcpLoader.d.ts +5 -0
- package/mcp-server/mcpLoader.js +24 -0
- package/mcp-server/tools/ExplainProjectStructureTool.d.ts +33 -0
- package/mcp-server/tools/ExplainProjectStructureTool.js +266 -0
- package/mcp-server/tools/GenerateAppComponentTool.d.ts +99 -0
- package/mcp-server/tools/GenerateAppComponentTool.js +193 -0
- package/mcp-server/tools/GenerateCardComponentTool.d.ts +74 -0
- package/mcp-server/tools/GenerateCardComponentTool.js +146 -0
- package/mcp-server/tools/GenerateProjectConfigTool.d.ts +32 -0
- package/mcp-server/tools/GenerateProjectConfigTool.js +40 -0
- package/mcp-server/tools/HubSpotCLIHelper.d.ts +16 -0
- package/mcp-server/tools/HubSpotCLIHelper.js +74 -0
- package/mcp-server/tools/UploadProjectTool.d.ts +44 -0
- package/mcp-server/tools/UploadProjectTool.js +149 -0
- package/mcp-server/tools/ValidateProjectTool.d.ts +62 -0
- package/mcp-server/tools/ValidateProjectTool.js +315 -0
- package/package.json +13 -6
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +24 -0
- package/types/LocalDev.js +2 -0
- package/types/Prompts.d.ts +0 -7
- package/types/Yargs.d.ts +8 -1
- package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
- package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -41
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
9
|
+
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
10
|
+
const projects_2 = require("@hubspot/local-dev-lib/api/projects");
|
|
11
|
+
const usageTracking_1 = require("../../../lib/usageTracking");
|
|
12
|
+
const config_1 = require("../../../lib/projects/config");
|
|
13
|
+
const ui_1 = require("../../../lib/ui");
|
|
14
|
+
const logger_1 = require("../../../lib/ui/logger");
|
|
15
|
+
const exitCodes_1 = require("../../../lib/enums/exitCodes");
|
|
16
|
+
const yargsUtils_1 = require("../../../lib/yargsUtils");
|
|
17
|
+
const en_1 = require("../../../lang/en");
|
|
18
|
+
const promptUtils_1 = require("../../../lib/prompts/promptUtils");
|
|
19
|
+
const validation_1 = require("../../../lib/validation");
|
|
20
|
+
const errorHandlers_1 = require("../../../lib/errorHandlers");
|
|
21
|
+
const command = 'delete [name]';
|
|
22
|
+
const describe = (0, ui_1.uiBetaTag)(en_1.commands.project.profile.delete.describe, false);
|
|
23
|
+
async function handler(args) {
|
|
24
|
+
const { derivedAccountId } = args;
|
|
25
|
+
(0, usageTracking_1.trackCommandUsage)('project-profile-delete', undefined, derivedAccountId);
|
|
26
|
+
const { projectConfig, projectDir } = await (0, config_1.getProjectConfig)();
|
|
27
|
+
if (!projectConfig || !projectDir) {
|
|
28
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.delete.errors.noProjectConfig);
|
|
29
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
30
|
+
}
|
|
31
|
+
const projectSourceDir = path_1.default.join(projectDir, projectConfig.srcDir);
|
|
32
|
+
let profileName = undefined;
|
|
33
|
+
if (args.name) {
|
|
34
|
+
profileName = args.name;
|
|
35
|
+
const profileFilename = (0, project_parsing_lib_1.getHsProfileFilename)(profileName);
|
|
36
|
+
if (!(0, validation_1.fileExists)(path_1.default.join(projectSourceDir, profileFilename))) {
|
|
37
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.delete.errors.noProfileFound(profileFilename));
|
|
38
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const existingProfiles = await (0, project_parsing_lib_1.getAllHsProfiles)(projectSourceDir);
|
|
43
|
+
if (existingProfiles.length === 0) {
|
|
44
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.delete.errors.noProfilesFound);
|
|
45
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
46
|
+
}
|
|
47
|
+
const promptResponse = await (0, promptUtils_1.listPrompt)(en_1.commands.project.profile.delete.prompts.deleteProfilePrompt, {
|
|
48
|
+
choices: existingProfiles.map(profile => ({
|
|
49
|
+
name: (0, project_parsing_lib_1.getHsProfileFilename)(profile),
|
|
50
|
+
value: profile,
|
|
51
|
+
})),
|
|
52
|
+
});
|
|
53
|
+
if (promptResponse) {
|
|
54
|
+
profileName = promptResponse;
|
|
55
|
+
}
|
|
56
|
+
logger_1.uiLogger.log('');
|
|
57
|
+
}
|
|
58
|
+
// This should never happen
|
|
59
|
+
if (!profileName) {
|
|
60
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
61
|
+
}
|
|
62
|
+
let targetAccountId;
|
|
63
|
+
try {
|
|
64
|
+
const profileToDelete = (0, project_parsing_lib_1.loadHsProfileFile)(projectSourceDir, profileName);
|
|
65
|
+
targetAccountId = profileToDelete?.accountId;
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
logger_1.uiLogger.debug(en_1.commands.project.profile.delete.debug.failedToLoadProfile(profileName));
|
|
69
|
+
}
|
|
70
|
+
if (targetAccountId) {
|
|
71
|
+
let projectExists = false;
|
|
72
|
+
try {
|
|
73
|
+
const fetchProjectResponse = await (0, projects_1.fetchProject)(targetAccountId, projectConfig.name);
|
|
74
|
+
projectExists = !!fetchProjectResponse.data;
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
(0, errorHandlers_1.debugError)(err);
|
|
78
|
+
}
|
|
79
|
+
if (projectExists) {
|
|
80
|
+
const confirmResponse = await (0, promptUtils_1.confirmPrompt)(en_1.commands.project.profile.delete.prompts.deleteProjectPrompt(targetAccountId), {
|
|
81
|
+
defaultAnswer: false,
|
|
82
|
+
});
|
|
83
|
+
if (confirmResponse) {
|
|
84
|
+
await (0, projects_2.deleteProject)(targetAccountId, projectConfig.name);
|
|
85
|
+
logger_1.uiLogger.log(en_1.commands.project.profile.delete.logs.deletedProject(targetAccountId));
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
logger_1.uiLogger.log(en_1.commands.project.profile.delete.logs.didNotDeleteProject(targetAccountId));
|
|
89
|
+
}
|
|
90
|
+
logger_1.uiLogger.log('');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const profileFilename = (0, project_parsing_lib_1.getHsProfileFilename)(profileName);
|
|
94
|
+
try {
|
|
95
|
+
fs_1.default.unlinkSync(path_1.default.join(projectSourceDir, profileFilename));
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
logger_1.uiLogger.error(en_1.commands.project.profile.delete.errors.failedToDeleteProfile(profileFilename));
|
|
99
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
100
|
+
}
|
|
101
|
+
logger_1.uiLogger.log(en_1.commands.project.profile.delete.logs.profileDeleted(profileFilename));
|
|
102
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
103
|
+
}
|
|
104
|
+
function projectProfileDeleteBuilder(yargs) {
|
|
105
|
+
yargs.positional('name', {
|
|
106
|
+
describe: en_1.commands.project.profile.delete.positionals.name,
|
|
107
|
+
type: 'string',
|
|
108
|
+
});
|
|
109
|
+
yargs.example([
|
|
110
|
+
['$0 project profile delete qa', en_1.commands.project.profile.delete.example],
|
|
111
|
+
]);
|
|
112
|
+
return yargs;
|
|
113
|
+
}
|
|
114
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(projectProfileDeleteBuilder, command, describe, {
|
|
115
|
+
useGlobalOptions: true,
|
|
116
|
+
});
|
|
117
|
+
const projectProfileDeleteCommand = {
|
|
118
|
+
command,
|
|
119
|
+
describe,
|
|
120
|
+
handler,
|
|
121
|
+
builder,
|
|
122
|
+
};
|
|
123
|
+
exports.default = projectProfileDeleteCommand;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
const ui_1 = require("../../lib/ui");
|
|
7
|
+
const add_1 = __importDefault(require("./profile/add"));
|
|
8
|
+
const delete_1 = __importDefault(require("./profile/delete"));
|
|
9
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
10
|
+
const en_1 = require("../../lang/en");
|
|
11
|
+
const command = ['profile', 'profiles'];
|
|
12
|
+
const describe = undefined; // uiBetaTag(commands.project.profile.describe, false);
|
|
13
|
+
const verboseDescribe = (0, ui_1.uiBetaTag)(en_1.commands.project.profile.verboseDescribe, false);
|
|
14
|
+
function projectProfileBuilder(yargs) {
|
|
15
|
+
yargs.command(add_1.default).command(delete_1.default).demandCommand(1, '');
|
|
16
|
+
return yargs;
|
|
17
|
+
}
|
|
18
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(projectProfileBuilder, command, verboseDescribe);
|
|
19
|
+
const projectProfileCommand = {
|
|
20
|
+
command,
|
|
21
|
+
describe,
|
|
22
|
+
builder,
|
|
23
|
+
handler: () => { },
|
|
24
|
+
};
|
|
25
|
+
exports.default = projectProfileCommand;
|
|
@@ -19,18 +19,40 @@ const constants_1 = require("../../lib/constants");
|
|
|
19
19
|
const index_2 = require("../../lib/errorHandlers/index");
|
|
20
20
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
21
21
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
22
|
+
const projectProfiles_1 = require("../../lib/projectProfiles");
|
|
22
23
|
const command = 'upload';
|
|
23
24
|
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.upload.describe`), false);
|
|
24
25
|
async function handler(args) {
|
|
25
|
-
const { forceCreate, message, derivedAccountId, skipValidation } = args;
|
|
26
|
-
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
27
|
-
const accountType = accountConfig && accountConfig.accountType;
|
|
26
|
+
const { forceCreate, message, derivedAccountId, providedAccountId, skipValidation, } = args;
|
|
28
27
|
const { projectConfig, projectDir } = await (0, config_2.getProjectConfig)();
|
|
29
|
-
(0, usageTracking_1.trackCommandUsage)('project-upload', { type: accountType }, derivedAccountId);
|
|
30
28
|
(0, config_2.validateProjectConfig)(projectConfig, projectDir);
|
|
29
|
+
let targetAccountId = providedAccountId;
|
|
30
|
+
if (!targetAccountId && (0, buildAndDeploy_1.useV3Api)(projectConfig.platformVersion)) {
|
|
31
|
+
if (args.profile) {
|
|
32
|
+
(0, projectProfiles_1.logProfileHeader)(args.profile);
|
|
33
|
+
const profile = (0, projectProfiles_1.loadProfile)(projectConfig, projectDir, args.profile);
|
|
34
|
+
if (!profile) {
|
|
35
|
+
(0, ui_1.uiLine)();
|
|
36
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
37
|
+
}
|
|
38
|
+
targetAccountId = profile.accountId;
|
|
39
|
+
(0, projectProfiles_1.logProfileFooter)(profile, true);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// A profile must be specified if this project has profiles configured
|
|
43
|
+
await (0, projectProfiles_1.exitIfUsingProfiles)(projectConfig, projectDir);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (!targetAccountId) {
|
|
47
|
+
// The user is not using profiles, so we can use the derived accountId
|
|
48
|
+
targetAccountId = derivedAccountId;
|
|
49
|
+
}
|
|
50
|
+
const accountConfig = (0, config_1.getAccountConfig)(targetAccountId);
|
|
51
|
+
const accountType = accountConfig && accountConfig.accountType;
|
|
52
|
+
(0, usageTracking_1.trackCommandUsage)('project-upload', { type: accountType }, targetAccountId);
|
|
31
53
|
try {
|
|
32
54
|
const { result, uploadError } = await (0, upload_1.handleProjectUpload)({
|
|
33
|
-
accountId:
|
|
55
|
+
accountId: targetAccountId,
|
|
34
56
|
projectConfig,
|
|
35
57
|
projectDir: projectDir,
|
|
36
58
|
callbackFunc: buildAndDeploy_2.pollProjectBuildAndDeploy,
|
|
@@ -39,6 +61,7 @@ async function handler(args) {
|
|
|
39
61
|
isUploadCommand: true,
|
|
40
62
|
sendIR: (0, buildAndDeploy_1.useV3Api)(projectConfig.platformVersion),
|
|
41
63
|
skipValidation,
|
|
64
|
+
profile: args.profile,
|
|
42
65
|
});
|
|
43
66
|
if (uploadError) {
|
|
44
67
|
if ((0, index_1.isSpecifiedError)(uploadError, {
|
|
@@ -50,7 +73,7 @@ async function handler(args) {
|
|
|
50
73
|
}
|
|
51
74
|
else {
|
|
52
75
|
(0, index_2.logError)(uploadError, new index_2.ApiErrorContext({
|
|
53
|
-
accountId:
|
|
76
|
+
accountId: targetAccountId,
|
|
54
77
|
request: 'project upload',
|
|
55
78
|
}));
|
|
56
79
|
}
|
|
@@ -64,13 +87,13 @@ async function handler(args) {
|
|
|
64
87
|
deployCommand: (0, ui_1.uiCommandReference)(`hs project deploy --build=${result.buildId}`),
|
|
65
88
|
}));
|
|
66
89
|
(0, ui_2.logFeedbackMessage)(result.buildId);
|
|
67
|
-
await (0, buildAndDeploy_2.displayWarnLogs)(
|
|
90
|
+
await (0, buildAndDeploy_2.displayWarnLogs)(targetAccountId, projectConfig.name, result.buildId);
|
|
68
91
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
69
92
|
}
|
|
70
93
|
}
|
|
71
94
|
catch (e) {
|
|
72
95
|
(0, index_2.logError)(e, new index_2.ApiErrorContext({
|
|
73
|
-
accountId:
|
|
96
|
+
accountId: targetAccountId,
|
|
74
97
|
request: 'project upload',
|
|
75
98
|
}));
|
|
76
99
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
@@ -95,7 +118,14 @@ function projectUploadBuilder(yargs) {
|
|
|
95
118
|
hidden: true,
|
|
96
119
|
default: false,
|
|
97
120
|
},
|
|
121
|
+
profile: {
|
|
122
|
+
type: 'string',
|
|
123
|
+
alias: 'p',
|
|
124
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.upload.options.profile.describe`),
|
|
125
|
+
hidden: true,
|
|
126
|
+
},
|
|
98
127
|
});
|
|
128
|
+
yargs.conflicts('profile', 'account');
|
|
99
129
|
yargs.example([
|
|
100
130
|
[
|
|
101
131
|
'$0 project upload',
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
8
|
+
const project_parsing_lib_2 = require("@hubspot/project-parsing-lib");
|
|
9
|
+
const ui_1 = require("../../lib/ui");
|
|
10
|
+
const config_1 = require("../../lib/projects/config");
|
|
11
|
+
const lang_1 = require("../../lib/lang");
|
|
12
|
+
const index_1 = require("../../lib/errorHandlers/index");
|
|
13
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
14
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
15
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
16
|
+
const command = 'validate';
|
|
17
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.validate.describe`), false);
|
|
18
|
+
async function handler(args) {
|
|
19
|
+
const { derivedAccountId } = args;
|
|
20
|
+
const { projectConfig, projectDir } = await (0, config_1.getProjectConfig)();
|
|
21
|
+
(0, config_1.validateProjectConfig)(projectConfig, projectDir);
|
|
22
|
+
try {
|
|
23
|
+
await (0, project_parsing_lib_2.translate)({
|
|
24
|
+
projectSourceDir: path_1.default.join(projectDir, projectConfig.srcDir),
|
|
25
|
+
platformVersion: projectConfig.platformVersion,
|
|
26
|
+
accountId: derivedAccountId,
|
|
27
|
+
});
|
|
28
|
+
logger_1.uiLogger.success('Project validated successfully. No Errors');
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
if ((0, project_parsing_lib_1.isTranslationError)(e)) {
|
|
32
|
+
logger_1.uiLogger.error(e.toString());
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
(0, index_1.logError)(e);
|
|
36
|
+
}
|
|
37
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
38
|
+
}
|
|
39
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
40
|
+
}
|
|
41
|
+
function projectValidateBuilder(yargs) {
|
|
42
|
+
return yargs;
|
|
43
|
+
}
|
|
44
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(projectValidateBuilder, command, describe, {
|
|
45
|
+
useGlobalOptions: true,
|
|
46
|
+
});
|
|
47
|
+
const projectValidateCommand = {
|
|
48
|
+
command,
|
|
49
|
+
describe,
|
|
50
|
+
handler,
|
|
51
|
+
builder,
|
|
52
|
+
};
|
|
53
|
+
exports.default = projectValidateCommand;
|
package/commands/project.js
CHANGED
|
@@ -19,6 +19,8 @@ const migrate_1 = __importDefault(require("./project/migrate"));
|
|
|
19
19
|
const migrateApp_1 = __importDefault(require("./project/migrateApp"));
|
|
20
20
|
const cloneApp_1 = __importDefault(require("./project/cloneApp"));
|
|
21
21
|
const installDeps_1 = __importDefault(require("./project/installDeps"));
|
|
22
|
+
const profile_1 = __importDefault(require("./project/profile"));
|
|
23
|
+
const validate_1 = __importDefault(require("./project/validate"));
|
|
22
24
|
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
23
25
|
const command = ['project', 'projects'];
|
|
24
26
|
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.describe`), false);
|
|
@@ -38,6 +40,8 @@ function projectBuilder(yargs) {
|
|
|
38
40
|
.command(migrate_1.default)
|
|
39
41
|
.command(cloneApp_1.default)
|
|
40
42
|
.command(installDeps_1.default)
|
|
43
|
+
.command(profile_1.default)
|
|
44
|
+
.command(validate_1.default)
|
|
41
45
|
.demandCommand(1, '');
|
|
42
46
|
return yargs;
|
|
43
47
|
}
|
package/commands/remove.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs } from '../types/Yargs';
|
|
3
|
-
export declare const command = "remove <path>";
|
|
4
|
-
export declare const describe: string;
|
|
1
|
+
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs, YargsCommandModule } from '../types/Yargs';
|
|
5
2
|
type RemoveArgs = CommonArgs & ConfigArgs & EnvironmentArgs & AccountArgs & {
|
|
6
3
|
path: string;
|
|
7
4
|
};
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export {};
|
|
5
|
+
declare const cmsRemoveCommand: YargsCommandModule<unknown, RemoveArgs>;
|
|
6
|
+
export default cmsRemoveCommand;
|
package/commands/remove.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = exports.command = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
3
|
const fileMapper_1 = require("@hubspot/local-dev-lib/api/fileMapper");
|
|
7
4
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
5
|
const index_1 = require("../lib/errorHandlers/index");
|
|
9
|
-
const commonOpts_1 = require("../lib/commonOpts");
|
|
10
6
|
const usageTracking_1 = require("../lib/usageTracking");
|
|
11
7
|
const lang_1 = require("../lib/lang");
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
9
|
+
const command = 'remove <path>';
|
|
10
|
+
const describe = (0, lang_1.i18n)(`commands.remove.describe`);
|
|
14
11
|
async function handler(args) {
|
|
15
12
|
const { path: hsPath, derivedAccountId } = args;
|
|
16
13
|
(0, usageTracking_1.trackCommandUsage)('remove', undefined, derivedAccountId);
|
|
@@ -32,14 +29,25 @@ async function handler(args) {
|
|
|
32
29
|
}));
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
|
-
function
|
|
36
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
37
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
38
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
39
|
-
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
32
|
+
function cmsRemoveBuilder(yargs) {
|
|
40
33
|
yargs.positional('path', {
|
|
41
34
|
describe: (0, lang_1.i18n)(`commands.remove.positionals.path.describe`),
|
|
42
35
|
type: 'string',
|
|
43
36
|
});
|
|
44
37
|
return yargs;
|
|
45
38
|
}
|
|
39
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(cmsRemoveBuilder, command, describe, {
|
|
40
|
+
useGlobalOptions: true,
|
|
41
|
+
useConfigOptions: true,
|
|
42
|
+
useAccountOptions: true,
|
|
43
|
+
useEnvironmentOptions: true,
|
|
44
|
+
});
|
|
45
|
+
const cmsRemoveCommand = {
|
|
46
|
+
command,
|
|
47
|
+
describe,
|
|
48
|
+
handler,
|
|
49
|
+
builder,
|
|
50
|
+
};
|
|
51
|
+
exports.default = cmsRemoveCommand;
|
|
52
|
+
// TODO Remove this legacy export once we've migrated all commands to TS
|
|
53
|
+
module.exports = cmsRemoveCommand;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "create";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs;
|
|
6
|
-
type SandboxCreateArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, TestingArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type SandboxCreateArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs & {
|
|
7
3
|
name?: string;
|
|
8
4
|
force?: boolean;
|
|
9
5
|
type?: string;
|
|
10
6
|
};
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
export {};
|
|
7
|
+
declare const sandboxCreateCommand: YargsCommandModule<unknown, SandboxCreateArgs>;
|
|
8
|
+
export default sandboxCreateCommand;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = exports.command = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
3
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
7
4
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
5
|
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
9
6
|
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
10
7
|
const config_2 = require("@hubspot/local-dev-lib/constants/config");
|
|
11
8
|
const environment_1 = require("@hubspot/local-dev-lib/environment");
|
|
12
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
13
9
|
const lang_1 = require("../../lib/lang");
|
|
14
10
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
15
11
|
const ui_1 = require("../../lib/ui");
|
|
@@ -21,8 +17,9 @@ const sandboxSync_1 = require("../../lib/sandboxSync");
|
|
|
21
17
|
const index_2 = require("../../lib/errorHandlers/index");
|
|
22
18
|
const buildAccount_1 = require("../../lib/buildAccount");
|
|
23
19
|
const accountNamePrompt_1 = require("../../lib/prompts/accountNamePrompt");
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
21
|
+
const command = 'create';
|
|
22
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.subcommands.create.describe`), false);
|
|
26
23
|
async function handler(args) {
|
|
27
24
|
const { name, type, force, derivedAccountId } = args;
|
|
28
25
|
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
@@ -146,7 +143,7 @@ async function handler(args) {
|
|
|
146
143
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
147
144
|
}
|
|
148
145
|
}
|
|
149
|
-
function
|
|
146
|
+
function sandboxCreateBuilder(yargs) {
|
|
150
147
|
yargs.option('force', {
|
|
151
148
|
type: 'boolean',
|
|
152
149
|
alias: 'f',
|
|
@@ -166,9 +163,19 @@ function builder(yargs) {
|
|
|
166
163
|
(0, lang_1.i18n)(`commands.sandbox.subcommands.create.examples.default`),
|
|
167
164
|
],
|
|
168
165
|
]);
|
|
169
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
170
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
171
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
172
|
-
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
173
166
|
return yargs;
|
|
174
167
|
}
|
|
168
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(sandboxCreateBuilder, command, describe, {
|
|
169
|
+
useGlobalOptions: true,
|
|
170
|
+
useConfigOptions: true,
|
|
171
|
+
useAccountOptions: true,
|
|
172
|
+
useEnvironmentOptions: true,
|
|
173
|
+
useTestingOptions: true,
|
|
174
|
+
});
|
|
175
|
+
const sandboxCreateCommand = {
|
|
176
|
+
command,
|
|
177
|
+
describe,
|
|
178
|
+
handler,
|
|
179
|
+
builder,
|
|
180
|
+
};
|
|
181
|
+
exports.default = sandboxCreateCommand;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "delete";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs;
|
|
6
|
-
type SandboxDeleteArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, TestingArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type SandboxDeleteArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs & {
|
|
7
3
|
account?: string;
|
|
8
4
|
force?: boolean;
|
|
9
5
|
};
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export {};
|
|
6
|
+
declare const sandboxDeleteCommand: YargsCommandModule<unknown, SandboxDeleteArgs>;
|
|
7
|
+
export default sandboxDeleteCommand;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = exports.command = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
3
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
4
|
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
8
5
|
const sandboxHubs_1 = require("@hubspot/local-dev-lib/api/sandboxHubs");
|
|
@@ -10,7 +7,6 @@ const config_1 = require("@hubspot/local-dev-lib/config");
|
|
|
10
7
|
const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
|
|
11
8
|
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
12
9
|
const environment_1 = require("@hubspot/local-dev-lib/environment");
|
|
13
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
14
10
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
15
11
|
const index_2 = require("../../lib/errorHandlers/index");
|
|
16
12
|
const lang_1 = require("../../lib/lang");
|
|
@@ -19,8 +15,9 @@ const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
|
|
|
19
15
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
20
16
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
21
17
|
const ui_1 = require("../../lib/ui");
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
19
|
+
const command = 'delete';
|
|
20
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.describe`), false);
|
|
24
21
|
async function handler(args) {
|
|
25
22
|
const { providedAccountId, force } = args;
|
|
26
23
|
(0, usageTracking_1.trackCommandUsage)('sandbox-delete', {}, providedAccountId);
|
|
@@ -182,7 +179,7 @@ async function handler(args) {
|
|
|
182
179
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
183
180
|
}
|
|
184
181
|
}
|
|
185
|
-
function
|
|
182
|
+
function sandboxDeleteBuilder(yargs) {
|
|
186
183
|
yargs.option('account', {
|
|
187
184
|
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.delete.options.account.describe`),
|
|
188
185
|
type: 'string',
|
|
@@ -198,9 +195,19 @@ function builder(yargs) {
|
|
|
198
195
|
(0, lang_1.i18n)(`commands.sandbox.subcommands.delete.examples.default`),
|
|
199
196
|
],
|
|
200
197
|
]);
|
|
201
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
202
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
203
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
204
|
-
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
205
198
|
return yargs;
|
|
206
199
|
}
|
|
200
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(sandboxDeleteBuilder, command, describe, {
|
|
201
|
+
useGlobalOptions: true,
|
|
202
|
+
useConfigOptions: true,
|
|
203
|
+
useAccountOptions: true,
|
|
204
|
+
useEnvironmentOptions: true,
|
|
205
|
+
useTestingOptions: true,
|
|
206
|
+
});
|
|
207
|
+
const sandboxDeleteCommand = {
|
|
208
|
+
command,
|
|
209
|
+
describe,
|
|
210
|
+
handler,
|
|
211
|
+
builder,
|
|
212
|
+
};
|
|
213
|
+
exports.default = sandboxDeleteCommand;
|
package/commands/sandbox.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export declare function builder(yargs: Argv): Argv;
|
|
1
|
+
import { YargsCommandModuleBucket } from '../types/Yargs';
|
|
2
|
+
declare const sandboxCommand: YargsCommandModuleBucket;
|
|
3
|
+
export default sandboxCommand;
|
package/commands/sandbox.js
CHANGED
|
@@ -1,49 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
35
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.describe = exports.command = void 0;
|
|
37
|
-
exports.builder = builder;
|
|
38
|
-
const commonOpts_1 = require("../lib/commonOpts");
|
|
39
6
|
const lang_1 = require("../lib/lang");
|
|
40
7
|
const ui_1 = require("../lib/ui");
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
yargs.command(
|
|
8
|
+
const create_1 = __importDefault(require("./sandbox/create"));
|
|
9
|
+
const delete_1 = __importDefault(require("./sandbox/delete"));
|
|
10
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
11
|
+
const command = ['sandbox', 'sandboxes'];
|
|
12
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.describe`), false);
|
|
13
|
+
function sandboxBuilder(yargs) {
|
|
14
|
+
yargs.command(create_1.default).command(delete_1.default).demandCommand(1, '');
|
|
48
15
|
return yargs;
|
|
49
16
|
}
|
|
17
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(sandboxBuilder, command, describe);
|
|
18
|
+
const sandboxCommand = {
|
|
19
|
+
command,
|
|
20
|
+
describe,
|
|
21
|
+
builder,
|
|
22
|
+
handler: () => { },
|
|
23
|
+
};
|
|
24
|
+
exports.default = sandboxCommand;
|
|
25
|
+
// TODO Remove this legacy export once we've migrated all commands to TS
|
|
26
|
+
module.exports = sandboxCommand;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "add [name]";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
type AddSecretArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type AddSecretArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
7
3
|
name?: string;
|
|
8
4
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
5
|
+
declare const addSecretCommand: YargsCommandModule<unknown, AddSecretArgs>;
|
|
6
|
+
export default addSecretCommand;
|