@hubspot/cli 3.0.10-beta.9 → 3.0.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/README.md +7 -1
- package/bin/cli.js +3 -4
- package/commands/accounts/list.js +18 -26
- package/commands/accounts/rename.js +13 -24
- package/commands/accounts.js +4 -1
- package/commands/auth.js +33 -16
- package/commands/config/set/allowUsageTracking.js +17 -33
- package/commands/config/set/defaultAccount.js +24 -34
- package/commands/config/set/defaultMode.js +25 -44
- package/commands/config/set/httpTimeout.js +10 -28
- package/commands/config/set.js +4 -1
- package/commands/config.js +4 -1
- package/commands/create/api-sample.js +20 -14
- package/commands/create/function.js +3 -1
- package/commands/create/index.js +0 -1
- package/commands/create/module.js +20 -7
- package/commands/create/template.js +22 -5
- package/commands/create/website-theme.js +12 -1
- package/commands/create.js +23 -8
- package/commands/customObject/create.js +22 -24
- package/commands/customObject/schema/create.js +30 -28
- package/commands/customObject/schema/delete.js +20 -20
- package/commands/customObject/schema/fetch-all.js +17 -24
- package/commands/customObject/schema/fetch.js +29 -24
- package/commands/customObject/schema/list.js +8 -17
- package/commands/customObject/schema/update.js +31 -29
- package/commands/customObject/schema.js +4 -1
- package/commands/customObject.js +10 -21
- package/commands/fetch.js +15 -30
- package/commands/filemanager/fetch.js +13 -25
- package/commands/filemanager/upload.js +47 -35
- package/commands/filemanager.js +4 -1
- package/commands/functions/deploy.js +34 -37
- package/commands/functions/list.js +9 -24
- package/commands/functions/server.js +13 -29
- package/commands/functions.js +4 -1
- package/commands/hubdb/clear.js +25 -21
- package/commands/hubdb/create.js +25 -22
- package/commands/hubdb/delete.js +19 -20
- package/commands/hubdb/fetch.js +15 -20
- package/commands/hubdb.js +4 -1
- package/commands/init.js +25 -13
- package/commands/lint.js +14 -23
- package/commands/list.js +19 -25
- package/commands/logs.js +22 -43
- package/commands/mv.js +21 -25
- package/commands/open.js +9 -7
- package/commands/project/create.js +13 -79
- package/commands/project/deploy.js +26 -30
- package/commands/project/listBuilds.js +6 -25
- package/commands/project/logs.js +81 -81
- package/commands/project/upload.js +68 -72
- package/commands/project/watch.js +103 -0
- package/commands/project.js +2 -0
- package/commands/remove.js +12 -20
- package/commands/sandbox/create.js +18 -13
- package/commands/secrets/addSecret.js +19 -22
- package/commands/secrets/deleteSecret.js +18 -21
- package/commands/secrets/listSecrets.js +10 -19
- package/commands/secrets/updateSecret.js +19 -22
- package/commands/secrets.js +4 -1
- package/commands/server.js +15 -6
- package/commands/{marketplaceValidate/validateTheme.js → theme/marketplace-validate.js} +26 -24
- package/commands/theme.js +5 -3
- package/commands/upload.js +66 -45
- package/commands/watch.js +33 -55
- package/lib/commonOpts.js +14 -11
- package/lib/enums/exitCodes.js +14 -0
- package/lib/links.js +0 -10
- package/lib/projects.js +57 -9
- package/lib/{createApiSamplePrompt.js → prompts/createApiSamplePrompt.js} +10 -11
- package/lib/{createFunctionPrompt.js → prompts/createFunctionPrompt.js} +27 -21
- package/lib/{createModulePrompt.js → prompts/createModulePrompt.js} +12 -9
- package/lib/prompts/createProjectPrompt.js +68 -0
- package/lib/{createTemplatePrompt.js → prompts/createTemplatePrompt.js} +7 -4
- package/lib/prompts/folderOverwritePrompt.js +17 -0
- package/lib/{prompts.js → prompts/personalAccessKeyPrompt.js} +25 -42
- package/lib/prompts/promptUtils.js +10 -0
- package/lib/prompts/sandboxesPrompt.js +24 -0
- package/lib/prompts/secretPrompt.js +25 -0
- package/lib/serverlessLogs.js +3 -2
- package/lib/ui.js +48 -0
- package/lib/validation.js +4 -3
- package/package.json +7 -7
- package/commands/app/deploy.js +0 -116
- package/commands/app.js +0 -14
- package/commands/create/project.js +0 -25
- package/lib/prompts/projects.js +0 -40
- package/lib/prompts/sandboxes.js +0 -22
- package/lib/secretPrompt.js +0 -22
|
@@ -7,25 +7,19 @@ const Spinnies = require('spinnies');
|
|
|
7
7
|
const {
|
|
8
8
|
addAccountOptions,
|
|
9
9
|
addConfigOptions,
|
|
10
|
-
setLogLevel,
|
|
11
10
|
getAccountId,
|
|
12
11
|
addUseEnvironmentOptions,
|
|
13
12
|
} = require('../../lib/commonOpts');
|
|
14
13
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
15
|
-
const { logDebugInfo } = require('../../lib/debugInfo');
|
|
16
|
-
const {
|
|
17
|
-
loadConfig,
|
|
18
|
-
validateConfig,
|
|
19
|
-
checkAndWarnGitInclusion,
|
|
20
|
-
} = require('@hubspot/cli-lib');
|
|
21
14
|
const {
|
|
22
15
|
logApiErrorInstance,
|
|
23
16
|
ApiErrorContext,
|
|
24
17
|
} = require('@hubspot/cli-lib/errorHandlers');
|
|
18
|
+
const { uiLine, uiAccountDescription } = require('../../lib/ui');
|
|
25
19
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
26
20
|
const { uploadProject } = require('@hubspot/cli-lib/api/dfs');
|
|
27
21
|
const { shouldIgnoreFile } = require('@hubspot/cli-lib/ignoreRules');
|
|
28
|
-
const {
|
|
22
|
+
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
29
23
|
const {
|
|
30
24
|
getProjectConfig,
|
|
31
25
|
validateProjectConfig,
|
|
@@ -33,31 +27,25 @@ const {
|
|
|
33
27
|
ensureProjectExists,
|
|
34
28
|
pollDeployStatus,
|
|
35
29
|
} = require('../../lib/projects');
|
|
30
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
36
31
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
logDebugInfo(options);
|
|
40
|
-
const { config: configPath } = options;
|
|
41
|
-
loadConfig(configPath, options);
|
|
42
|
-
checkAndWarnGitInclusion();
|
|
43
|
-
|
|
44
|
-
if (!(validateConfig() && (await validateAccount(options)))) {
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
32
|
+
const i18nKey = 'cli.commands.project.subcommands.upload';
|
|
33
|
+
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
48
34
|
|
|
49
35
|
exports.command = 'upload [path]';
|
|
50
|
-
exports.describe =
|
|
36
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
51
37
|
|
|
52
38
|
const uploadProjectFiles = async (accountId, projectName, filePath) => {
|
|
53
39
|
const spinnies = new Spinnies({
|
|
54
40
|
succeedColor: 'white',
|
|
55
41
|
});
|
|
42
|
+
const accountIdentifier = uiAccountDescription(accountId);
|
|
56
43
|
|
|
57
44
|
spinnies.add('upload', {
|
|
58
|
-
text:
|
|
59
|
-
|
|
60
|
-
|
|
45
|
+
text: i18n(`${i18nKey}.loading.upload.add`, {
|
|
46
|
+
accountIdentifier,
|
|
47
|
+
projectName,
|
|
48
|
+
}),
|
|
61
49
|
});
|
|
62
50
|
|
|
63
51
|
let buildId;
|
|
@@ -68,19 +56,24 @@ const uploadProjectFiles = async (accountId, projectName, filePath) => {
|
|
|
68
56
|
buildId = upload.buildId;
|
|
69
57
|
|
|
70
58
|
spinnies.succeed('upload', {
|
|
71
|
-
text:
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
text: i18n(`${i18nKey}.loading.upload.succeed`, {
|
|
60
|
+
accountIdentifier,
|
|
61
|
+
projectName,
|
|
62
|
+
}),
|
|
74
63
|
});
|
|
75
64
|
|
|
76
65
|
logger.debug(
|
|
77
|
-
|
|
66
|
+
i18n(`${i18nKey}.debug.buildCreated`, {
|
|
67
|
+
buildId,
|
|
68
|
+
projectName,
|
|
69
|
+
})
|
|
78
70
|
);
|
|
79
71
|
} catch (err) {
|
|
80
72
|
spinnies.fail('upload', {
|
|
81
|
-
text:
|
|
82
|
-
|
|
83
|
-
|
|
73
|
+
text: i18n(`${i18nKey}.loading.upload.fail`, {
|
|
74
|
+
accountIdentifier,
|
|
75
|
+
projectName,
|
|
76
|
+
}),
|
|
84
77
|
});
|
|
85
78
|
|
|
86
79
|
logApiErrorInstance(
|
|
@@ -90,14 +83,14 @@ const uploadProjectFiles = async (accountId, projectName, filePath) => {
|
|
|
90
83
|
projectName,
|
|
91
84
|
})
|
|
92
85
|
);
|
|
93
|
-
process.exit(
|
|
86
|
+
process.exit(EXIT_CODES.ERROR);
|
|
94
87
|
}
|
|
95
88
|
|
|
96
89
|
return { buildId };
|
|
97
90
|
};
|
|
98
91
|
|
|
99
92
|
exports.handler = async options => {
|
|
100
|
-
loadAndValidateOptions(options);
|
|
93
|
+
await loadAndValidateOptions(options);
|
|
101
94
|
|
|
102
95
|
const { forceCreate, path: projectPath } = options;
|
|
103
96
|
const accountId = getAccountId(options);
|
|
@@ -112,14 +105,22 @@ exports.handler = async options => {
|
|
|
112
105
|
|
|
113
106
|
const tempFile = tmp.fileSync({ postfix: '.zip' });
|
|
114
107
|
|
|
115
|
-
logger.debug(
|
|
108
|
+
logger.debug(
|
|
109
|
+
i18n(`${i18nKey}.debug.compressing`, {
|
|
110
|
+
path: tempFile.name,
|
|
111
|
+
})
|
|
112
|
+
);
|
|
116
113
|
|
|
117
114
|
const output = fs.createWriteStream(tempFile.name);
|
|
118
115
|
const archive = archiver('zip');
|
|
119
116
|
|
|
120
117
|
output.on('close', async function() {
|
|
121
|
-
let exitCode =
|
|
122
|
-
logger.debug(
|
|
118
|
+
let exitCode = EXIT_CODES.SUCCESS;
|
|
119
|
+
logger.debug(
|
|
120
|
+
i18n(`${i18nKey}.debug.compressed`, {
|
|
121
|
+
byteCount: archive.pointer(),
|
|
122
|
+
})
|
|
123
|
+
);
|
|
123
124
|
|
|
124
125
|
const { buildId } = await uploadProjectFiles(
|
|
125
126
|
accountId,
|
|
@@ -131,38 +132,17 @@ exports.handler = async options => {
|
|
|
131
132
|
isAutoDeployEnabled,
|
|
132
133
|
deployStatusTaskLocator,
|
|
133
134
|
status,
|
|
134
|
-
subbuildStatuses,
|
|
135
135
|
} = await pollBuildStatus(accountId, projectConfig.name, buildId);
|
|
136
136
|
|
|
137
137
|
if (status === 'FAILURE') {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
logger.log('-'.repeat(50));
|
|
143
|
-
logger.log(
|
|
144
|
-
`Build #${buildId} failed because there was a problem\nbuilding ${
|
|
145
|
-
failedSubbuilds.length === 1
|
|
146
|
-
? failedSubbuilds[0].buildName
|
|
147
|
-
: failedSubbuilds.length + ' components'
|
|
148
|
-
}\n`
|
|
149
|
-
);
|
|
150
|
-
logger.log('See below for a summary of errors.');
|
|
151
|
-
logger.log('-'.repeat(50));
|
|
152
|
-
|
|
153
|
-
failedSubbuilds.forEach(subbuild => {
|
|
154
|
-
logger.log(
|
|
155
|
-
`\n--- ${subbuild.buildName} failed to build with the following error ---`
|
|
156
|
-
);
|
|
157
|
-
logger.error(subbuild.errorMessage);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
exitCode = 1;
|
|
138
|
+
exitCode = EXIT_CODES.ERROR;
|
|
139
|
+
return;
|
|
161
140
|
} else if (isAutoDeployEnabled && deployStatusTaskLocator) {
|
|
162
141
|
logger.log(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
142
|
+
i18n(`${i18nKey}.logs.buildSucceededAutomaticallyDeploying`, {
|
|
143
|
+
accountIdentifier: uiAccountDescription(accountId),
|
|
144
|
+
buildId,
|
|
145
|
+
})
|
|
166
146
|
);
|
|
167
147
|
const { status } = await pollDeployStatus(
|
|
168
148
|
accountId,
|
|
@@ -171,19 +151,33 @@ exports.handler = async options => {
|
|
|
171
151
|
buildId
|
|
172
152
|
);
|
|
173
153
|
if (status === 'FAILURE') {
|
|
174
|
-
exitCode =
|
|
154
|
+
exitCode = EXIT_CODES.ERROR;
|
|
175
155
|
}
|
|
176
156
|
} else {
|
|
177
|
-
|
|
178
|
-
logger.log(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
157
|
+
uiLine();
|
|
158
|
+
logger.log(
|
|
159
|
+
chalk.bold(
|
|
160
|
+
i18n(`${i18nKey}.logs.buildSucceeded`, {
|
|
161
|
+
buildId,
|
|
162
|
+
})
|
|
163
|
+
)
|
|
164
|
+
);
|
|
165
|
+
logger.log(i18n(`${i18nKey}.logs.readyToGoLive`));
|
|
166
|
+
logger.log(
|
|
167
|
+
i18n(`${i18nKey}.logs.runCommand`, {
|
|
168
|
+
command: chalk.hex('f5c26b')('hs project deploy'),
|
|
169
|
+
})
|
|
170
|
+
);
|
|
171
|
+
uiLine();
|
|
182
172
|
}
|
|
183
173
|
|
|
184
174
|
try {
|
|
185
175
|
tempFile.removeCallback();
|
|
186
|
-
logger.debug(
|
|
176
|
+
logger.debug(
|
|
177
|
+
i18n(`${i18nKey}.debug.cleanedUpTempFile`, {
|
|
178
|
+
path: tempFile.name,
|
|
179
|
+
})
|
|
180
|
+
);
|
|
187
181
|
} catch (e) {
|
|
188
182
|
logger.error(e);
|
|
189
183
|
}
|
|
@@ -208,17 +202,19 @@ exports.handler = async options => {
|
|
|
208
202
|
|
|
209
203
|
exports.builder = yargs => {
|
|
210
204
|
yargs.positional('path', {
|
|
211
|
-
describe:
|
|
205
|
+
describe: i18n(`${i18nKey}.positionals.path.describe`),
|
|
212
206
|
type: 'string',
|
|
213
207
|
});
|
|
214
208
|
|
|
215
209
|
yargs.option('forceCreate', {
|
|
216
|
-
describe:
|
|
210
|
+
describe: i18n(`${i18nKey}.options.forceCreate.describe`),
|
|
217
211
|
type: 'boolean',
|
|
218
212
|
default: false,
|
|
219
213
|
});
|
|
220
214
|
|
|
221
|
-
yargs.example([
|
|
215
|
+
yargs.example([
|
|
216
|
+
['$0 project upload myProjectFolder', i18n(`${i18nKey}.examples.default`)],
|
|
217
|
+
]);
|
|
222
218
|
|
|
223
219
|
addConfigOptions(yargs, true);
|
|
224
220
|
addAccountOptions(yargs, true);
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
2
|
+
const { createWatcher } = require('@hubspot/cli-lib/projectsWatch');
|
|
3
|
+
const { cancelStagedBuild } = require('@hubspot/cli-lib/api/dfs');
|
|
4
|
+
const {
|
|
5
|
+
logApiErrorInstance,
|
|
6
|
+
ApiErrorContext,
|
|
7
|
+
} = require('@hubspot/cli-lib/errorHandlers');
|
|
8
|
+
const { logger } = require('@hubspot/cli-lib/logger');
|
|
9
|
+
const {
|
|
10
|
+
addAccountOptions,
|
|
11
|
+
addConfigOptions,
|
|
12
|
+
getAccountId,
|
|
13
|
+
addUseEnvironmentOptions,
|
|
14
|
+
} = require('../../lib/commonOpts');
|
|
15
|
+
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
16
|
+
const {
|
|
17
|
+
getProjectConfig,
|
|
18
|
+
validateProjectConfig,
|
|
19
|
+
pollBuildStatus,
|
|
20
|
+
pollDeployStatus,
|
|
21
|
+
} = require('../../lib/projects');
|
|
22
|
+
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
23
|
+
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
24
|
+
|
|
25
|
+
const i18nKey = 'cli.commands.project.subcommands.watch';
|
|
26
|
+
|
|
27
|
+
exports.command = 'watch [path]';
|
|
28
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
29
|
+
|
|
30
|
+
const handleBuildStatus = async (accountId, projectName, buildId) => {
|
|
31
|
+
const {
|
|
32
|
+
isAutoDeployEnabled,
|
|
33
|
+
deployStatusTaskLocator,
|
|
34
|
+
} = await pollBuildStatus(accountId, projectName, buildId);
|
|
35
|
+
|
|
36
|
+
if (isAutoDeployEnabled && deployStatusTaskLocator) {
|
|
37
|
+
await pollDeployStatus(
|
|
38
|
+
accountId,
|
|
39
|
+
projectName,
|
|
40
|
+
deployStatusTaskLocator.id,
|
|
41
|
+
buildId
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const handleSigInt = (accountId, projectName, currentBuildId) => {
|
|
47
|
+
process.removeAllListeners('SIGINT');
|
|
48
|
+
process.on('SIGINT', async () => {
|
|
49
|
+
if (currentBuildId) {
|
|
50
|
+
try {
|
|
51
|
+
await cancelStagedBuild(accountId, projectName);
|
|
52
|
+
logger.debug(i18n(`${i18nKey}.debug.buildCancelled`));
|
|
53
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
54
|
+
} catch (err) {
|
|
55
|
+
logApiErrorInstance(
|
|
56
|
+
err,
|
|
57
|
+
new ApiErrorContext({ accountId, projectName: projectName })
|
|
58
|
+
);
|
|
59
|
+
process.exit(EXIT_CODES.ERROR);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
exports.handler = async options => {
|
|
68
|
+
await loadAndValidateOptions(options);
|
|
69
|
+
|
|
70
|
+
const { path: projectPath } = options;
|
|
71
|
+
const accountId = getAccountId(options);
|
|
72
|
+
|
|
73
|
+
trackCommandUsage('project-watch', { projectPath }, accountId);
|
|
74
|
+
|
|
75
|
+
const { projectConfig, projectDir } = await getProjectConfig(projectPath);
|
|
76
|
+
|
|
77
|
+
validateProjectConfig(projectConfig, projectDir);
|
|
78
|
+
|
|
79
|
+
await createWatcher(
|
|
80
|
+
accountId,
|
|
81
|
+
projectConfig,
|
|
82
|
+
projectDir,
|
|
83
|
+
handleBuildStatus,
|
|
84
|
+
handleSigInt
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
exports.builder = yargs => {
|
|
89
|
+
yargs.positional('path', {
|
|
90
|
+
describe: i18n(`${i18nKey}.describe`),
|
|
91
|
+
type: 'string',
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
yargs.example([
|
|
95
|
+
['$0 project watch myProjectFolder', i18n(`${i18nKey}.examples.default`)],
|
|
96
|
+
]);
|
|
97
|
+
|
|
98
|
+
addConfigOptions(yargs, true);
|
|
99
|
+
addAccountOptions(yargs, true);
|
|
100
|
+
addUseEnvironmentOptions(yargs, true);
|
|
101
|
+
|
|
102
|
+
return yargs;
|
|
103
|
+
};
|
package/commands/project.js
CHANGED
|
@@ -4,6 +4,7 @@ const create = require('./project/create');
|
|
|
4
4
|
const upload = require('./project/upload');
|
|
5
5
|
const listBuilds = require('./project/listBuilds');
|
|
6
6
|
const logs = require('./project/logs');
|
|
7
|
+
const watch = require('./project/watch');
|
|
7
8
|
|
|
8
9
|
exports.command = 'project';
|
|
9
10
|
exports.describe = false; //'Commands for working with projects';
|
|
@@ -16,6 +17,7 @@ exports.builder = yargs => {
|
|
|
16
17
|
yargs.command(deploy).demandCommand(1, '');
|
|
17
18
|
yargs.command(create).demandCommand(0, '');
|
|
18
19
|
yargs.command(upload).demandCommand(0, '');
|
|
20
|
+
yargs.command(watch).demandCommand(0, '');
|
|
19
21
|
yargs.command(listBuilds).demandCommand(0, '');
|
|
20
22
|
yargs.command(logs).demandCommand(1, '');
|
|
21
23
|
|
package/commands/remove.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
const { deleteFile } = require('@hubspot/cli-lib/api/fileMapper');
|
|
2
|
-
const {
|
|
3
|
-
loadConfig,
|
|
4
|
-
validateConfig,
|
|
5
|
-
checkAndWarnGitInclusion,
|
|
6
|
-
} = require('@hubspot/cli-lib');
|
|
7
2
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
8
3
|
const {
|
|
9
4
|
logApiErrorInstance,
|
|
@@ -14,26 +9,21 @@ const {
|
|
|
14
9
|
addConfigOptions,
|
|
15
10
|
addAccountOptions,
|
|
16
11
|
addUseEnvironmentOptions,
|
|
17
|
-
setLogLevel,
|
|
18
12
|
getAccountId,
|
|
19
13
|
} = require('../lib/commonOpts');
|
|
20
|
-
const {
|
|
21
|
-
const { validateAccount } = require('../lib/validation');
|
|
14
|
+
const { loadAndValidateOptions } = require('../lib/validation');
|
|
22
15
|
const { trackCommandUsage } = require('../lib/usageTracking');
|
|
16
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
17
|
+
|
|
18
|
+
const i18nKey = 'cli.commands.remove';
|
|
23
19
|
|
|
24
20
|
exports.command = 'remove <path>';
|
|
25
|
-
exports.describe =
|
|
21
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
26
22
|
|
|
27
23
|
exports.handler = async options => {
|
|
28
|
-
|
|
29
|
-
logDebugInfo(options);
|
|
30
|
-
const { config: configPath, path: hsPath } = options;
|
|
31
|
-
loadConfig(configPath, options);
|
|
32
|
-
checkAndWarnGitInclusion();
|
|
24
|
+
const { path: hsPath } = options;
|
|
33
25
|
|
|
34
|
-
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
26
|
+
await loadAndValidateOptions(options);
|
|
37
27
|
|
|
38
28
|
const accountId = getAccountId(options);
|
|
39
29
|
|
|
@@ -41,9 +31,11 @@ exports.handler = async options => {
|
|
|
41
31
|
|
|
42
32
|
try {
|
|
43
33
|
await deleteFile(accountId, hsPath);
|
|
44
|
-
logger.log(
|
|
34
|
+
logger.log(i18n(`${i18nKey}.deleted`, { accountId, path: hsPath }));
|
|
45
35
|
} catch (error) {
|
|
46
|
-
logger.error(
|
|
36
|
+
logger.error(
|
|
37
|
+
i18n(`${i18nKey}.errors.deleteFailed`, { accountId, path: hsPath })
|
|
38
|
+
);
|
|
47
39
|
logApiErrorInstance(
|
|
48
40
|
error,
|
|
49
41
|
new ApiErrorContext({
|
|
@@ -59,7 +51,7 @@ exports.builder = yargs => {
|
|
|
59
51
|
addAccountOptions(yargs, true);
|
|
60
52
|
addUseEnvironmentOptions(yargs, true);
|
|
61
53
|
yargs.positional('path', {
|
|
62
|
-
describe:
|
|
54
|
+
describe: i18n(`${i18nKey}.positionals.path.describe`),
|
|
63
55
|
type: 'string',
|
|
64
56
|
});
|
|
65
57
|
return yargs;
|
|
@@ -9,13 +9,16 @@ const { logger } = require('@hubspot/cli-lib/logger');
|
|
|
9
9
|
|
|
10
10
|
const { createSandbox } = require('@hubspot/cli-lib/sandboxes');
|
|
11
11
|
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
12
|
-
const {
|
|
12
|
+
const { createSandboxPrompt } = require('../../lib/prompts/sandboxesPrompt');
|
|
13
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
14
|
+
|
|
15
|
+
const i18nKey = 'cli.commands.sandbox.subcommands.create';
|
|
13
16
|
|
|
14
17
|
exports.command = 'create [name]';
|
|
15
18
|
exports.describe = false;
|
|
16
19
|
|
|
17
20
|
exports.handler = async options => {
|
|
18
|
-
loadAndValidateOptions(options);
|
|
21
|
+
await loadAndValidateOptions(options);
|
|
19
22
|
|
|
20
23
|
const { name } = options;
|
|
21
24
|
const accountId = getAccountId(options);
|
|
@@ -24,36 +27,38 @@ exports.handler = async options => {
|
|
|
24
27
|
trackCommandUsage('sandbox-create', {}, accountId);
|
|
25
28
|
|
|
26
29
|
if (!name) {
|
|
27
|
-
namePrompt = await
|
|
30
|
+
namePrompt = await createSandboxPrompt();
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
const sandboxName = name || namePrompt.name;
|
|
31
34
|
|
|
32
|
-
logger.debug(
|
|
35
|
+
logger.debug(
|
|
36
|
+
i18n(`${i18nKey}.debug.creating`, {
|
|
37
|
+
name: sandboxName,
|
|
38
|
+
})
|
|
39
|
+
);
|
|
33
40
|
|
|
34
41
|
return createSandbox(accountId, sandboxName).then(
|
|
35
42
|
({ name, sandboxHubId }) => {
|
|
36
43
|
logger.success(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
i18n(`${i18nKey}.describe`, {
|
|
45
|
+
name,
|
|
46
|
+
sandboxHubId,
|
|
47
|
+
})
|
|
41
48
|
);
|
|
49
|
+
logger.info(i18n(`${i18nKey}.info.auth`));
|
|
42
50
|
}
|
|
43
51
|
);
|
|
44
52
|
};
|
|
45
53
|
|
|
46
54
|
exports.builder = yargs => {
|
|
47
55
|
yargs.positional('name', {
|
|
48
|
-
describe:
|
|
56
|
+
describe: i18n(`${i18nKey}.positionals.name.describe`),
|
|
49
57
|
type: 'string',
|
|
50
58
|
});
|
|
51
59
|
|
|
52
60
|
yargs.example([
|
|
53
|
-
[
|
|
54
|
-
'$0 sandbox create MySandboxAccount',
|
|
55
|
-
'Create a sandbox account named MySandboxAccount.',
|
|
56
|
-
],
|
|
61
|
+
['$0 sandbox create MySandboxAccount', i18n(`${i18nKey}.examples.default`)],
|
|
57
62
|
]);
|
|
58
63
|
|
|
59
64
|
addConfigOptions(yargs, true);
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
const {
|
|
2
|
-
loadConfig,
|
|
3
|
-
validateConfig,
|
|
4
|
-
checkAndWarnGitInclusion,
|
|
5
|
-
} = require('@hubspot/cli-lib');
|
|
6
1
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
7
2
|
const {
|
|
8
3
|
logServerlessFunctionApiErrorInstance,
|
|
@@ -10,33 +5,28 @@ const {
|
|
|
10
5
|
} = require('@hubspot/cli-lib/errorHandlers');
|
|
11
6
|
const { addSecret } = require('@hubspot/cli-lib/api/secrets');
|
|
12
7
|
|
|
13
|
-
const {
|
|
8
|
+
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
14
9
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
15
10
|
|
|
16
11
|
const {
|
|
17
12
|
addConfigOptions,
|
|
18
13
|
addAccountOptions,
|
|
19
14
|
addUseEnvironmentOptions,
|
|
20
|
-
setLogLevel,
|
|
21
15
|
getAccountId,
|
|
22
16
|
} = require('../../lib/commonOpts');
|
|
23
|
-
const {
|
|
24
|
-
const {
|
|
17
|
+
const { secretValuePrompt } = require('../../lib/prompts/secretPrompt');
|
|
18
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
19
|
+
|
|
20
|
+
const i18nKey = 'cli.commands.secrets.subcommands.add';
|
|
25
21
|
|
|
26
22
|
exports.command = 'add <name>';
|
|
27
|
-
exports.describe =
|
|
23
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
28
24
|
|
|
29
25
|
exports.handler = async options => {
|
|
30
|
-
const {
|
|
26
|
+
const { name: secretName } = options;
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
logDebugInfo(options);
|
|
34
|
-
loadConfig(configPath, options);
|
|
35
|
-
checkAndWarnGitInclusion();
|
|
28
|
+
await loadAndValidateOptions(options);
|
|
36
29
|
|
|
37
|
-
if (!(validateConfig() && (await validateAccount(options)))) {
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
30
|
const accountId = getAccountId(options);
|
|
41
31
|
trackCommandUsage('secrets-add', {}, accountId);
|
|
42
32
|
|
|
@@ -44,11 +34,18 @@ exports.handler = async options => {
|
|
|
44
34
|
const { secretValue } = await secretValuePrompt();
|
|
45
35
|
|
|
46
36
|
await addSecret(accountId, secretName, secretValue);
|
|
47
|
-
logger.
|
|
48
|
-
|
|
37
|
+
logger.success(
|
|
38
|
+
i18n(`${i18nKey}.success.add`, {
|
|
39
|
+
accountId,
|
|
40
|
+
secretName,
|
|
41
|
+
})
|
|
49
42
|
);
|
|
50
43
|
} catch (e) {
|
|
51
|
-
logger.error(
|
|
44
|
+
logger.error(
|
|
45
|
+
i18n(`${i18nKey}.errors.add`, {
|
|
46
|
+
secretName,
|
|
47
|
+
})
|
|
48
|
+
);
|
|
52
49
|
await logServerlessFunctionApiErrorInstance(
|
|
53
50
|
accountId,
|
|
54
51
|
e,
|
|
@@ -65,7 +62,7 @@ exports.builder = yargs => {
|
|
|
65
62
|
addAccountOptions(yargs, true);
|
|
66
63
|
addUseEnvironmentOptions(yargs, true);
|
|
67
64
|
yargs.positional('name', {
|
|
68
|
-
describe:
|
|
65
|
+
describe: i18n(`${i18nKey}.positionals.name.describe`),
|
|
69
66
|
type: 'string',
|
|
70
67
|
});
|
|
71
68
|
return yargs;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
const {
|
|
2
|
-
loadConfig,
|
|
3
|
-
validateConfig,
|
|
4
|
-
checkAndWarnGitInclusion,
|
|
5
|
-
} = require('@hubspot/cli-lib');
|
|
6
1
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
7
2
|
const {
|
|
8
3
|
logServerlessFunctionApiErrorInstance,
|
|
@@ -10,42 +5,44 @@ const {
|
|
|
10
5
|
} = require('@hubspot/cli-lib/errorHandlers');
|
|
11
6
|
const { deleteSecret } = require('@hubspot/cli-lib/api/secrets');
|
|
12
7
|
|
|
13
|
-
const {
|
|
8
|
+
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
14
9
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
15
10
|
|
|
16
11
|
const {
|
|
17
12
|
addConfigOptions,
|
|
18
13
|
addAccountOptions,
|
|
19
14
|
addUseEnvironmentOptions,
|
|
20
|
-
setLogLevel,
|
|
21
15
|
getAccountId,
|
|
22
16
|
} = require('../../lib/commonOpts');
|
|
23
|
-
const {
|
|
17
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
18
|
+
|
|
19
|
+
const i18nKey = 'cli.commands.secrets.subcommands.delete';
|
|
24
20
|
|
|
25
21
|
exports.command = 'delete <name>';
|
|
26
|
-
exports.describe =
|
|
22
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
27
23
|
|
|
28
24
|
exports.handler = async options => {
|
|
29
|
-
const {
|
|
25
|
+
const { name: secretName } = options;
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
logDebugInfo(options);
|
|
33
|
-
loadConfig(configPath, options);
|
|
34
|
-
checkAndWarnGitInclusion();
|
|
27
|
+
await loadAndValidateOptions(options);
|
|
35
28
|
|
|
36
|
-
if (!(validateConfig() && (await validateAccount(options)))) {
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
29
|
const accountId = getAccountId(options);
|
|
40
30
|
trackCommandUsage('secrets-delete', {}, accountId);
|
|
41
31
|
|
|
42
32
|
try {
|
|
43
33
|
await deleteSecret(accountId, secretName);
|
|
44
|
-
logger.
|
|
45
|
-
|
|
34
|
+
logger.success(
|
|
35
|
+
i18n(`${i18nKey}.success.delete`, {
|
|
36
|
+
accountId,
|
|
37
|
+
secretName,
|
|
38
|
+
})
|
|
46
39
|
);
|
|
47
40
|
} catch (e) {
|
|
48
|
-
logger.error(
|
|
41
|
+
logger.error(
|
|
42
|
+
i18n(`${i18nKey}.errors.delete`, {
|
|
43
|
+
secretName,
|
|
44
|
+
})
|
|
45
|
+
);
|
|
49
46
|
await logServerlessFunctionApiErrorInstance(
|
|
50
47
|
accountId,
|
|
51
48
|
e,
|
|
@@ -62,7 +59,7 @@ exports.builder = yargs => {
|
|
|
62
59
|
addAccountOptions(yargs, true);
|
|
63
60
|
addUseEnvironmentOptions(yargs, true);
|
|
64
61
|
yargs.positional('name', {
|
|
65
|
-
describe:
|
|
62
|
+
describe: i18n(`${i18nKey}.positionals.name.describe`),
|
|
66
63
|
type: 'string',
|
|
67
64
|
});
|
|
68
65
|
return yargs;
|