@hubspot/cli 7.7.16-experimental.0 → 7.7.16-experimental.10
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 +4 -0
- package/bin/hs +1 -1
- package/commands/account/auth.js +3 -3
- package/commands/app/install.d.ts +8 -0
- package/commands/app/install.js +127 -0
- package/commands/app.js +6 -1
- package/commands/auth.js +23 -25
- package/commands/getStarted.d.ts +9 -0
- package/commands/getStarted.js +274 -0
- package/commands/init.js +35 -32
- package/commands/mcp/setup.d.ts +2 -2
- package/commands/mcp/setup.js +2 -0
- package/commands/mcp/start.d.ts +2 -2
- package/commands/mcp/start.js +3 -1
- package/commands/project/cloneApp.js +4 -4
- package/commands/project/create.js +9 -9
- package/commands/project/deploy.d.ts +1 -0
- package/commands/project/deploy.js +29 -3
- package/commands/project/dev/deprecatedFlow.js +4 -4
- package/commands/project/dev/index.js +5 -5
- package/commands/project/dev/unifiedFlow.js +8 -0
- package/commands/project/upload.d.ts +2 -2
- package/commands/project/upload.js +18 -23
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +82 -0
- package/commands/project.js +2 -0
- package/commands/sandbox/delete.js +5 -5
- package/commands/testAccount/create.d.ts +6 -0
- package/commands/testAccount/create.js +160 -0
- package/commands/testAccount/createConfig.d.ts +10 -0
- package/commands/testAccount/createConfig.js +98 -0
- package/commands/testAccount/delete.d.ts +6 -0
- package/commands/testAccount/delete.js +48 -0
- package/commands/testAccount.d.ts +3 -0
- package/commands/testAccount.js +28 -0
- package/lang/en.d.ts +201 -35
- package/lang/en.js +201 -38
- package/lang/en.lyaml +9 -14
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +20 -9
- package/lib/app/migrate.js +15 -3
- package/lib/app/migrate_legacy.js +2 -3
- package/lib/app/urls.d.ts +1 -1
- package/lib/commonOpts.d.ts +2 -0
- package/lib/commonOpts.js +21 -9
- package/lib/constants.d.ts +5 -0
- package/lib/constants.js +6 -1
- package/lib/doctor/Doctor.js +1 -1
- package/lib/errorHandlers/index.js +7 -0
- package/lib/mcp/setup.d.ts +9 -0
- package/lib/mcp/setup.js +23 -21
- package/lib/middleware/__test__/configMiddleware.test.js +2 -2
- package/lib/middleware/configMiddleware.js +10 -2
- package/lib/parsing.d.ts +1 -0
- package/lib/parsing.js +11 -0
- package/lib/polling.d.ts +1 -1
- package/lib/polling.js +11 -1
- package/lib/projectProfiles.d.ts +1 -0
- package/lib/projectProfiles.js +18 -0
- package/lib/projects/add/v3AddComponent.js +4 -0
- package/lib/projects/buildAndDeploy.js +1 -1
- package/lib/projects/create/index.d.ts +3 -2
- package/lib/projects/create/index.js +11 -5
- package/lib/projects/create/v3.d.ts +3 -3
- package/lib/projects/create/v3.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +3 -0
- package/lib/projects/localDev/AppDevModeInterface.js +46 -17
- package/lib/projects/localDev/LocalDevManager.js +1 -1
- package/lib/projects/localDev/LocalDevProcess.d.ts +3 -2
- package/lib/projects/localDev/LocalDevProcess.js +16 -12
- package/lib/projects/localDev/LocalDevState.d.ts +10 -5
- package/lib/projects/localDev/LocalDevState.js +18 -20
- package/lib/projects/localDev/LocalDevWatcher.js +1 -1
- package/lib/projects/structure.d.ts +2 -2
- package/lib/projects/upload.d.ts +4 -0
- package/lib/projects/upload.js +57 -22
- package/lib/projects/urls.d.ts +2 -0
- package/lib/projects/urls.js +10 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +17 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +96 -0
- package/lib/prompts/installAppPrompt.d.ts +2 -1
- package/lib/prompts/installAppPrompt.js +12 -2
- package/lib/prompts/personalAccessKeyPrompt.js +2 -2
- package/lib/prompts/projectNameAndDestPrompt.d.ts +3 -0
- package/lib/prompts/projectNameAndDestPrompt.js +60 -0
- package/lib/prompts/promptUtils.d.ts +1 -0
- package/lib/prompts/promptUtils.js +2 -0
- package/lib/prompts/selectProjectTemplatePrompt.d.ts +26 -0
- package/lib/prompts/{createProjectPrompt.js → selectProjectTemplatePrompt.js} +6 -55
- package/lib/ui/logger.d.ts +1 -0
- package/lib/ui/logger.js +1 -0
- package/lib/validation.d.ts +1 -1
- package/lib/validation.js +4 -4
- package/lib/yargsUtils.d.ts +1 -0
- package/lib/yargsUtils.js +3 -0
- package/mcp-server/tools/index.js +2 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +3 -3
- package/mcp-server/tools/project/CreateProjectTool.js +5 -1
- package/mcp-server/tools/project/DeployProject.js +1 -1
- package/mcp-server/tools/project/UploadProjectTools.js +1 -1
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +17 -0
- package/mcp-server/tools/project/ValidateProjectTool.js +35 -0
- package/package.json +10 -9
- package/types/LocalDev.d.ts +2 -0
- package/types/Yargs.d.ts +5 -1
- package/lib/prompts/createProjectPrompt.d.ts +0 -28
|
@@ -19,10 +19,10 @@ const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
|
19
19
|
const command = 'delete';
|
|
20
20
|
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.describe`), false);
|
|
21
21
|
async function handler(args) {
|
|
22
|
-
const {
|
|
23
|
-
(0, usageTracking_1.trackCommandUsage)('sandbox-delete', {},
|
|
22
|
+
const { userProvidedAccount, derivedAccountId, force } = args;
|
|
23
|
+
(0, usageTracking_1.trackCommandUsage)('sandbox-delete', {}, derivedAccountId);
|
|
24
24
|
let accountPrompt;
|
|
25
|
-
if (!
|
|
25
|
+
if (!userProvidedAccount) {
|
|
26
26
|
if (!force) {
|
|
27
27
|
accountPrompt = await (0, sandboxesPrompt_1.deleteSandboxPrompt)();
|
|
28
28
|
}
|
|
@@ -40,7 +40,7 @@ async function handler(args) {
|
|
|
40
40
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
const sandboxAccountId = (0, config_1.getAccountId)(
|
|
43
|
+
const sandboxAccountId = (0, config_1.getAccountId)(userProvidedAccount || accountPrompt.account);
|
|
44
44
|
if (!sandboxAccountId) {
|
|
45
45
|
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noSandboxAccountId`));
|
|
46
46
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
@@ -114,7 +114,7 @@ async function handler(args) {
|
|
|
114
114
|
: `commands.sandbox.subcommands.delete.success.delete`;
|
|
115
115
|
logger_1.logger.log('');
|
|
116
116
|
logger_1.logger.success((0, lang_1.i18n)(deleteKey, {
|
|
117
|
-
account:
|
|
117
|
+
account: userProvidedAccount || accountPrompt.account,
|
|
118
118
|
sandboxHubId: sandboxAccountId || '',
|
|
119
119
|
}));
|
|
120
120
|
logger_1.logger.log('');
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, TestingArgs, YargsCommandModule, EnvironmentArgs, JSONOutputArgs } from '../../types/Yargs';
|
|
2
|
+
type CreateTestAccountArgs = CommonArgs & AccountArgs & ConfigArgs & TestingArgs & EnvironmentArgs & JSONOutputArgs & {
|
|
3
|
+
configPath?: string;
|
|
4
|
+
};
|
|
5
|
+
declare const createTestAccountCommand: YargsCommandModule<unknown, CreateTestAccountArgs>;
|
|
6
|
+
export default createTestAccountCommand;
|
|
@@ -0,0 +1,160 @@
|
|
|
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_extra_1 = __importDefault(require("fs-extra"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const developerTestAccounts_1 = require("@hubspot/local-dev-lib/api/developerTestAccounts");
|
|
9
|
+
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
10
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
11
|
+
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
12
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
13
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
14
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
15
|
+
const validation_1 = require("../../lib/validation");
|
|
16
|
+
const en_1 = require("../../lang/en");
|
|
17
|
+
const createDeveloperTestAccountConfigPrompt_1 = require("../../lib/prompts/createDeveloperTestAccountConfigPrompt");
|
|
18
|
+
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
19
|
+
const polling_1 = require("../../lib/polling");
|
|
20
|
+
const SpinniesManager_1 = __importDefault(require("../../lib/ui/SpinniesManager"));
|
|
21
|
+
const command = 'create';
|
|
22
|
+
const describe = en_1.commands.testAccount.create.describe;
|
|
23
|
+
async function handler(args) {
|
|
24
|
+
const { derivedAccountId, configPath, formatOutputAsJson } = args;
|
|
25
|
+
(0, usageTracking_1.trackCommandUsage)('test-account-create', {}, derivedAccountId);
|
|
26
|
+
let accountConfigPath = configPath;
|
|
27
|
+
let testAccountConfig;
|
|
28
|
+
if (!accountConfigPath) {
|
|
29
|
+
const createTestAccountFromConfig = await (0, promptUtils_1.listPrompt)(en_1.commands.testAccount.create.createTestAccountFromConfigPrompt, {
|
|
30
|
+
choices: [
|
|
31
|
+
{
|
|
32
|
+
name: en_1.commands.testAccount.create.createFromConfigOption,
|
|
33
|
+
value: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: en_1.commands.testAccount.create.createFromScratchOption,
|
|
37
|
+
value: false,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
if (createTestAccountFromConfig) {
|
|
42
|
+
const configPathPromptResult = await (0, promptUtils_1.promptUser)({
|
|
43
|
+
name: 'configPath',
|
|
44
|
+
message: en_1.commands.testAccount.create.configPathPrompt,
|
|
45
|
+
type: 'input',
|
|
46
|
+
});
|
|
47
|
+
accountConfigPath = configPathPromptResult.configPath;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (accountConfigPath) {
|
|
51
|
+
const absoluteConfigPath = path_1.default.resolve((0, path_2.getCwd)(), accountConfigPath);
|
|
52
|
+
if (!(0, validation_1.fileExists)(absoluteConfigPath)) {
|
|
53
|
+
logger_1.uiLogger.error(en_1.commands.testAccount.create.errors.configFileNotFound(absoluteConfigPath));
|
|
54
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
testAccountConfig = JSON.parse(fs_extra_1.default.readFileSync(absoluteConfigPath, 'utf8'));
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
logger_1.uiLogger.error(en_1.commands.testAccount.create.errors.configFileParseFailed(absoluteConfigPath));
|
|
61
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
testAccountConfig = await (0, createDeveloperTestAccountConfigPrompt_1.createDeveloperTestAccountConfigPrompt)();
|
|
66
|
+
}
|
|
67
|
+
const jsonOutput = {};
|
|
68
|
+
let testAccountId;
|
|
69
|
+
SpinniesManager_1.default.init({
|
|
70
|
+
succeedColor: 'white',
|
|
71
|
+
});
|
|
72
|
+
SpinniesManager_1.default.add('createTestAccount', {
|
|
73
|
+
text: en_1.commands.testAccount.create.polling.start(testAccountConfig.accountName),
|
|
74
|
+
});
|
|
75
|
+
try {
|
|
76
|
+
const { data } = await (0, developerTestAccounts_1.createDeveloperTestAccount)(derivedAccountId, testAccountConfig);
|
|
77
|
+
if (formatOutputAsJson) {
|
|
78
|
+
jsonOutput.accountName = data.accountName;
|
|
79
|
+
jsonOutput.accountId = data.id;
|
|
80
|
+
}
|
|
81
|
+
testAccountId = data.id;
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
SpinniesManager_1.default.fail('createTestAccount', {
|
|
85
|
+
text: en_1.commands.testAccount.create.polling.createFailure,
|
|
86
|
+
});
|
|
87
|
+
(0, errorHandlers_1.logError)(err);
|
|
88
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
89
|
+
}
|
|
90
|
+
SpinniesManager_1.default.update('createTestAccount', {
|
|
91
|
+
text: en_1.commands.testAccount.create.polling.syncing,
|
|
92
|
+
});
|
|
93
|
+
try {
|
|
94
|
+
await (0, polling_1.poll)(() => (0, developerTestAccounts_1.fetchDeveloperTestAccountGateSyncStatus)(derivedAccountId, testAccountId), {
|
|
95
|
+
successStates: ['SUCCESS'],
|
|
96
|
+
errorStates: [],
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
(0, errorHandlers_1.debugError)(err);
|
|
101
|
+
SpinniesManager_1.default.fail('createTestAccount', {
|
|
102
|
+
text: en_1.commands.testAccount.create.polling.syncFailure,
|
|
103
|
+
});
|
|
104
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
105
|
+
}
|
|
106
|
+
if (formatOutputAsJson) {
|
|
107
|
+
// HACK: The status endpoint sometimes returns an early success status.
|
|
108
|
+
// Sleep for an extra 10 seconds to make sure the sync is actually complete.
|
|
109
|
+
await new Promise(resolve => setTimeout(resolve, 10000));
|
|
110
|
+
try {
|
|
111
|
+
// Attempt to generate a new personal access key for the test account now that gate sync is complete.
|
|
112
|
+
const { data } = await (0, developerTestAccounts_1.generateDeveloperTestAccountPersonalAccessKey)(derivedAccountId, testAccountId);
|
|
113
|
+
if (data.personalAccessKey && data.personalAccessKey) {
|
|
114
|
+
jsonOutput.personalAccessKey = data.personalAccessKey;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
(0, errorHandlers_1.debugError)(err);
|
|
119
|
+
SpinniesManager_1.default.fail('createTestAccount', {
|
|
120
|
+
text: en_1.commands.testAccount.create.polling.pakFailure,
|
|
121
|
+
});
|
|
122
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
SpinniesManager_1.default.succeed('createTestAccount', {
|
|
126
|
+
text: en_1.commands.testAccount.create.polling.success(testAccountConfig.accountName, testAccountId),
|
|
127
|
+
});
|
|
128
|
+
if (formatOutputAsJson) {
|
|
129
|
+
logger_1.uiLogger.json(jsonOutput);
|
|
130
|
+
}
|
|
131
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
132
|
+
}
|
|
133
|
+
function createTestAccountBuilder(yargs) {
|
|
134
|
+
yargs.option('config-path', {
|
|
135
|
+
type: 'string',
|
|
136
|
+
description: en_1.commands.testAccount.create.options.configPath,
|
|
137
|
+
});
|
|
138
|
+
yargs.example([
|
|
139
|
+
[
|
|
140
|
+
'$0 create --config-path ./test-account-config.json',
|
|
141
|
+
en_1.commands.testAccount.create.example('./test-account-config.json'),
|
|
142
|
+
],
|
|
143
|
+
]);
|
|
144
|
+
return yargs;
|
|
145
|
+
}
|
|
146
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(createTestAccountBuilder, command, describe, {
|
|
147
|
+
useGlobalOptions: true,
|
|
148
|
+
useEnvironmentOptions: true,
|
|
149
|
+
useAccountOptions: true,
|
|
150
|
+
useConfigOptions: true,
|
|
151
|
+
useTestingOptions: true,
|
|
152
|
+
useJSONOutputOptions: true,
|
|
153
|
+
});
|
|
154
|
+
const createTestAccountCommand = {
|
|
155
|
+
command,
|
|
156
|
+
describe,
|
|
157
|
+
handler,
|
|
158
|
+
builder,
|
|
159
|
+
};
|
|
160
|
+
exports.default = createTestAccountCommand;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CommonArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
import { HubConfig } from '../../lib/prompts/createDeveloperTestAccountConfigPrompt';
|
|
3
|
+
type CreateTestAccountConfigArgs = CommonArgs & {
|
|
4
|
+
name?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
tiers?: HubConfig[];
|
|
7
|
+
path?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const createTestAccountConfigCommand: YargsCommandModule<unknown, CreateTestAccountConfigArgs>;
|
|
10
|
+
export default createTestAccountConfigCommand;
|
|
@@ -0,0 +1,98 @@
|
|
|
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_extra_1 = __importDefault(require("fs-extra"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
9
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
10
|
+
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
11
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
12
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
13
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
14
|
+
const en_1 = require("../../lang/en");
|
|
15
|
+
const createDeveloperTestAccountConfigPrompt_1 = require("../../lib/prompts/createDeveloperTestAccountConfigPrompt");
|
|
16
|
+
const validation_1 = require("../../lib/validation");
|
|
17
|
+
const command = 'create-config';
|
|
18
|
+
const describe = en_1.commands.testAccount.createConfig.describe;
|
|
19
|
+
async function handler(args) {
|
|
20
|
+
const { derivedAccountId, name, tiers, description, path: configPath } = args;
|
|
21
|
+
(0, usageTracking_1.trackCommandUsage)('test-account-create-config', {}, derivedAccountId);
|
|
22
|
+
let accountConfigPath = configPath;
|
|
23
|
+
const testAccountConfig = await (0, createDeveloperTestAccountConfigPrompt_1.createDeveloperTestAccountConfigPrompt)({
|
|
24
|
+
name,
|
|
25
|
+
description,
|
|
26
|
+
tiers,
|
|
27
|
+
});
|
|
28
|
+
if (!accountConfigPath) {
|
|
29
|
+
const pathPromptResult = await (0, promptUtils_1.promptUser)({
|
|
30
|
+
name: 'path',
|
|
31
|
+
message: en_1.commands.testAccount.createConfig.pathPrompt,
|
|
32
|
+
type: 'input',
|
|
33
|
+
default: 'test-account-config.json',
|
|
34
|
+
validate: path => {
|
|
35
|
+
if (!path) {
|
|
36
|
+
return en_1.commands.testAccount.createConfig.errors.pathError;
|
|
37
|
+
}
|
|
38
|
+
else if (!path.endsWith('.json')) {
|
|
39
|
+
return en_1.commands.testAccount.createConfig.errors.pathFormatError;
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
accountConfigPath = pathPromptResult.path;
|
|
45
|
+
}
|
|
46
|
+
if (!accountConfigPath) {
|
|
47
|
+
logger_1.uiLogger.error(en_1.commands.testAccount.createConfig.errors.pathError);
|
|
48
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
49
|
+
}
|
|
50
|
+
if ((0, validation_1.fileExists)(accountConfigPath)) {
|
|
51
|
+
logger_1.uiLogger.error(en_1.commands.testAccount.createConfig.errors.pathExistsError);
|
|
52
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
fs_extra_1.default.writeFileSync(path_1.default.resolve((0, path_2.getCwd)(), accountConfigPath), JSON.stringify(testAccountConfig, null, 2), 'utf8');
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
logger_1.uiLogger.error(en_1.commands.testAccount.createConfig.errors.failedToCreate);
|
|
59
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
60
|
+
}
|
|
61
|
+
logger_1.uiLogger.success(en_1.commands.testAccount.createConfig.success.configFileCreated(accountConfigPath));
|
|
62
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
63
|
+
}
|
|
64
|
+
function createTestAccountConfigBuilder(yargs) {
|
|
65
|
+
yargs.option('name', {
|
|
66
|
+
type: 'string',
|
|
67
|
+
description: en_1.commands.testAccount.createConfig.options.name,
|
|
68
|
+
});
|
|
69
|
+
yargs.option('description', {
|
|
70
|
+
type: 'string',
|
|
71
|
+
description: en_1.commands.testAccount.createConfig.options.description,
|
|
72
|
+
});
|
|
73
|
+
yargs.option('tiers', {
|
|
74
|
+
type: 'array',
|
|
75
|
+
description: en_1.commands.testAccount.createConfig.options.tiers,
|
|
76
|
+
});
|
|
77
|
+
yargs.option('path', {
|
|
78
|
+
type: 'string',
|
|
79
|
+
description: en_1.commands.testAccount.createConfig.options.path,
|
|
80
|
+
});
|
|
81
|
+
yargs.example([
|
|
82
|
+
[
|
|
83
|
+
'$0 create-config --name my-account',
|
|
84
|
+
en_1.commands.testAccount.createConfig.example('my-account'),
|
|
85
|
+
],
|
|
86
|
+
]);
|
|
87
|
+
return yargs;
|
|
88
|
+
}
|
|
89
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(createTestAccountConfigBuilder, command, describe, {
|
|
90
|
+
useGlobalOptions: true,
|
|
91
|
+
});
|
|
92
|
+
const createTestAccountConfigCommand = {
|
|
93
|
+
command,
|
|
94
|
+
describe,
|
|
95
|
+
handler,
|
|
96
|
+
builder,
|
|
97
|
+
};
|
|
98
|
+
exports.default = createTestAccountConfigCommand;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, TestingArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type DeleteTestAccountArgs = CommonArgs & AccountArgs & ConfigArgs & TestingArgs & EnvironmentArgs & {
|
|
3
|
+
testAccountId: number;
|
|
4
|
+
};
|
|
5
|
+
declare const deleteTestAccountCommand: YargsCommandModule<unknown, DeleteTestAccountArgs>;
|
|
6
|
+
export default deleteTestAccountCommand;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const developerTestAccounts_1 = require("@hubspot/local-dev-lib/api/developerTestAccounts");
|
|
4
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
5
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
6
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
7
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
8
|
+
const en_1 = require("../../lang/en");
|
|
9
|
+
const command = 'delete <test-account-id>';
|
|
10
|
+
const describe = en_1.commands.testAccount.delete.describe;
|
|
11
|
+
async function handler(args) {
|
|
12
|
+
const { derivedAccountId, testAccountId } = args;
|
|
13
|
+
(0, usageTracking_1.trackCommandUsage)('test-account-delete', {}, derivedAccountId);
|
|
14
|
+
try {
|
|
15
|
+
await (0, developerTestAccounts_1.deleteDeveloperTestAccount)(derivedAccountId, testAccountId, true);
|
|
16
|
+
logger_1.uiLogger.success(en_1.commands.testAccount.delete.success.testAccountDeleted(testAccountId));
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
logger_1.uiLogger.error(en_1.commands.testAccount.delete.errors.failedToDelete);
|
|
20
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
21
|
+
}
|
|
22
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
23
|
+
}
|
|
24
|
+
function deleteTestAccountBuilder(yargs) {
|
|
25
|
+
yargs.positional('test-account-id', {
|
|
26
|
+
type: 'number',
|
|
27
|
+
description: en_1.commands.testAccount.delete.positionals.testAccountId,
|
|
28
|
+
required: true,
|
|
29
|
+
});
|
|
30
|
+
yargs.example([
|
|
31
|
+
['$0 delete 1234567890', en_1.commands.testAccount.delete.example(1234567890)],
|
|
32
|
+
]);
|
|
33
|
+
return yargs;
|
|
34
|
+
}
|
|
35
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(deleteTestAccountBuilder, command, describe, {
|
|
36
|
+
useGlobalOptions: true,
|
|
37
|
+
useEnvironmentOptions: true,
|
|
38
|
+
useAccountOptions: true,
|
|
39
|
+
useConfigOptions: true,
|
|
40
|
+
useTestingOptions: true,
|
|
41
|
+
});
|
|
42
|
+
const deleteTestAccountCommand = {
|
|
43
|
+
command,
|
|
44
|
+
describe,
|
|
45
|
+
handler,
|
|
46
|
+
builder,
|
|
47
|
+
};
|
|
48
|
+
exports.default = deleteTestAccountCommand;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 create_1 = __importDefault(require("./testAccount/create"));
|
|
7
|
+
const createConfig_1 = __importDefault(require("./testAccount/createConfig"));
|
|
8
|
+
const delete_1 = __importDefault(require("./testAccount/delete"));
|
|
9
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
10
|
+
const en_1 = require("../lang/en");
|
|
11
|
+
const command = ['test-account', 'test-accounts'];
|
|
12
|
+
const describe = undefined; //commands.testAccount.describe;
|
|
13
|
+
function testAccountBuilder(yargs) {
|
|
14
|
+
yargs
|
|
15
|
+
.command(create_1.default)
|
|
16
|
+
.command(createConfig_1.default)
|
|
17
|
+
.command(delete_1.default)
|
|
18
|
+
.demandCommand(1, '');
|
|
19
|
+
return yargs;
|
|
20
|
+
}
|
|
21
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(testAccountBuilder, command, en_1.commands.testAccount.describe);
|
|
22
|
+
const testAccountCommand = {
|
|
23
|
+
command,
|
|
24
|
+
describe,
|
|
25
|
+
builder,
|
|
26
|
+
handler: () => { },
|
|
27
|
+
};
|
|
28
|
+
exports.default = testAccountCommand;
|