@hubspot/cli 5.1.4-beta.2 → 5.1.4-beta.4
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/clean.js +2 -2
- package/commands/accounts/info.js +1 -1
- package/commands/accounts/list.js +12 -19
- package/commands/auth.js +6 -2
- package/commands/cms/convertFields.js +2 -2
- package/commands/cms/lighthouseScore.js +3 -9
- package/commands/config/set/defaultMode.js +3 -3
- package/commands/create/api-sample.js +1 -0
- package/commands/create/website-theme.js +1 -0
- package/commands/customObject/schema/create.js +5 -2
- package/commands/customObject/schema/fetch.js +2 -2
- package/commands/customObject/schema/update.js +5 -2
- package/commands/feedback.js +1 -4
- package/commands/functions/deploy.js +1 -1
- package/commands/functions/list.js +1 -5
- package/commands/init.js +7 -3
- package/commands/list.js +1 -4
- package/commands/logs.js +1 -1
- package/commands/module/marketplace-validate.js +1 -1
- package/commands/project/deploy.js +2 -2
- package/commands/project/dev.js +14 -12
- package/commands/project/listBuilds.js +1 -4
- package/commands/project/logs.js +5 -6
- package/commands/project/upload.js +4 -4
- package/commands/project/watch.js +2 -2
- package/commands/sandbox/create.js +23 -12
- package/commands/sandbox/sync.js +18 -15
- package/commands/theme/marketplace-validate.js +1 -1
- package/commands/theme/preview.js +18 -2
- package/commands/upload.js +5 -2
- package/commands/watch.js +1 -1
- package/lang/en.lyaml +26 -5
- package/lib/DevServerManager.js +8 -3
- package/lib/LocalDevManager.js +9 -6
- package/lib/__tests__/commonOpts.js +10 -8
- package/lib/__tests__/serverlessLogs.js +2 -2
- package/lib/__tests__/validation.js +0 -1
- package/lib/commonOpts.js +14 -2
- package/lib/constants.js +82 -9
- package/lib/developerTestAccounts.js +0 -3
- package/lib/errorHandlers/apiErrors.js +4 -2
- package/lib/errorHandlers/overrideErrors.js +86 -0
- package/lib/filesystem.js +3 -1
- package/lib/links.js +4 -5
- package/lib/oauth.js +3 -1
- package/lib/process.js +4 -6
- package/lib/projectStructure.js +27 -18
- package/lib/projects.js +15 -26
- package/lib/projectsWatch.js +5 -3
- package/lib/prompts/createProjectPrompt.js +3 -4
- package/lib/prompts/feedbackPrompt.js +1 -1
- package/lib/prompts/personalAccessKeyPrompt.js +1 -1
- package/lib/prompts/projectAddPrompt.js +1 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +9 -10
- package/lib/prompts/sandboxesPrompt.js +13 -16
- package/lib/sandboxCreate.js +12 -10
- package/lib/sandboxSync.js +4 -9
- package/lib/sandboxes.js +37 -42
- package/lib/serverlessLogs.js +2 -2
- package/lib/ui/git.js +28 -0
- package/lib/{ui.js → ui/index.js} +12 -8
- package/lib/ui/serverlessFunctionLogs.js +103 -0
- package/lib/{supportHyperlinks.js → ui/supportHyperlinks.js} +1 -1
- package/lib/{supportsColor.js → ui/supportsColor.js} +1 -1
- package/lib/ui/table.js +70 -0
- package/lib/upload.js +3 -1
- package/lib/usageTracking.js +3 -1
- package/lib/validation.js +10 -6
- package/package.json +6 -6
- /package/lib/{CliProgressMultibarManager.js → ui/CliProgressMultibarManager.js} +0 -0
- /package/lib/{SpinniesManager.js → ui/SpinniesManager.js} +0 -0
- /package/lib/{spinniesUtils.js → ui/spinniesUtils.js} +0 -0
|
@@ -15,8 +15,8 @@ const {
|
|
|
15
15
|
} = require('../../lib/commonOpts');
|
|
16
16
|
const { getAccountName } = require('../../lib/sandboxes');
|
|
17
17
|
const { promptUser } = require('../../lib/prompts/promptUtils');
|
|
18
|
-
const { getTableContents } = require('
|
|
19
|
-
const SpinniesManager = require('../../lib/SpinniesManager');
|
|
18
|
+
const { getTableContents } = require('../../lib/ui/table');
|
|
19
|
+
const SpinniesManager = require('../../lib/ui/SpinniesManager');
|
|
20
20
|
const { getConfig, deleteAccount } = require('@hubspot/local-dev-lib/config');
|
|
21
21
|
const {
|
|
22
22
|
isSpecifiedHubSpotAuthError,
|
|
@@ -8,7 +8,7 @@ const {
|
|
|
8
8
|
} = require('../../lib/commonOpts');
|
|
9
9
|
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
10
10
|
const { i18n } = require('../../lib/lang');
|
|
11
|
-
const { getTableContents } = require('
|
|
11
|
+
const { getTableContents } = require('../../lib/ui/table');
|
|
12
12
|
|
|
13
13
|
const i18nKey = 'cli.commands.accounts.subcommands.info';
|
|
14
14
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
2
2
|
const { getConfig, getConfigPath } = require('@hubspot/local-dev-lib/config');
|
|
3
|
-
const {
|
|
4
|
-
getTableContents,
|
|
5
|
-
getTableHeader,
|
|
6
|
-
} = require('@hubspot/local-dev-lib/logging/table');
|
|
3
|
+
const { getTableContents, getTableHeader } = require('../../lib/ui/table');
|
|
7
4
|
|
|
8
5
|
const {
|
|
9
6
|
addConfigOptions,
|
|
@@ -13,13 +10,11 @@ const {
|
|
|
13
10
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
14
11
|
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
15
12
|
const { isSandbox, getSandboxName } = require('../../lib/sandboxes');
|
|
16
|
-
const {
|
|
17
|
-
isDeveloperTestAccount,
|
|
18
|
-
DEV_TEST_ACCOUNT_STRING,
|
|
19
|
-
} = require('../../lib/developerTestAccounts');
|
|
13
|
+
const { isDeveloperTestAccount } = require('../../lib/developerTestAccounts');
|
|
20
14
|
const { i18n } = require('../../lib/lang');
|
|
21
15
|
const {
|
|
22
16
|
HUBSPOT_ACCOUNT_TYPES,
|
|
17
|
+
HUBSPOT_ACCOUNT_TYPE_STRINGS,
|
|
23
18
|
} = require('@hubspot/local-dev-lib/constants/config');
|
|
24
19
|
|
|
25
20
|
const i18nKey = 'cli.commands.accounts.subcommands.list';
|
|
@@ -31,22 +26,18 @@ const sortAndMapPortals = portals => {
|
|
|
31
26
|
const mappedPortalData = {};
|
|
32
27
|
// Standard and app developer portals
|
|
33
28
|
portals
|
|
34
|
-
.filter(
|
|
35
|
-
p
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
.filter(
|
|
30
|
+
p =>
|
|
31
|
+
p.accountType &&
|
|
32
|
+
(p.accountType === HUBSPOT_ACCOUNT_TYPES.STANDARD ||
|
|
33
|
+
p.accountType === HUBSPOT_ACCOUNT_TYPES.APP_DEVELOPER)
|
|
39
34
|
)
|
|
40
35
|
.forEach(portal => {
|
|
41
36
|
mappedPortalData[portal.portalId] = [portal];
|
|
42
37
|
});
|
|
43
38
|
// Non-standard portals (sandbox, developer test account)
|
|
44
39
|
portals
|
|
45
|
-
.filter(p =>
|
|
46
|
-
p.accountType
|
|
47
|
-
? isSandbox(p) || isDeveloperTestAccount(p)
|
|
48
|
-
: p.sandboxAccountType !== null
|
|
49
|
-
)
|
|
40
|
+
.filter(p => p.accountType && (isSandbox(p) || isDeveloperTestAccount(p)))
|
|
50
41
|
.forEach(p => {
|
|
51
42
|
if (p.parentAccountId) {
|
|
52
43
|
mappedPortalData[p.parentAccountId] = [
|
|
@@ -71,7 +62,9 @@ const getPortalData = mappedPortalData => {
|
|
|
71
62
|
name = `↳ ${name}`;
|
|
72
63
|
}
|
|
73
64
|
} else if (isDeveloperTestAccount(portal)) {
|
|
74
|
-
name = `${portal.name} [${
|
|
65
|
+
name = `${portal.name} [${
|
|
66
|
+
HUBSPOT_ACCOUNT_TYPE_STRINGS[HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST]
|
|
67
|
+
}]`;
|
|
75
68
|
if (set.length > 1) {
|
|
76
69
|
name = `↳ ${name}`;
|
|
77
70
|
}
|
package/commands/auth.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
const { checkAndWarnGitInclusion } = require('
|
|
1
|
+
const { checkAndWarnGitInclusion } = require('../lib/ui/git');
|
|
2
2
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
3
3
|
const {
|
|
4
4
|
OAUTH_AUTH_METHOD,
|
|
5
5
|
PERSONAL_ACCESS_KEY_AUTH_METHOD,
|
|
6
|
+
} = require('@hubspot/local-dev-lib/constants/auth');
|
|
7
|
+
const {
|
|
6
8
|
ENVIRONMENTS,
|
|
9
|
+
} = require('@hubspot/local-dev-lib/constants/environments');
|
|
10
|
+
const {
|
|
7
11
|
DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
8
|
-
} = require('@hubspot/
|
|
12
|
+
} = require('@hubspot/local-dev-lib/constants/config');
|
|
9
13
|
const { i18n } = require('../lib/lang');
|
|
10
14
|
const {
|
|
11
15
|
getAccessToken,
|
|
@@ -9,7 +9,7 @@ const { i18n } = require('../../lib/lang');
|
|
|
9
9
|
const {
|
|
10
10
|
FieldsJs,
|
|
11
11
|
isConvertableFieldJs,
|
|
12
|
-
} = require('@hubspot/
|
|
12
|
+
} = require('@hubspot/local-dev-lib/cms/handleFieldsJs');
|
|
13
13
|
|
|
14
14
|
const { trackConvertFieldsUsage } = require('../../lib/usageTracking');
|
|
15
15
|
const { logErrorInstance } = require('../../lib/errorHandlers/standardErrors');
|
|
@@ -85,7 +85,7 @@ exports.handler = async options => {
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
exports.builder = yargs => {
|
|
88
|
-
yargs.
|
|
88
|
+
yargs.option('src', {
|
|
89
89
|
describe: i18n(`${i18nKey}.positionals.src.describe`),
|
|
90
90
|
type: 'string',
|
|
91
91
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const SpinniesManager = require('../../lib/SpinniesManager');
|
|
1
|
+
const SpinniesManager = require('../../lib/ui/SpinniesManager');
|
|
2
2
|
const {
|
|
3
3
|
addAccountOptions,
|
|
4
4
|
addConfigOptions,
|
|
@@ -6,10 +6,7 @@ const {
|
|
|
6
6
|
getAccountId,
|
|
7
7
|
} = require('../../lib/commonOpts');
|
|
8
8
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
9
|
-
const {
|
|
10
|
-
getTableContents,
|
|
11
|
-
getTableHeader,
|
|
12
|
-
} = require('@hubspot/local-dev-lib/logging/table');
|
|
9
|
+
const { getTableContents, getTableHeader } = require('../../lib/ui/table');
|
|
13
10
|
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
14
11
|
const { promptUser } = require('../../lib/prompts/promptUtils');
|
|
15
12
|
const { i18n } = require('../../lib/lang');
|
|
@@ -19,10 +16,7 @@ const {
|
|
|
19
16
|
getLighthouseScoreStatus,
|
|
20
17
|
getLighthouseScore,
|
|
21
18
|
} = require('@hubspot/local-dev-lib/api/lighthouseScore');
|
|
22
|
-
const {
|
|
23
|
-
HUBSPOT_FOLDER,
|
|
24
|
-
MARKETPLACE_FOLDER,
|
|
25
|
-
} = require('@hubspot/cli-lib/lib/constants');
|
|
19
|
+
const { HUBSPOT_FOLDER, MARKETPLACE_FOLDER } = require('../../lib/constants');
|
|
26
20
|
const { uiLink } = require('../../lib/ui');
|
|
27
21
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
28
22
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
2
2
|
const { updateDefaultMode } = require('@hubspot/local-dev-lib/config');
|
|
3
|
-
const {
|
|
3
|
+
const { MODE } = require('@hubspot/local-dev-lib/constants/files');
|
|
4
4
|
const { commaSeparatedValues } = require('@hubspot/local-dev-lib/text');
|
|
5
5
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
6
6
|
const { promptUser } = require('../../../lib/prompts/promptUtils');
|
|
@@ -8,7 +8,7 @@ const { i18n } = require('../../../lib/lang');
|
|
|
8
8
|
|
|
9
9
|
const i18nKey = 'cli.commands.config.subcommands.set.options.defaultMode';
|
|
10
10
|
|
|
11
|
-
const ALL_MODES = Object.values(
|
|
11
|
+
const ALL_MODES = Object.values(MODE);
|
|
12
12
|
|
|
13
13
|
const selectMode = async () => {
|
|
14
14
|
const { mode } = await promptUser([
|
|
@@ -19,7 +19,7 @@ const selectMode = async () => {
|
|
|
19
19
|
pageSize: 20,
|
|
20
20
|
message: i18n(`${i18nKey}.promptMessage`),
|
|
21
21
|
choices: ALL_MODES,
|
|
22
|
-
default:
|
|
22
|
+
default: MODE.publish,
|
|
23
23
|
},
|
|
24
24
|
]);
|
|
25
25
|
|
|
@@ -9,6 +9,7 @@ const path = require('path');
|
|
|
9
9
|
const fs = require('fs-extra');
|
|
10
10
|
const ora = require('ora');
|
|
11
11
|
const { fetchJsonFromRepository } = require('@hubspot/cli-lib/github');
|
|
12
|
+
// TODO: Swap to local-dev-lib after swapping github utils dep
|
|
12
13
|
const { GITHUB_RELEASE_TYPES } = require('@hubspot/cli-lib/lib/constants');
|
|
13
14
|
const { cloneGitHubRepo } = require('@hubspot/cli-lib/github');
|
|
14
15
|
const { i18n } = require('../../lib/lang');
|
|
@@ -11,7 +11,10 @@ const {
|
|
|
11
11
|
getEnv,
|
|
12
12
|
isConfigFlagEnabled,
|
|
13
13
|
} = require('@hubspot/local-dev-lib/config');
|
|
14
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
ENVIRONMENTS,
|
|
16
|
+
} = require('@hubspot/local-dev-lib/constants/environments');
|
|
17
|
+
const { CONFIG_FLAGS } = require('../../../lib/constants');
|
|
15
18
|
const {
|
|
16
19
|
createObjectSchema,
|
|
17
20
|
} = require('@hubspot/local-dev-lib/api/customObjects');
|
|
@@ -44,7 +47,7 @@ exports.handler = async options => {
|
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
try {
|
|
47
|
-
if (isConfigFlagEnabled(
|
|
50
|
+
if (isConfigFlagEnabled(CONFIG_FLAGS.USE_CUSTOM_OBJECT_HUBFILE)) {
|
|
48
51
|
await createSchemaFromHubFile(accountId, filePath);
|
|
49
52
|
logger.success(
|
|
50
53
|
i18n(`${i18nKey}.success.schemaCreated`, {
|
|
@@ -4,7 +4,7 @@ const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
|
4
4
|
const {
|
|
5
5
|
logErrorInstance,
|
|
6
6
|
} = require('../../../lib/errorHandlers/standardErrors');
|
|
7
|
-
const {
|
|
7
|
+
const { CONFIG_FLAGS } = require('../../../lib/constants');
|
|
8
8
|
const {
|
|
9
9
|
downloadSchema,
|
|
10
10
|
getResolvedPath,
|
|
@@ -33,7 +33,7 @@ exports.handler = async options => {
|
|
|
33
33
|
trackCommandUsage('custom-object-schema-fetch', null, accountId);
|
|
34
34
|
|
|
35
35
|
try {
|
|
36
|
-
if (isConfigFlagEnabled(
|
|
36
|
+
if (isConfigFlagEnabled(CONFIG_FLAGS.USE_CUSTOM_OBJECT_HUBFILE)) {
|
|
37
37
|
const fullpath = path.resolve(getCwd(), dest);
|
|
38
38
|
await fetchSchema(accountId, name, fullpath);
|
|
39
39
|
logger.success(
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
2
2
|
const { logApiErrorInstance } = require('../../../lib/errorHandlers/apiErrors');
|
|
3
3
|
const { getAbsoluteFilePath } = require('@hubspot/local-dev-lib/path');
|
|
4
|
+
const {
|
|
5
|
+
ENVIRONMENTS,
|
|
6
|
+
} = require('@hubspot/local-dev-lib/constants/environments');
|
|
4
7
|
const {
|
|
5
8
|
checkAndConvertToJson,
|
|
6
9
|
loadAndValidateOptions,
|
|
7
10
|
} = require('../../../lib/validation');
|
|
8
11
|
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
9
12
|
const { addTestingOptions, getAccountId } = require('../../../lib/commonOpts');
|
|
10
|
-
const {
|
|
13
|
+
const { CONFIG_FLAGS } = require('../../../lib/constants');
|
|
11
14
|
const {
|
|
12
15
|
getEnv,
|
|
13
16
|
isConfigFlagEnabled,
|
|
@@ -44,7 +47,7 @@ exports.handler = async options => {
|
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
try {
|
|
47
|
-
if (isConfigFlagEnabled(
|
|
50
|
+
if (isConfigFlagEnabled(CONFIG_FLAGS.USE_CUSTOM_OBJECT_HUBFILE)) {
|
|
48
51
|
await updateSchemaFromHubFile(accountId, filePath);
|
|
49
52
|
logger.success(
|
|
50
53
|
i18n(`${i18nKey}.success.update`, {
|
package/commands/feedback.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
const open = require('open');
|
|
2
2
|
|
|
3
3
|
const { i18n } = require('../lib/lang');
|
|
4
|
-
const {
|
|
5
|
-
FEEDBACK_OPTIONS,
|
|
6
|
-
FEEDBACK_URLS,
|
|
7
|
-
} = require('@hubspot/cli-lib/lib/constants');
|
|
4
|
+
const { FEEDBACK_OPTIONS, FEEDBACK_URLS } = require('../lib/constants');
|
|
8
5
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
9
6
|
|
|
10
7
|
const {
|
|
@@ -10,7 +10,7 @@ const {
|
|
|
10
10
|
logApiErrorInstance,
|
|
11
11
|
ApiErrorContext,
|
|
12
12
|
} = require('../../lib/errorHandlers/apiErrors');
|
|
13
|
-
const { POLLING_DELAY } = require('
|
|
13
|
+
const { POLLING_DELAY } = require('../../lib/constants');
|
|
14
14
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
15
15
|
const {
|
|
16
16
|
buildPackage,
|
|
@@ -5,11 +5,7 @@ const {
|
|
|
5
5
|
ApiErrorContext,
|
|
6
6
|
} = require('../../lib/errorHandlers/apiErrors');
|
|
7
7
|
const { getFunctionArrays } = require('../../lib/getFunctionArrays');
|
|
8
|
-
const {
|
|
9
|
-
getTableContents,
|
|
10
|
-
getTableHeader,
|
|
11
|
-
} = require('@hubspot/local-dev-lib/logging/table');
|
|
12
|
-
|
|
8
|
+
const { getTableContents, getTableHeader } = require('../../lib/ui/table');
|
|
13
9
|
const {
|
|
14
10
|
addConfigOptions,
|
|
15
11
|
addAccountOptions,
|
package/commands/init.js
CHANGED
|
@@ -16,11 +16,15 @@ const {
|
|
|
16
16
|
debugErrorAndContext,
|
|
17
17
|
} = require('../lib/errorHandlers/standardErrors');
|
|
18
18
|
const {
|
|
19
|
-
DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
20
|
-
PERSONAL_ACCESS_KEY_AUTH_METHOD,
|
|
21
19
|
OAUTH_AUTH_METHOD,
|
|
20
|
+
PERSONAL_ACCESS_KEY_AUTH_METHOD,
|
|
21
|
+
} = require('@hubspot/local-dev-lib/constants/auth');
|
|
22
|
+
const {
|
|
22
23
|
ENVIRONMENTS,
|
|
23
|
-
} = require('@hubspot/
|
|
24
|
+
} = require('@hubspot/local-dev-lib/constants/environments');
|
|
25
|
+
const {
|
|
26
|
+
DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
27
|
+
} = require('@hubspot/local-dev-lib/constants/config');
|
|
24
28
|
const { i18n } = require('../lib/lang');
|
|
25
29
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
26
30
|
const {
|
package/commands/list.js
CHANGED
|
@@ -16,10 +16,7 @@ const {
|
|
|
16
16
|
const {
|
|
17
17
|
getDirectoryContentsByPath,
|
|
18
18
|
} = require('@hubspot/local-dev-lib/api/fileMapper');
|
|
19
|
-
const {
|
|
20
|
-
HUBSPOT_FOLDER,
|
|
21
|
-
MARKETPLACE_FOLDER,
|
|
22
|
-
} = require('@hubspot/cli-lib/lib/constants');
|
|
19
|
+
const { HUBSPOT_FOLDER, MARKETPLACE_FOLDER } = require('../lib/constants');
|
|
23
20
|
const { loadAndValidateOptions } = require('../lib/validation');
|
|
24
21
|
const { i18n } = require('../lib/lang');
|
|
25
22
|
|
package/commands/logs.js
CHANGED
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
} = require('../lib/commonOpts');
|
|
7
7
|
const { trackCommandUsage } = require('../lib/usageTracking');
|
|
8
8
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
9
|
-
const { outputLogs } = require('
|
|
9
|
+
const { outputLogs } = require('../lib/ui/serverlessFunctionLogs');
|
|
10
10
|
const {
|
|
11
11
|
getFunctionLogs,
|
|
12
12
|
getLatestFunctionLog,
|
|
@@ -36,9 +36,9 @@ exports.handler = async options => {
|
|
|
36
36
|
const accountId = getAccountId(options);
|
|
37
37
|
const accountConfig = getAccountConfig(accountId);
|
|
38
38
|
const { project: projectOption, buildId: buildIdOption } = options;
|
|
39
|
-
const
|
|
39
|
+
const accountType = accountConfig && accountConfig.accountType;
|
|
40
40
|
|
|
41
|
-
trackCommandUsage('project-deploy', { type:
|
|
41
|
+
trackCommandUsage('project-deploy', { type: accountType }, accountId);
|
|
42
42
|
|
|
43
43
|
const { projectConfig } = await getProjectConfig();
|
|
44
44
|
|
package/commands/project/dev.js
CHANGED
|
@@ -42,7 +42,7 @@ const {
|
|
|
42
42
|
selectTargetAccountPrompt,
|
|
43
43
|
confirmDefaultAccountPrompt,
|
|
44
44
|
} = require('../../lib/prompts/projectDevTargetAccountPrompt');
|
|
45
|
-
const SpinniesManager = require('../../lib/SpinniesManager');
|
|
45
|
+
const SpinniesManager = require('../../lib/ui/SpinniesManager');
|
|
46
46
|
const LocalDevManager = require('../../lib/LocalDevManager');
|
|
47
47
|
const { isSandbox, getSandboxTypeAsString } = require('../../lib/sandboxes');
|
|
48
48
|
const { sandboxNamePrompt } = require('../../lib/prompts/sandboxesPrompt');
|
|
@@ -54,8 +54,8 @@ const { getValidEnv } = require('@hubspot/local-dev-lib/environment');
|
|
|
54
54
|
const {
|
|
55
55
|
PROJECT_BUILD_TEXT,
|
|
56
56
|
PROJECT_DEPLOY_TEXT,
|
|
57
|
-
|
|
58
|
-
} = require('
|
|
57
|
+
PROJECT_ERROR_TYPES,
|
|
58
|
+
} = require('../../lib/constants');
|
|
59
59
|
|
|
60
60
|
const { buildSandbox } = require('../../lib/sandboxCreate');
|
|
61
61
|
const { syncSandbox } = require('../../lib/sandboxSync');
|
|
@@ -69,11 +69,11 @@ const {
|
|
|
69
69
|
isMissingScopeError,
|
|
70
70
|
} = require('@hubspot/local-dev-lib/errors/apiErrors');
|
|
71
71
|
const { logErrorInstance } = require('../../lib/errorHandlers/standardErrors');
|
|
72
|
+
const { isDeveloperTestAccount } = require('../../lib/developerTestAccounts');
|
|
72
73
|
const {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} = require('
|
|
76
|
-
const { DEVELOPER_SANDBOX_TYPE } = require('../../lib/constants');
|
|
74
|
+
HUBSPOT_ACCOUNT_TYPES,
|
|
75
|
+
HUBSPOT_ACCOUNT_TYPE_STRINGS,
|
|
76
|
+
} = require('@hubspot/local-dev-lib/constants/config');
|
|
77
77
|
|
|
78
78
|
const i18nKey = 'cli.commands.project.subcommands.dev';
|
|
79
79
|
|
|
@@ -116,7 +116,7 @@ exports.handler = async options => {
|
|
|
116
116
|
accountConfig.name,
|
|
117
117
|
defaultAccountIsSandbox
|
|
118
118
|
? `${getSandboxTypeAsString(accountConfig.accountType)} sandbox`
|
|
119
|
-
:
|
|
119
|
+
: HUBSPOT_ACCOUNT_TYPE_STRINGS[HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST]
|
|
120
120
|
);
|
|
121
121
|
|
|
122
122
|
if (useDefaultAccount) {
|
|
@@ -152,7 +152,7 @@ exports.handler = async options => {
|
|
|
152
152
|
try {
|
|
153
153
|
await validateSandboxUsageLimits(
|
|
154
154
|
accountConfig,
|
|
155
|
-
|
|
155
|
+
HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX,
|
|
156
156
|
env
|
|
157
157
|
);
|
|
158
158
|
} catch (err) {
|
|
@@ -176,7 +176,9 @@ exports.handler = async options => {
|
|
|
176
176
|
process.exit(EXIT_CODES.ERROR);
|
|
177
177
|
}
|
|
178
178
|
try {
|
|
179
|
-
const { name } = await sandboxNamePrompt(
|
|
179
|
+
const { name } = await sandboxNamePrompt(
|
|
180
|
+
HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX
|
|
181
|
+
);
|
|
180
182
|
|
|
181
183
|
trackCommandMetadataUsage(
|
|
182
184
|
'sandbox-create',
|
|
@@ -186,7 +188,7 @@ exports.handler = async options => {
|
|
|
186
188
|
|
|
187
189
|
const { result } = await buildSandbox({
|
|
188
190
|
name,
|
|
189
|
-
type:
|
|
191
|
+
type: HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX,
|
|
190
192
|
accountConfig,
|
|
191
193
|
env,
|
|
192
194
|
});
|
|
@@ -308,7 +310,7 @@ exports.handler = async options => {
|
|
|
308
310
|
if (initialUploadResult.uploadError) {
|
|
309
311
|
if (
|
|
310
312
|
isSpecifiedError(initialUploadResult.uploadError, {
|
|
311
|
-
subCategory:
|
|
313
|
+
subCategory: PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
|
312
314
|
})
|
|
313
315
|
) {
|
|
314
316
|
logger.log();
|
|
@@ -17,10 +17,7 @@ const {
|
|
|
17
17
|
fetchProject,
|
|
18
18
|
fetchProjectBuilds,
|
|
19
19
|
} = require('@hubspot/local-dev-lib/api/projects');
|
|
20
|
-
const {
|
|
21
|
-
getTableContents,
|
|
22
|
-
getTableHeader,
|
|
23
|
-
} = require('@hubspot/local-dev-lib/logging/table');
|
|
20
|
+
const { getTableContents, getTableHeader } = require('../../lib/ui/table');
|
|
24
21
|
const { getCwd } = require('@hubspot/local-dev-lib/path');
|
|
25
22
|
const { uiBetaTag, uiLink } = require('../../lib/ui');
|
|
26
23
|
const { loadAndValidateOptions } = require('../../lib/validation');
|
package/commands/project/logs.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const { getEnv } = require('@hubspot/local-dev-lib/config');
|
|
2
2
|
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
ENVIRONMENTS,
|
|
5
|
+
} = require('@hubspot/local-dev-lib/constants/environments');
|
|
4
6
|
const {
|
|
5
7
|
addAccountOptions,
|
|
6
8
|
addConfigOptions,
|
|
@@ -9,15 +11,12 @@ const {
|
|
|
9
11
|
} = require('../../lib/commonOpts');
|
|
10
12
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
11
13
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
12
|
-
// const { outputLogs } = require('
|
|
14
|
+
// const { outputLogs } = require('../../lib/ui/serverlessFunctionLogs');
|
|
13
15
|
const {
|
|
14
16
|
fetchProject,
|
|
15
17
|
fetchDeployComponentsMetadata,
|
|
16
18
|
} = require('@hubspot/local-dev-lib/api/projects');
|
|
17
|
-
const {
|
|
18
|
-
getTableContents,
|
|
19
|
-
getTableHeader,
|
|
20
|
-
} = require('@hubspot/local-dev-lib/logging/table');
|
|
19
|
+
const { getTableContents, getTableHeader } = require('../../lib/ui/table');
|
|
21
20
|
// const {
|
|
22
21
|
// logApiErrorInstance,
|
|
23
22
|
// ApiErrorContext,
|
|
@@ -20,7 +20,7 @@ const {
|
|
|
20
20
|
} = require('../../lib/projects');
|
|
21
21
|
const { i18n } = require('../../lib/lang');
|
|
22
22
|
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
|
|
23
|
-
const {
|
|
23
|
+
const { PROJECT_ERROR_TYPES } = require('../../lib/constants');
|
|
24
24
|
const {
|
|
25
25
|
logApiErrorInstance,
|
|
26
26
|
ApiErrorContext,
|
|
@@ -39,9 +39,9 @@ exports.handler = async options => {
|
|
|
39
39
|
const { forceCreate, path: projectPath, message } = options;
|
|
40
40
|
const accountId = getAccountId(options);
|
|
41
41
|
const accountConfig = getAccountConfig(accountId);
|
|
42
|
-
const
|
|
42
|
+
const accountType = accountConfig && accountConfig.accountType;
|
|
43
43
|
|
|
44
|
-
trackCommandUsage('project-upload', { type:
|
|
44
|
+
trackCommandUsage('project-upload', { type: accountType }, accountId);
|
|
45
45
|
|
|
46
46
|
const { projectConfig, projectDir } = await getProjectConfig(projectPath);
|
|
47
47
|
|
|
@@ -66,7 +66,7 @@ exports.handler = async options => {
|
|
|
66
66
|
if (result.uploadError) {
|
|
67
67
|
if (
|
|
68
68
|
isSpecifiedError(result.uploadError, {
|
|
69
|
-
subCategory:
|
|
69
|
+
subCategory: PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
|
70
70
|
})
|
|
71
71
|
) {
|
|
72
72
|
logger.log();
|
|
@@ -5,7 +5,7 @@ const {
|
|
|
5
5
|
ApiErrorContext,
|
|
6
6
|
} = require('../../lib/errorHandlers/apiErrors');
|
|
7
7
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
8
|
-
const {
|
|
8
|
+
const { PROJECT_ERROR_TYPES } = require('../../lib/constants');
|
|
9
9
|
const {
|
|
10
10
|
addAccountOptions,
|
|
11
11
|
addConfigOptions,
|
|
@@ -67,7 +67,7 @@ const handleUserInput = (accountId, projectName, currentBuildId) => {
|
|
|
67
67
|
} catch (err) {
|
|
68
68
|
if (
|
|
69
69
|
isSpecifiedError(err, {
|
|
70
|
-
subCategory:
|
|
70
|
+
subCategory: PROJECT_ERROR_TYPES.BUILD_NOT_IN_PROGRESS,
|
|
71
71
|
})
|
|
72
72
|
) {
|
|
73
73
|
process.exit(EXIT_CODES.SUCCESS);
|
|
@@ -13,7 +13,6 @@ const { buildSandbox } = require('../../lib/sandboxCreate');
|
|
|
13
13
|
const { uiFeatureHighlight, uiAccountDescription } = require('../../lib/ui');
|
|
14
14
|
const {
|
|
15
15
|
sandboxTypeMap,
|
|
16
|
-
getSandboxTypeAsString,
|
|
17
16
|
getAvailableSyncTypes,
|
|
18
17
|
syncTypes,
|
|
19
18
|
validateSandboxUsageLimits,
|
|
@@ -35,7 +34,10 @@ const {
|
|
|
35
34
|
isMissingScopeError,
|
|
36
35
|
} = require('@hubspot/local-dev-lib/errors/apiErrors');
|
|
37
36
|
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
|
|
38
|
-
const {
|
|
37
|
+
const {
|
|
38
|
+
HUBSPOT_ACCOUNT_TYPES,
|
|
39
|
+
HUBSPOT_ACCOUNT_TYPE_STRINGS,
|
|
40
|
+
} = require('@hubspot/local-dev-lib/constants/config');
|
|
39
41
|
|
|
40
42
|
const i18nKey = 'cli.commands.sandbox.subcommands.create';
|
|
41
43
|
|
|
@@ -54,13 +56,16 @@ exports.handler = async options => {
|
|
|
54
56
|
|
|
55
57
|
// Default account is not a production portal
|
|
56
58
|
if (
|
|
57
|
-
accountConfig.
|
|
58
|
-
accountConfig.
|
|
59
|
+
accountConfig.accountType &&
|
|
60
|
+
accountConfig.accountType !== HUBSPOT_ACCOUNT_TYPES.STANDARD
|
|
59
61
|
) {
|
|
60
62
|
logger.error(
|
|
61
|
-
i18n(`${i18nKey}.failure.
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
i18n(`${i18nKey}.failure.invalidAccountType`, {
|
|
64
|
+
accountType:
|
|
65
|
+
HUBSPOT_ACCOUNT_TYPE_STRINGS[
|
|
66
|
+
HUBSPOT_ACCOUNT_TYPES[accountConfig.accountType]
|
|
67
|
+
],
|
|
68
|
+
accountName: accountConfig.name,
|
|
64
69
|
})
|
|
65
70
|
);
|
|
66
71
|
process.exit(EXIT_CODES.ERROR);
|
|
@@ -69,7 +74,7 @@ exports.handler = async options => {
|
|
|
69
74
|
let typePrompt;
|
|
70
75
|
let namePrompt;
|
|
71
76
|
|
|
72
|
-
if ((type && !sandboxTypeMap[type]) || !type) {
|
|
77
|
+
if ((type && !sandboxTypeMap[type.toLowerCase()]) || !type) {
|
|
73
78
|
if (!force) {
|
|
74
79
|
typePrompt = await sandboxTypePrompt();
|
|
75
80
|
} else {
|
|
@@ -77,7 +82,9 @@ exports.handler = async options => {
|
|
|
77
82
|
process.exit(EXIT_CODES.ERROR);
|
|
78
83
|
}
|
|
79
84
|
}
|
|
80
|
-
const sandboxType =
|
|
85
|
+
const sandboxType = type
|
|
86
|
+
? sandboxTypeMap[type.toLowerCase()]
|
|
87
|
+
: typePrompt.type;
|
|
81
88
|
|
|
82
89
|
// Check usage limits and exit if parent portal has no available sandboxes for the selected type
|
|
83
90
|
try {
|
|
@@ -117,11 +124,15 @@ exports.handler = async options => {
|
|
|
117
124
|
let contactRecordsSyncPromptResult = true;
|
|
118
125
|
if (!force) {
|
|
119
126
|
const syncI18nKey = 'cli.lib.sandbox.sync';
|
|
127
|
+
const sandboxLangKey =
|
|
128
|
+
sandboxType === HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX
|
|
129
|
+
? 'developer'
|
|
130
|
+
: 'standard';
|
|
120
131
|
const { sandboxSyncPrompt } = await promptUser([
|
|
121
132
|
{
|
|
122
133
|
name: 'sandboxSyncPrompt',
|
|
123
134
|
type: 'confirm',
|
|
124
|
-
message: i18n(`${syncI18nKey}.confirm.createFlow.${
|
|
135
|
+
message: i18n(`${syncI18nKey}.confirm.createFlow.${sandboxLangKey}`, {
|
|
125
136
|
parentAccountName: uiAccountDescription(accountId),
|
|
126
137
|
sandboxName,
|
|
127
138
|
}),
|
|
@@ -135,7 +146,7 @@ exports.handler = async options => {
|
|
|
135
146
|
name: 'contactRecordsSyncPrompt',
|
|
136
147
|
type: 'confirm',
|
|
137
148
|
message: i18n(
|
|
138
|
-
`${syncI18nKey}.confirm.syncContactRecords.${
|
|
149
|
+
`${syncI18nKey}.confirm.syncContactRecords.${sandboxLangKey}`
|
|
139
150
|
),
|
|
140
151
|
},
|
|
141
152
|
]);
|
|
@@ -191,7 +202,7 @@ exports.handler = async options => {
|
|
|
191
202
|
}
|
|
192
203
|
|
|
193
204
|
const highlightItems = ['accountsUseCommand', 'projectCreateCommand'];
|
|
194
|
-
if (sandboxType ===
|
|
205
|
+
if (sandboxType === HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX) {
|
|
195
206
|
highlightItems.push('projectDevCommand');
|
|
196
207
|
} else {
|
|
197
208
|
highlightItems.push('projectUploadCommand');
|