@hubspot/cli 4.0.2-beta.6 → 4.0.2-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/accounts/list.js +4 -1
- package/commands/project/watch.js +10 -5
- package/commands/sandbox/create.js +3 -0
- package/commands/sandbox/delete.js +17 -3
- package/commands/secrets/addSecret.js +2 -1
- package/commands/secrets/deleteSecret.js +2 -1
- package/commands/secrets/listSecrets.js +2 -1
- package/commands/secrets/updateSecret.js +3 -1
- package/lib/prompts/accountsPrompt.js +3 -8
- package/lib/prompts/sandboxesPrompt.js +16 -1
- package/package.json +4 -4
|
@@ -12,6 +12,7 @@ const {
|
|
|
12
12
|
} = require('../../lib/commonOpts');
|
|
13
13
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
14
14
|
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
15
|
+
const { getSandboxType } = require('../../lib/prompts/sandboxesPrompt');
|
|
15
16
|
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
16
17
|
|
|
17
18
|
const i18nKey = 'cli.commands.accounts.subcommands.list';
|
|
@@ -57,7 +58,9 @@ const getPortalData = mappedPortalData => {
|
|
|
57
58
|
portalData.push([portal.name, portal.portalId, portal.authType]);
|
|
58
59
|
} else {
|
|
59
60
|
portalData.push([
|
|
60
|
-
`↳ ${portal.name} [
|
|
61
|
+
`↳ ${portal.name} [${getSandboxType(
|
|
62
|
+
portal.sandboxAccountType
|
|
63
|
+
)} sandbox]`,
|
|
61
64
|
portal.portalId,
|
|
62
65
|
portal.authType,
|
|
63
66
|
]);
|
|
@@ -5,6 +5,7 @@ const {
|
|
|
5
5
|
ApiErrorContext,
|
|
6
6
|
} = require('@hubspot/cli-lib/errorHandlers');
|
|
7
7
|
const { logger } = require('@hubspot/cli-lib/logger');
|
|
8
|
+
const { ERROR_TYPES } = require('@hubspot/cli-lib/lib/constants');
|
|
8
9
|
const {
|
|
9
10
|
addAccountOptions,
|
|
10
11
|
addConfigOptions,
|
|
@@ -61,11 +62,15 @@ const handleUserInput = (accountId, projectName, currentBuildId) => {
|
|
|
61
62
|
await cancelStagedBuild(accountId, projectName);
|
|
62
63
|
process.exit(EXIT_CODES.SUCCESS);
|
|
63
64
|
} catch (err) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
if (err.error.subCategory === ERROR_TYPES.BUILD_NOT_IN_PROGRESS) {
|
|
66
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
67
|
+
} else {
|
|
68
|
+
logApiErrorInstance(
|
|
69
|
+
err,
|
|
70
|
+
new ApiErrorContext({ accountId, projectName: projectName })
|
|
71
|
+
);
|
|
72
|
+
process.exit(EXIT_CODES.ERROR);
|
|
73
|
+
}
|
|
69
74
|
}
|
|
70
75
|
} else {
|
|
71
76
|
process.exit(EXIT_CODES.SUCCESS);
|
|
@@ -49,6 +49,9 @@ exports.handler = async options => {
|
|
|
49
49
|
account: account || accountPrompt.account,
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
+
const isDefaultAccount =
|
|
53
|
+
sandboxAccountId === getAccountId(config.defaultPortal);
|
|
54
|
+
|
|
52
55
|
trackCommandUsage('sandbox-delete', null, sandboxAccountId);
|
|
53
56
|
|
|
54
57
|
let parentAccountId;
|
|
@@ -91,6 +94,14 @@ exports.handler = async options => {
|
|
|
91
94
|
})
|
|
92
95
|
);
|
|
93
96
|
|
|
97
|
+
if (isDefaultAccount) {
|
|
98
|
+
logger.log(
|
|
99
|
+
i18n(`${i18nKey}.defaultAccountWarning`, {
|
|
100
|
+
account: account || accountPrompt.account,
|
|
101
|
+
})
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
94
105
|
try {
|
|
95
106
|
const { confirmSandboxDeletePrompt: confirmed } = await promptUser([
|
|
96
107
|
{
|
|
@@ -107,9 +118,12 @@ exports.handler = async options => {
|
|
|
107
118
|
|
|
108
119
|
await deleteSandbox(parentAccountId, sandboxAccountId);
|
|
109
120
|
|
|
121
|
+
const deleteKey = isDefaultAccount
|
|
122
|
+
? `${i18nKey}.success.deleteDefault`
|
|
123
|
+
: `${i18nKey}.success.delete`;
|
|
110
124
|
logger.log('');
|
|
111
125
|
logger.success(
|
|
112
|
-
i18n(
|
|
126
|
+
i18n(deleteKey, {
|
|
113
127
|
account: account || accountPrompt.account,
|
|
114
128
|
sandboxHubId: sandboxAccountId,
|
|
115
129
|
})
|
|
@@ -120,7 +134,7 @@ exports.handler = async options => {
|
|
|
120
134
|
sandboxAccountId
|
|
121
135
|
);
|
|
122
136
|
if (promptDefaultAccount) {
|
|
123
|
-
await selectAndSetAsDefaultAccountPrompt(
|
|
137
|
+
await selectAndSetAsDefaultAccountPrompt(getConfig());
|
|
124
138
|
}
|
|
125
139
|
process.exit(EXIT_CODES.SUCCESS);
|
|
126
140
|
} catch (err) {
|
|
@@ -149,7 +163,7 @@ exports.handler = async options => {
|
|
|
149
163
|
sandboxAccountId
|
|
150
164
|
);
|
|
151
165
|
if (promptDefaultAccount) {
|
|
152
|
-
await selectAndSetAsDefaultAccountPrompt(
|
|
166
|
+
await selectAndSetAsDefaultAccountPrompt(getConfig());
|
|
153
167
|
}
|
|
154
168
|
process.exit(EXIT_CODES.SUCCESS);
|
|
155
169
|
} else {
|
|
@@ -14,6 +14,7 @@ const {
|
|
|
14
14
|
addUseEnvironmentOptions,
|
|
15
15
|
getAccountId,
|
|
16
16
|
} = require('../../lib/commonOpts');
|
|
17
|
+
const { uiAccountDescription } = require('../../lib/ui');
|
|
17
18
|
const { secretValuePrompt } = require('../../lib/prompts/secretPrompt');
|
|
18
19
|
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
19
20
|
|
|
@@ -36,7 +37,7 @@ exports.handler = async options => {
|
|
|
36
37
|
await addSecret(accountId, secretName, secretValue);
|
|
37
38
|
logger.success(
|
|
38
39
|
i18n(`${i18nKey}.success.add`, {
|
|
39
|
-
accountId,
|
|
40
|
+
accountIdentifier: uiAccountDescription(accountId),
|
|
40
41
|
secretName,
|
|
41
42
|
})
|
|
42
43
|
);
|
|
@@ -7,6 +7,7 @@ const { deleteSecret } = require('@hubspot/cli-lib/api/secrets');
|
|
|
7
7
|
|
|
8
8
|
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
9
9
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
10
|
+
const { uiAccountDescription } = require('../../lib/ui');
|
|
10
11
|
|
|
11
12
|
const {
|
|
12
13
|
addConfigOptions,
|
|
@@ -33,7 +34,7 @@ exports.handler = async options => {
|
|
|
33
34
|
await deleteSecret(accountId, secretName);
|
|
34
35
|
logger.success(
|
|
35
36
|
i18n(`${i18nKey}.success.delete`, {
|
|
36
|
-
accountId,
|
|
37
|
+
accountIdentifier: uiAccountDescription(accountId),
|
|
37
38
|
secretName,
|
|
38
39
|
})
|
|
39
40
|
);
|
|
@@ -7,6 +7,7 @@ const { fetchSecrets } = require('@hubspot/cli-lib/api/secrets');
|
|
|
7
7
|
|
|
8
8
|
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
9
9
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
10
|
+
const { uiAccountDescription } = require('../../lib/ui');
|
|
10
11
|
|
|
11
12
|
const {
|
|
12
13
|
addConfigOptions,
|
|
@@ -30,7 +31,7 @@ exports.handler = async options => {
|
|
|
30
31
|
try {
|
|
31
32
|
const { results } = await fetchSecrets(accountId);
|
|
32
33
|
const groupLabel = i18n(`${i18nKey}.groupLabel`, {
|
|
33
|
-
accountId,
|
|
34
|
+
accountIdentifier: uiAccountDescription(accountId),
|
|
34
35
|
});
|
|
35
36
|
logger.group(groupLabel);
|
|
36
37
|
results.forEach(secret => logger.log(secret));
|
|
@@ -7,6 +7,7 @@ const { updateSecret } = require('@hubspot/cli-lib/api/secrets');
|
|
|
7
7
|
|
|
8
8
|
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
9
9
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
10
|
+
const { uiAccountDescription } = require('../../lib/ui');
|
|
10
11
|
|
|
11
12
|
const {
|
|
12
13
|
addConfigOptions,
|
|
@@ -36,10 +37,11 @@ exports.handler = async options => {
|
|
|
36
37
|
await updateSecret(accountId, secretName, secretValue);
|
|
37
38
|
logger.success(
|
|
38
39
|
i18n(`${i18nKey}.success.update`, {
|
|
39
|
-
accountId,
|
|
40
|
+
accountIdentifier: uiAccountDescription(accountId),
|
|
40
41
|
secretName,
|
|
41
42
|
})
|
|
42
43
|
);
|
|
44
|
+
logger.log(i18n(`${i18nKey}.success.updateReupload`));
|
|
43
45
|
} catch (e) {
|
|
44
46
|
logger.error(
|
|
45
47
|
i18n(`${i18nKey}.errors.update`, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { updateDefaultAccount } = require('@hubspot/cli-lib/lib/config');
|
|
2
2
|
const { promptUser } = require('./promptUtils');
|
|
3
3
|
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
4
|
+
const { mapAccountChoices } = require('./sandboxesPrompt');
|
|
4
5
|
|
|
5
6
|
const i18nKey = 'cli.commands.accounts.subcommands.use';
|
|
6
7
|
|
|
@@ -12,10 +13,7 @@ const selectAccountFromConfig = async config => {
|
|
|
12
13
|
name: 'default',
|
|
13
14
|
pageSize: 20,
|
|
14
15
|
message: i18n(`${i18nKey}.promptMessage`),
|
|
15
|
-
choices: config.portals
|
|
16
|
-
name: `${p.name} (${p.portalId})`,
|
|
17
|
-
value: p.name || p.portalId,
|
|
18
|
-
})),
|
|
16
|
+
choices: mapAccountChoices(config.portals),
|
|
19
17
|
default: config.defaultPortal,
|
|
20
18
|
},
|
|
21
19
|
]);
|
|
@@ -31,10 +29,7 @@ const selectAndSetAsDefaultAccountPrompt = async config => {
|
|
|
31
29
|
name: 'default',
|
|
32
30
|
pageSize: 20,
|
|
33
31
|
message: i18n(`${i18nKey}.promptMessage`),
|
|
34
|
-
choices: config.portals
|
|
35
|
-
name: `${p.name} (${p.portalId})`,
|
|
36
|
-
value: p.name || p.portalId,
|
|
37
|
-
})),
|
|
32
|
+
choices: mapAccountChoices(config.portals),
|
|
38
33
|
default: config.defaultPortal,
|
|
39
34
|
},
|
|
40
35
|
]);
|
|
@@ -3,6 +3,19 @@ const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
|
3
3
|
|
|
4
4
|
const i18nKey = 'cli.lib.prompts.sandboxesPrompt';
|
|
5
5
|
|
|
6
|
+
const getSandboxType = type =>
|
|
7
|
+
type === 'DEVELOPER' ? 'development' : 'standard';
|
|
8
|
+
|
|
9
|
+
const mapAccountChoices = portals =>
|
|
10
|
+
portals.map(p => {
|
|
11
|
+
const isSandbox = p.sandboxAccountType !== null;
|
|
12
|
+
const sandboxName = `[${getSandboxType(p.sandboxAccountType)} sandbox] `;
|
|
13
|
+
return {
|
|
14
|
+
name: `${p.name} ${isSandbox ? sandboxName : ''}(${p.portalId})`,
|
|
15
|
+
value: p.name || p.portalId,
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
|
|
6
19
|
const createSandboxPrompt = () => {
|
|
7
20
|
return promptUser([
|
|
8
21
|
{
|
|
@@ -31,7 +44,7 @@ const deleteSandboxPrompt = (config, promptParentAccount = false) => {
|
|
|
31
44
|
type: 'list',
|
|
32
45
|
look: false,
|
|
33
46
|
pageSize: 20,
|
|
34
|
-
choices: config.portals
|
|
47
|
+
choices: mapAccountChoices(config.portals),
|
|
35
48
|
default: config.defaultPortal,
|
|
36
49
|
},
|
|
37
50
|
]);
|
|
@@ -40,4 +53,6 @@ const deleteSandboxPrompt = (config, promptParentAccount = false) => {
|
|
|
40
53
|
module.exports = {
|
|
41
54
|
createSandboxPrompt,
|
|
42
55
|
deleteSandboxPrompt,
|
|
56
|
+
getSandboxType,
|
|
57
|
+
mapAccountChoices,
|
|
43
58
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "4.0.2-beta.
|
|
3
|
+
"version": "4.0.2-beta.7",
|
|
4
4
|
"description": "CLI for working with HubSpot",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"url": "https://github.com/HubSpot/hubspot-cms-tools"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@hubspot/cli-lib": "4.0.2-beta.
|
|
12
|
-
"@hubspot/serverless-dev-runtime": "4.0.2-beta.
|
|
11
|
+
"@hubspot/cli-lib": "4.0.2-beta.7",
|
|
12
|
+
"@hubspot/serverless-dev-runtime": "4.0.2-beta.7",
|
|
13
13
|
"archiver": "^5.3.0",
|
|
14
14
|
"chalk": "^4.1.2",
|
|
15
15
|
"express": "^4.17.1",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "0fe48550b57c3f8326262ed19decaeb4930f8c3a"
|
|
41
41
|
}
|