@hubspot/cli 5.1.4-beta.3 → 5.1.4-beta.5
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 -7
- package/commands/project/listBuilds.js +1 -4
- package/commands/project/logs.js +5 -6
- package/commands/project/upload.js +2 -5
- package/commands/project/watch.js +2 -5
- 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 +23 -6
- 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 +95 -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 +8 -46
- 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
|
@@ -2,7 +2,7 @@ const { promptUser } = require('./promptUtils');
|
|
|
2
2
|
const { fetchJsonFromRepository } = require('@hubspot/cli-lib/github');
|
|
3
3
|
const { i18n } = require('../lang');
|
|
4
4
|
const { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH } = require('../constants');
|
|
5
|
-
const { PROJECT_COMPONENT_TYPES } = require('
|
|
5
|
+
const { PROJECT_COMPONENT_TYPES } = require('../constants');
|
|
6
6
|
|
|
7
7
|
const i18nKey = 'cli.lib.prompts.projectAddPrompt';
|
|
8
8
|
|
package/lib/sandboxCreate.js
CHANGED
package/lib/sandboxSync.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const SpinniesManager = require('./SpinniesManager');
|
|
1
|
+
const SpinniesManager = require('./ui/SpinniesManager');
|
|
2
2
|
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
|
|
3
3
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
4
4
|
const { i18n } = require('./lang');
|
package/lib/sandboxes.js
CHANGED
|
@@ -8,7 +8,7 @@ const {
|
|
|
8
8
|
getSandboxUsageLimits,
|
|
9
9
|
} = require('@hubspot/local-dev-lib/sandboxes');
|
|
10
10
|
const { getConfig, getAccountId } = require('@hubspot/local-dev-lib/config');
|
|
11
|
-
const CliProgressMultibarManager = require('./CliProgressMultibarManager');
|
|
11
|
+
const CliProgressMultibarManager = require('./ui/CliProgressMultibarManager');
|
|
12
12
|
const { promptUser } = require('./prompts/promptUtils');
|
|
13
13
|
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
|
|
14
14
|
const {
|
package/lib/serverlessLogs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const https = require('https');
|
|
2
|
-
const SpinniesManager = require('./SpinniesManager');
|
|
2
|
+
const SpinniesManager = require('./ui/SpinniesManager');
|
|
3
3
|
const { handleExit, handleKeypress } = require('./process');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
6
|
-
const { outputLogs } = require('
|
|
6
|
+
const { outputLogs } = require('./ui/serverlessFunctionLogs');
|
|
7
7
|
const {
|
|
8
8
|
logServerlessFunctionApiErrorInstance,
|
|
9
9
|
logApiErrorInstance,
|
package/lib/ui/git.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const os = require('os');
|
|
2
|
+
const { checkGitInclusion } = require('@hubspot/local-dev-lib/gitignore');
|
|
3
|
+
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
4
|
+
const { i18n } = require('../lang');
|
|
5
|
+
|
|
6
|
+
const i18nKey = 'cli.lib.ui.git';
|
|
7
|
+
|
|
8
|
+
function checkAndWarnGitInclusion(configPath) {
|
|
9
|
+
try {
|
|
10
|
+
const { inGit, configIgnored } = checkGitInclusion(configPath);
|
|
11
|
+
|
|
12
|
+
if (!inGit || configIgnored) return;
|
|
13
|
+
logger.warn(i18n(`${i18nKey}.securityIssue`));
|
|
14
|
+
logger.warn(i18n(`${i18nKey}.configFileTracked`));
|
|
15
|
+
logger.warn(i18n(`${i18nKey}.fileName`, { configPath }));
|
|
16
|
+
logger.warn(i18n(`${i18nKey}.remediate`));
|
|
17
|
+
logger.warn(i18n(`${i18nKey}.moveConfig`, { homeDir: os.homedir() }));
|
|
18
|
+
logger.warn(i18n(`${i18nKey}.addGitignore`, { configPath }));
|
|
19
|
+
logger.warn(i18n(`${i18nKey}.noRemote`));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
// fail silently
|
|
22
|
+
logger.debug(i18n(`${i18nKey}.checkFailed`));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = {
|
|
27
|
+
checkAndWarnGitInclusion,
|
|
28
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
-
const supportsHyperlinks = require('../lib/supportHyperlinks');
|
|
3
|
-
const supportsColor = require('../lib/supportsColor');
|
|
4
2
|
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
|
|
5
|
-
const { i18n } = require('./lang');
|
|
6
3
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const supportsHyperlinks = require('./supportHyperlinks');
|
|
5
|
+
const supportsColor = require('./supportsColor');
|
|
6
|
+
const { isSandbox, getSandboxName } = require('../sandboxes');
|
|
7
|
+
const { isDeveloperTestAccount } = require('../developerTestAccounts');
|
|
8
|
+
const { i18n } = require('../lang');
|
|
9
|
+
|
|
9
10
|
const {
|
|
10
11
|
HUBSPOT_ACCOUNT_TYPE_STRINGS,
|
|
11
12
|
HUBSPOT_ACCOUNT_TYPES,
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const moment = require('moment');
|
|
2
|
+
const chalk = require('chalk');
|
|
3
|
+
const { logger, Styles } = require('@hubspot/local-dev-lib/logger');
|
|
4
|
+
const { i18n } = require('../lang');
|
|
5
|
+
|
|
6
|
+
const i18nKey = 'cli.lib.ui.serverlessFunctionLogs';
|
|
7
|
+
|
|
8
|
+
const SEPARATOR = ' - ';
|
|
9
|
+
const LOG_STATUS_COLORS = {
|
|
10
|
+
SUCCESS: Styles.success,
|
|
11
|
+
ERROR: Styles.error,
|
|
12
|
+
UNHANDLED_ERROR: Styles.error,
|
|
13
|
+
HANDLED_ERROR: Styles.error,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function errorHandler(log, options) {
|
|
17
|
+
return `${formatLogHeader(log, options)}${formatError(log, options)}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const logHandler = {
|
|
21
|
+
ERROR: errorHandler,
|
|
22
|
+
UNHANDLED_ERROR: errorHandler,
|
|
23
|
+
HANDLED_ERROR: errorHandler,
|
|
24
|
+
SUCCESS: (log, options) => {
|
|
25
|
+
return `${formatLogHeader(log, options)}${formatSuccess(log, options)}`;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function formatSuccess(log, options) {
|
|
30
|
+
if (!log.log || options.compact) {
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return `\n${log.log}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function formatError(log, options) {
|
|
38
|
+
if (!log.error || options.compact) {
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return `${log.error.type}: ${log.error.message}\n${formatStackTrace(log)}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function formatLogHeader(log, options) {
|
|
46
|
+
const color = LOG_STATUS_COLORS[log.status];
|
|
47
|
+
const headerInsertion =
|
|
48
|
+
options && options.insertions && options.insertions.header;
|
|
49
|
+
|
|
50
|
+
return `${formatTimestamp(log)}${SEPARATOR}${color(log.status)}${
|
|
51
|
+
headerInsertion ? `${SEPARATOR}${headerInsertion}` : ''
|
|
52
|
+
}${SEPARATOR}${formatExecutionTime(log)}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function formatStackTrace(log) {
|
|
56
|
+
const stackTrace = (log.error.stackTrace && log.error.stackTrace[0]) || [];
|
|
57
|
+
return stackTrace
|
|
58
|
+
.map(trace => {
|
|
59
|
+
return ` at ${trace}\n`;
|
|
60
|
+
})
|
|
61
|
+
.join('');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function formatTimestamp(log) {
|
|
65
|
+
return `${chalk.whiteBright(moment(log.createdAt).toISOString())}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function formatExecutionTime(log) {
|
|
69
|
+
return `${chalk.whiteBright('Execution Time:')} ${log.executionTime}ms`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function processLog(log, options) {
|
|
73
|
+
try {
|
|
74
|
+
return logHandler[log.status](log, options);
|
|
75
|
+
} catch (e) {
|
|
76
|
+
logger.error(
|
|
77
|
+
i18n(`${i18nKey}.unableToProcessLog`, {
|
|
78
|
+
log: JSON.stringify(log),
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function processLogs(logsResp, options) {
|
|
85
|
+
if (!logsResp || (logsResp.results && !logsResp.results.length)) {
|
|
86
|
+
return 'No logs found.';
|
|
87
|
+
} else if (logsResp.results && logsResp.results.length) {
|
|
88
|
+
return logsResp.results
|
|
89
|
+
.map(log => {
|
|
90
|
+
return processLog(log, options);
|
|
91
|
+
})
|
|
92
|
+
.join('\n');
|
|
93
|
+
}
|
|
94
|
+
return processLog(logsResp, options);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function outputLogs(logsResp, options) {
|
|
98
|
+
logger.log(processLogs(logsResp, options));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
module.exports = {
|
|
102
|
+
outputLogs,
|
|
103
|
+
};
|
package/lib/ui/table.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { table } = require('table');
|
|
3
|
+
|
|
4
|
+
function isObject(item) {
|
|
5
|
+
return item && typeof item === 'object' && !Array.isArray(item);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function mergeDeep(target, ...sources) {
|
|
9
|
+
if (!sources.length) return target;
|
|
10
|
+
const source = sources.shift();
|
|
11
|
+
|
|
12
|
+
if (isObject(target) && source && isObject(source)) {
|
|
13
|
+
for (const key in source) {
|
|
14
|
+
if (isObject(source[key])) {
|
|
15
|
+
if (!target[key]) Object.assign(target, { [key]: {} });
|
|
16
|
+
mergeDeep(target[key], source[key]);
|
|
17
|
+
} else {
|
|
18
|
+
Object.assign(target, { [key]: source[key] });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return mergeDeep(target, ...sources);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const tableConfigDefaults = {
|
|
27
|
+
singleLine: true,
|
|
28
|
+
border: {
|
|
29
|
+
topBody: '',
|
|
30
|
+
topJoin: '',
|
|
31
|
+
topLeft: '',
|
|
32
|
+
topRight: '',
|
|
33
|
+
|
|
34
|
+
bottomBody: '',
|
|
35
|
+
bottomJoin: '',
|
|
36
|
+
bottomLeft: '',
|
|
37
|
+
bottomRight: '',
|
|
38
|
+
|
|
39
|
+
bodyLeft: '',
|
|
40
|
+
bodyRight: '',
|
|
41
|
+
bodyJoin: '',
|
|
42
|
+
|
|
43
|
+
joinBody: '',
|
|
44
|
+
joinLeft: '',
|
|
45
|
+
joinRight: '',
|
|
46
|
+
joinJoin: '',
|
|
47
|
+
},
|
|
48
|
+
columnDefault: {
|
|
49
|
+
paddingLeft: 0,
|
|
50
|
+
paddingRight: 1,
|
|
51
|
+
},
|
|
52
|
+
drawHorizontalLine: () => {
|
|
53
|
+
return false;
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
function getTableContents(tableData = [], tableConfig = {}) {
|
|
58
|
+
const mergedConfig = mergeDeep({}, tableConfigDefaults, tableConfig);
|
|
59
|
+
|
|
60
|
+
return table(tableData, mergedConfig);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function getTableHeader(headerItems) {
|
|
64
|
+
return headerItems.map(headerItem => chalk.bold(headerItem));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = {
|
|
68
|
+
getTableContents,
|
|
69
|
+
getTableHeader,
|
|
70
|
+
};
|
package/lib/upload.js
CHANGED
|
@@ -3,7 +3,9 @@ const { walk } = require('@hubspot/local-dev-lib/fs');
|
|
|
3
3
|
const { createIgnoreFilter } = require('@hubspot/local-dev-lib/ignoreRules');
|
|
4
4
|
const { fieldsJsPrompt } = require('../lib/prompts/cmsFieldPrompt');
|
|
5
5
|
const { isAllowedExtension } = require('@hubspot/local-dev-lib/path');
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
isConvertableFieldJs,
|
|
8
|
+
} = require('@hubspot/local-dev-lib/cms/handleFieldsJS');
|
|
7
9
|
const { logErrorInstance } = require('./errorHandlers/standardErrors');
|
|
8
10
|
|
|
9
11
|
/*
|
package/lib/usageTracking.js
CHANGED
|
@@ -3,7 +3,9 @@ const {
|
|
|
3
3
|
isTrackingAllowed,
|
|
4
4
|
getAccountConfig,
|
|
5
5
|
} = require('@hubspot/local-dev-lib/config');
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
API_KEY_AUTH_METHOD,
|
|
8
|
+
} = require('@hubspot/local-dev-lib/constants/auth');
|
|
7
9
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
8
10
|
const { version } = require('../package.json');
|
|
9
11
|
const { getPlatform } = require('./environment');
|
package/lib/validation.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
1
3
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
2
|
-
const { Mode
|
|
4
|
+
const { Mode } = require('@hubspot/cli-lib');
|
|
3
5
|
const {
|
|
4
6
|
API_KEY_AUTH_METHOD,
|
|
5
7
|
OAUTH_AUTH_METHOD,
|
|
6
8
|
PERSONAL_ACCESS_KEY_AUTH_METHOD,
|
|
7
|
-
} = require('@hubspot/
|
|
9
|
+
} = require('@hubspot/local-dev-lib/constants/auth');
|
|
8
10
|
const { commaSeparatedValues } = require('@hubspot/local-dev-lib/text');
|
|
9
11
|
const {
|
|
10
12
|
loadConfig,
|
|
@@ -13,17 +15,19 @@ const {
|
|
|
13
15
|
getAccountConfig,
|
|
14
16
|
loadConfigFromEnvironment,
|
|
15
17
|
} = require('@hubspot/local-dev-lib/config');
|
|
16
|
-
const { getAbsoluteFilePath } = require('@hubspot/local-dev-lib/path');
|
|
17
18
|
const { getOauthManager } = require('@hubspot/local-dev-lib/oauth');
|
|
18
19
|
const {
|
|
19
20
|
accessTokenForPersonalAccessKey,
|
|
20
21
|
} = require('@hubspot/local-dev-lib/personalAccessKey');
|
|
21
|
-
const {
|
|
22
|
+
const {
|
|
23
|
+
getAbsoluteFilePath,
|
|
24
|
+
getCwd,
|
|
25
|
+
getExt,
|
|
26
|
+
} = require('@hubspot/local-dev-lib/path');
|
|
22
27
|
const { getAccountId, getMode, setLogLevel } = require('./commonOpts');
|
|
23
28
|
const { logDebugInfo } = require('./debugInfo');
|
|
24
|
-
const fs = require('fs');
|
|
25
|
-
const path = require('path');
|
|
26
29
|
const { EXIT_CODES } = require('./enums/exitCodes');
|
|
30
|
+
const { checkAndWarnGitInclusion } = require('./ui/git');
|
|
27
31
|
const { logErrorInstance } = require('./errorHandlers/standardErrors');
|
|
28
32
|
|
|
29
33
|
async function loadAndValidateOptions(options, shouldValidateAccount = true) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "5.1.4-beta.
|
|
3
|
+
"version": "5.1.4-beta.5",
|
|
4
4
|
"description": "CLI for working with HubSpot",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@hubspot/cli-lib": "^9.0.0",
|
|
12
|
-
"@hubspot/local-dev-lib": "^0.3.
|
|
13
|
-
"@hubspot/serverless-dev-runtime": "5.1.4-beta.
|
|
14
|
-
"@hubspot/theme-preview-dev-server": "0.0.
|
|
15
|
-
"@hubspot/ui-extensions-dev-server": "0.8.
|
|
12
|
+
"@hubspot/local-dev-lib": "^0.3.9",
|
|
13
|
+
"@hubspot/serverless-dev-runtime": "5.1.4-beta.4",
|
|
14
|
+
"@hubspot/theme-preview-dev-server": "0.0.4",
|
|
15
|
+
"@hubspot/ui-extensions-dev-server": "0.8.11",
|
|
16
16
|
"archiver": "^5.3.0",
|
|
17
17
|
"chalk": "^4.1.2",
|
|
18
18
|
"chokidar": "^3.0.1",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "dc62da1131e837df474dcac43252f3b1f67139f5"
|
|
50
50
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|