@hubspot/cli 5.1.4-beta.3 → 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 +1 -4
- 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/dev.js +4 -4
- package/commands/project/listBuilds.js +1 -4
- package/commands/project/logs.js +5 -6
- package/commands/project/upload.js +2 -2
- package/commands/project/watch.js +2 -2
- 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 +24 -3
- 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 +84 -0
- 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/sandboxCreate.js +1 -1
- package/lib/sandboxSync.js +1 -1
- package/lib/sandboxes.js +1 -1
- package/lib/serverlessLogs.js +2 -2
- package/lib/ui/git.js +28 -0
- package/lib/{ui.js → ui/index.js} +6 -5
- 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,
|
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,
|
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');
|
|
@@ -310,7 +310,7 @@ exports.handler = async options => {
|
|
|
310
310
|
if (initialUploadResult.uploadError) {
|
|
311
311
|
if (
|
|
312
312
|
isSpecifiedError(initialUploadResult.uploadError, {
|
|
313
|
-
subCategory:
|
|
313
|
+
subCategory: PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
|
314
314
|
})
|
|
315
315
|
) {
|
|
316
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,
|
|
@@ -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);
|
|
@@ -21,6 +21,10 @@ const {
|
|
|
21
21
|
ApiErrorContext,
|
|
22
22
|
logApiUploadErrorInstance,
|
|
23
23
|
} = require('../../lib/errorHandlers/apiErrors');
|
|
24
|
+
const { handleExit, handleKeypress } = require('../../lib/process');
|
|
25
|
+
|
|
26
|
+
exports.command = 'preview [--src] [--dest]';
|
|
27
|
+
exports.describe = false; // i18n(`${i18nKey}.describe`) - Hiding command
|
|
24
28
|
|
|
25
29
|
const validateSrcPath = src => {
|
|
26
30
|
const logInvalidPath = () => {
|
|
@@ -43,8 +47,19 @@ const validateSrcPath = src => {
|
|
|
43
47
|
return true;
|
|
44
48
|
};
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
const handleUserInput = () => {
|
|
51
|
+
const onTerminate = () => {
|
|
52
|
+
logger.log(i18n(`${i18nKey}.logs.processExited`));
|
|
53
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
handleExit(onTerminate);
|
|
57
|
+
handleKeypress(key => {
|
|
58
|
+
if ((key.ctrl && key.name === 'c') || key.name === 'q') {
|
|
59
|
+
onTerminate();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
48
63
|
|
|
49
64
|
exports.handler = async options => {
|
|
50
65
|
const { notify, skipUpload, noSsl, port, debug } = options;
|
|
@@ -131,6 +146,7 @@ exports.handler = async options => {
|
|
|
131
146
|
port,
|
|
132
147
|
debug,
|
|
133
148
|
uploadOptions,
|
|
149
|
+
handleUserInput,
|
|
134
150
|
});
|
|
135
151
|
};
|
|
136
152
|
|
package/commands/upload.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
uploadFolder,
|
|
5
|
+
hasUploadErrors,
|
|
6
|
+
} = require('@hubspot/local-dev-lib/cms/uploadFolder');
|
|
4
7
|
const {
|
|
5
8
|
getFileMapperQueryValues,
|
|
6
9
|
} = require('@hubspot/local-dev-lib/fileMapper');
|
|
@@ -46,7 +49,7 @@ const {
|
|
|
46
49
|
FieldsJs,
|
|
47
50
|
isConvertableFieldJs,
|
|
48
51
|
cleanupTmpDirSync,
|
|
49
|
-
} = require('@hubspot/
|
|
52
|
+
} = require('@hubspot/local-dev-lib/cms/handleFieldsJS');
|
|
50
53
|
|
|
51
54
|
exports.command = 'upload [--src] [--dest]';
|
|
52
55
|
exports.describe = i18n(`${i18nKey}.describe`);
|
package/commands/watch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
-
const { watch } = require('@hubspot/
|
|
4
|
+
const { watch } = require('@hubspot/local-dev-lib/cms/watch');
|
|
5
5
|
const { getCwd } = require('@hubspot/local-dev-lib/path');
|
|
6
6
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
7
7
|
|
package/lang/en.lyaml
CHANGED
|
@@ -221,7 +221,7 @@ en:
|
|
|
221
221
|
schemaViewable: "Schema can be viewed at {{ url }}"
|
|
222
222
|
delete:
|
|
223
223
|
describe: "Delete a custom object schema"
|
|
224
|
-
|
|
224
|
+
errors:
|
|
225
225
|
delete: "Unable to delete {{ name }}"
|
|
226
226
|
examples:
|
|
227
227
|
default: "Delete \"schemaName\" schema"
|
|
@@ -908,6 +908,8 @@ en:
|
|
|
908
908
|
start: "Starting..."
|
|
909
909
|
uploading: "Uploading..."
|
|
910
910
|
finish: "Complete!"
|
|
911
|
+
logs:
|
|
912
|
+
processExited: "Stopping dev server..."
|
|
911
913
|
convertFields:
|
|
912
914
|
describe: "Converts a specific JavaScript fields file of a module or theme to JSON"
|
|
913
915
|
positionals:
|
|
@@ -983,8 +985,7 @@ en:
|
|
|
983
985
|
feedbackMessage: "How are you liking the new projects and developer tools? \n > Run `{{#yellow}}hs feedback{{/yellow}}` to let us know what you think!\n"
|
|
984
986
|
showPlatformVersionWarning:
|
|
985
987
|
docsLink: "Projects platform versioning (BETA)"
|
|
986
|
-
noPlatformVersion: "No platformVersion found in hsproject.json. Falling back to version
|
|
987
|
-
noPlatformVersionAlt: "No platformVersion found in hsproject.json. Falling back to default version. Starting Mar 31, 2024, new project builds without a specified version will no longer be supported. To update your project to the latest version, see {{ docsLink }}."
|
|
988
|
+
noPlatformVersion: "No platformVersion found in hsproject.json. Falling back to default version. Starting Mar 31, 2024, new project builds without a specified version will no longer be supported. To update your project to the latest version, see {{ docsLink }}."
|
|
988
989
|
deprecatedVersion: "Starting Mar 31, 2024, new project builds with platformVersion 2023.1 or unspecified versions will no longer be supported. It's recommended that you update your project to the latest version. For more info, see {{ docsLink }}."
|
|
989
990
|
ui:
|
|
990
991
|
betaTag: "{{#bold}}[BETA]{{/bold}}"
|
|
@@ -1037,6 +1038,17 @@ en:
|
|
|
1037
1038
|
linkText: "HubSpot's sample projects"
|
|
1038
1039
|
url: "https://developers.hubspot.com/docs/platform/sample-projects?utm_source=cli&utm_content=project_create_whats_next"
|
|
1039
1040
|
message: "See {{ link }}"
|
|
1041
|
+
git:
|
|
1042
|
+
securityIssue: "Security Issue Detected"
|
|
1043
|
+
configFileTracked: "The HubSpot config file can be tracked by git."
|
|
1044
|
+
fileName: "File: \"{{ configPath }}\""
|
|
1045
|
+
remediate: "To remediate:"
|
|
1046
|
+
moveConfig: "- Move the config file to your home directory: '{{ homeDir }}'"
|
|
1047
|
+
addGitignore: "- Add gitignore pattern '{{ configPath }}' to a .gitignore file in root of your repository."
|
|
1048
|
+
noRemote: "- Ensure that the config file has not already been pushed to a remote repository."
|
|
1049
|
+
checkFailed: "Unable to determine if config file is properly ignored by git."
|
|
1050
|
+
serverlessFunctionLogs:
|
|
1051
|
+
unableToProcessLog: "Unable to process log {{ log }}"
|
|
1040
1052
|
commonOpts:
|
|
1041
1053
|
options:
|
|
1042
1054
|
portal:
|
|
@@ -1342,6 +1354,15 @@ en:
|
|
|
1342
1354
|
portalMissingScope: "Your account does not have access to this action. Talk to an account admin to request it."
|
|
1343
1355
|
userMissingScope: "You don't have access to this action. Ask an account admin to change your permissions in Users & Teams settings."
|
|
1344
1356
|
genericMissingScope: "Your access key does not allow this action. Please generate a new access key by running `hs auth personalaccesskey`."
|
|
1357
|
+
overrideErrors:
|
|
1358
|
+
platformVersionErrors:
|
|
1359
|
+
header: "Platform version update required"
|
|
1360
|
+
unspecifiedPlatformVersion: "Projects with {{#bold}}unspecified platformVersion{{/bold}} are no longer supported."
|
|
1361
|
+
platformVersionRetired: "Projects with {{#bold}} platformVersion {{ platformVersion }}{{/bold}} are no longer supported."
|
|
1362
|
+
nonExistentPlatformVersion: "Projects with {{#bold}} platformVersion {{ platformVersion }}{{/bold}} are not supported."
|
|
1363
|
+
updateProject: "Please update your project to the latest version and try again."
|
|
1364
|
+
docsLink: "Projects platform versioning (BETA)"
|
|
1365
|
+
betaLink: "For more info, see {{ docsLink }}."
|
|
1345
1366
|
|
|
1346
1367
|
|
|
1347
1368
|
|
package/lib/DevServerManager.js
CHANGED
|
@@ -18,7 +18,8 @@ const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
|
|
|
18
18
|
const i18nKey = 'cli.lib.DevServerManager';
|
|
19
19
|
|
|
20
20
|
const SERVER_KEYS = {
|
|
21
|
-
|
|
21
|
+
privateApp: 'privateApp',
|
|
22
|
+
publicApp: 'publicApp',
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
class DevServerManager {
|
|
@@ -29,8 +30,12 @@ class DevServerManager {
|
|
|
29
30
|
this.server = null;
|
|
30
31
|
this.path = null;
|
|
31
32
|
this.devServers = {
|
|
32
|
-
[SERVER_KEYS.
|
|
33
|
-
componentType: COMPONENT_TYPES.
|
|
33
|
+
[SERVER_KEYS.privateApp]: {
|
|
34
|
+
componentType: COMPONENT_TYPES.privateApp,
|
|
35
|
+
serverInterface: DevModeInterface,
|
|
36
|
+
},
|
|
37
|
+
[SERVER_KEYS.publicApp]: {
|
|
38
|
+
componentType: COMPONENT_TYPES.publicApp,
|
|
34
39
|
serverInterface: DevModeInterface,
|
|
35
40
|
},
|
|
36
41
|
};
|
package/lib/LocalDevManager.js
CHANGED
|
@@ -8,13 +8,13 @@ const {
|
|
|
8
8
|
getAccountId,
|
|
9
9
|
getConfigDefaultAccount,
|
|
10
10
|
} = require('@hubspot/local-dev-lib/config');
|
|
11
|
-
const { PROJECT_CONFIG_FILE } = require('
|
|
12
|
-
const SpinniesManager = require('./SpinniesManager');
|
|
11
|
+
const { PROJECT_CONFIG_FILE } = require('./constants');
|
|
12
|
+
const SpinniesManager = require('./ui/SpinniesManager');
|
|
13
13
|
const DevServerManager = require('./DevServerManager');
|
|
14
14
|
const { EXIT_CODES } = require('./enums/exitCodes');
|
|
15
15
|
const { getProjectDetailUrl } = require('./projects');
|
|
16
16
|
const {
|
|
17
|
-
|
|
17
|
+
CONFIG_FILES,
|
|
18
18
|
COMPONENT_TYPES,
|
|
19
19
|
findProjectComponents,
|
|
20
20
|
getAppCardConfigs,
|
|
@@ -243,7 +243,7 @@ class LocalDevManager {
|
|
|
243
243
|
let missingComponents = [];
|
|
244
244
|
|
|
245
245
|
runnableComponents.forEach(({ type, config, path }) => {
|
|
246
|
-
if (
|
|
246
|
+
if (Object.values(COMPONENT_TYPES).includes(type)) {
|
|
247
247
|
const cardConfigs = getAppCardConfigs(config, path);
|
|
248
248
|
|
|
249
249
|
if (!deployedComponentNames.includes(config.name)) {
|
|
@@ -283,9 +283,12 @@ class LocalDevManager {
|
|
|
283
283
|
});
|
|
284
284
|
|
|
285
285
|
const configPaths = runnableComponents
|
|
286
|
-
.filter(({ type }) =>
|
|
286
|
+
.filter(({ type }) => Object.values(COMPONENT_TYPES).includes(type))
|
|
287
287
|
.map(component => {
|
|
288
|
-
const appConfigPath = path.join(
|
|
288
|
+
const appConfigPath = path.join(
|
|
289
|
+
component.path,
|
|
290
|
+
CONFIG_FILES[component.type]
|
|
291
|
+
);
|
|
289
292
|
return appConfigPath;
|
|
290
293
|
});
|
|
291
294
|
|