@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
package/lib/sandboxes.js
CHANGED
|
@@ -8,59 +8,51 @@ 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 {
|
|
15
15
|
HUBSPOT_ACCOUNT_TYPES,
|
|
16
16
|
} = require('@hubspot/local-dev-lib/constants/config');
|
|
17
|
-
const {
|
|
18
|
-
STANDARD_SANDBOX_TYPE,
|
|
19
|
-
DEVELOPER_SANDBOX_TYPE,
|
|
20
|
-
DEVELOPER_SANDBOX,
|
|
21
|
-
STANDARD_SANDBOX,
|
|
22
|
-
} = require('./constants');
|
|
23
17
|
|
|
24
18
|
const syncTypes = {
|
|
25
19
|
OBJECT_RECORDS: 'object-records',
|
|
26
20
|
};
|
|
27
21
|
|
|
28
22
|
const sandboxTypeMap = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
DEVELOPMENT: DEVELOPER_SANDBOX_TYPE,
|
|
34
|
-
development: DEVELOPER_SANDBOX_TYPE,
|
|
35
|
-
STANDARD: STANDARD_SANDBOX_TYPE,
|
|
36
|
-
standard: STANDARD_SANDBOX_TYPE,
|
|
23
|
+
dev: HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX,
|
|
24
|
+
developer: HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX,
|
|
25
|
+
development: HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX,
|
|
26
|
+
standard: HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX,
|
|
37
27
|
};
|
|
38
28
|
|
|
39
29
|
const sandboxApiTypeMap = {
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
[HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX]: 1,
|
|
31
|
+
[HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX]: 2,
|
|
42
32
|
};
|
|
43
33
|
|
|
44
34
|
const getSandboxTypeAsString = accountType => {
|
|
45
|
-
if (
|
|
46
|
-
accountType === HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX ||
|
|
47
|
-
accountType === DEVELOPER_SANDBOX // remove line once sandboxAccountType is removed
|
|
48
|
-
) {
|
|
35
|
+
if (accountType === HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX) {
|
|
49
36
|
return 'development'; // Only place we're using this specific name
|
|
50
37
|
}
|
|
51
|
-
return
|
|
38
|
+
return 'standard';
|
|
52
39
|
};
|
|
53
40
|
|
|
54
41
|
const getSandboxName = config =>
|
|
55
|
-
`[${getSandboxTypeAsString(
|
|
56
|
-
config.accountType || config.sandboxAccountType
|
|
57
|
-
)} sandbox] `;
|
|
42
|
+
`[${getSandboxTypeAsString(config.accountType)} sandbox] `;
|
|
58
43
|
|
|
59
44
|
const isSandbox = config =>
|
|
60
|
-
config.accountType
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
45
|
+
config.accountType &&
|
|
46
|
+
(config.accountType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX ||
|
|
47
|
+
config.accountType === HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX);
|
|
48
|
+
|
|
49
|
+
const isStandardSandbox = config =>
|
|
50
|
+
config.accountType &&
|
|
51
|
+
config.accountType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX;
|
|
52
|
+
|
|
53
|
+
const isDevelopmentSandbox = config =>
|
|
54
|
+
config.accountType &&
|
|
55
|
+
config.accountType === HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX;
|
|
64
56
|
|
|
65
57
|
function getHasSandboxesByType(parentAccountConfig, type) {
|
|
66
58
|
const config = getConfig();
|
|
@@ -70,8 +62,8 @@ function getHasSandboxesByType(parentAccountConfig, type) {
|
|
|
70
62
|
(portal.parentAccountId !== null ||
|
|
71
63
|
portal.parentAccountId !== undefined) &&
|
|
72
64
|
portal.parentAccountId === parentPortalId &&
|
|
73
|
-
portal.
|
|
74
|
-
|
|
65
|
+
portal.accountType &&
|
|
66
|
+
portal.accountType === type
|
|
75
67
|
) {
|
|
76
68
|
return true;
|
|
77
69
|
}
|
|
@@ -116,14 +108,15 @@ const getSyncTypesWithContactRecordsPrompt = async (
|
|
|
116
108
|
syncTasks.some(t => t.type === syncTypes.OBJECT_RECORDS) &&
|
|
117
109
|
!skipPrompt
|
|
118
110
|
) {
|
|
111
|
+
const langKey = isDevelopmentSandbox(accountConfig)
|
|
112
|
+
? 'developer'
|
|
113
|
+
: 'standard';
|
|
119
114
|
const { contactRecordsSyncPrompt } = await promptUser([
|
|
120
115
|
{
|
|
121
116
|
name: 'contactRecordsSyncPrompt',
|
|
122
117
|
type: 'confirm',
|
|
123
118
|
message: i18n(
|
|
124
|
-
`cli.lib.sandbox.sync.confirm.syncContactRecords.${
|
|
125
|
-
sandboxTypeMap[accountConfig.sandboxAccountType]
|
|
126
|
-
}`
|
|
119
|
+
`cli.lib.sandbox.sync.confirm.syncContactRecords.${langKey}`
|
|
127
120
|
),
|
|
128
121
|
},
|
|
129
122
|
]);
|
|
@@ -146,13 +139,13 @@ const validateSandboxUsageLimits = async (accountConfig, sandboxType, env) => {
|
|
|
146
139
|
if (!usage) {
|
|
147
140
|
throw new Error('Unable to fetch sandbox usage limits. Please try again.');
|
|
148
141
|
}
|
|
149
|
-
if (sandboxType ===
|
|
150
|
-
if (usage[
|
|
151
|
-
const devSandboxLimit = usage[
|
|
142
|
+
if (sandboxType === HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX) {
|
|
143
|
+
if (usage['DEVELOPER'].available === 0) {
|
|
144
|
+
const devSandboxLimit = usage['DEVELOPER'].limit;
|
|
152
145
|
const plural = devSandboxLimit !== 1;
|
|
153
146
|
const hasDevelopmentSandboxes = getHasSandboxesByType(
|
|
154
147
|
accountConfig,
|
|
155
|
-
|
|
148
|
+
HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX
|
|
156
149
|
);
|
|
157
150
|
if (hasDevelopmentSandboxes) {
|
|
158
151
|
throw new Error(
|
|
@@ -183,13 +176,13 @@ const validateSandboxUsageLimits = async (accountConfig, sandboxType, env) => {
|
|
|
183
176
|
}
|
|
184
177
|
}
|
|
185
178
|
}
|
|
186
|
-
if (sandboxType ===
|
|
187
|
-
if (usage[
|
|
188
|
-
const standardSandboxLimit = usage[
|
|
179
|
+
if (sandboxType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX) {
|
|
180
|
+
if (usage['STANDARD'].available === 0) {
|
|
181
|
+
const standardSandboxLimit = usage['STANDARD'].limit;
|
|
189
182
|
const plural = standardSandboxLimit !== 1;
|
|
190
183
|
const hasStandardSandboxes = getHasSandboxesByType(
|
|
191
184
|
accountConfig,
|
|
192
|
-
|
|
185
|
+
HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX
|
|
193
186
|
);
|
|
194
187
|
if (hasStandardSandboxes) {
|
|
195
188
|
throw new Error(
|
|
@@ -364,6 +357,8 @@ module.exports = {
|
|
|
364
357
|
sandboxApiTypeMap,
|
|
365
358
|
syncTypes,
|
|
366
359
|
isSandbox,
|
|
360
|
+
isStandardSandbox,
|
|
361
|
+
isDevelopmentSandbox,
|
|
367
362
|
getSandboxName,
|
|
368
363
|
getSandboxTypeAsString,
|
|
369
364
|
getHasSandboxesByType,
|
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,14 +1,16 @@
|
|
|
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
|
|
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
|
+
|
|
8
10
|
const {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} = require('
|
|
11
|
+
HUBSPOT_ACCOUNT_TYPE_STRINGS,
|
|
12
|
+
HUBSPOT_ACCOUNT_TYPES,
|
|
13
|
+
} = require('@hubspot/local-dev-lib/constants/config');
|
|
12
14
|
|
|
13
15
|
const UI_COLORS = {
|
|
14
16
|
SORBET: '#FF8F59',
|
|
@@ -82,7 +84,9 @@ const uiAccountDescription = (accountId, bold = true) => {
|
|
|
82
84
|
if (isSandbox(account)) {
|
|
83
85
|
accountTypeString = getSandboxName(account);
|
|
84
86
|
} else if (isDeveloperTestAccount(account)) {
|
|
85
|
-
accountTypeString = `[${
|
|
87
|
+
accountTypeString = `[${
|
|
88
|
+
HUBSPOT_ACCOUNT_TYPE_STRINGS[HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST]
|
|
89
|
+
}] `;
|
|
86
90
|
}
|
|
87
91
|
const message = `${account.name} ${accountTypeString}(${account.portalId})`;
|
|
88
92
|
return bold ? chalk.bold(message) : message;
|
|
@@ -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.4",
|
|
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": "ae2685fbfe44d8f2570787b9e1f818202c98f70a"
|
|
50
50
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|