@hubspot/cli 5.1.4-beta.6 → 5.2.0
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/use.js +1 -1
- package/commands/cms/convertFields.js +1 -1
- package/commands/project/watch.js +22 -1
- package/commands/theme/preview.js +4 -2
- package/lang/en.lyaml +1 -0
- package/lib/commonOpts.js +0 -9
- package/lib/errorHandlers/apiErrors.js +1 -3
- package/lib/process.js +0 -5
- package/lib/projects.js +6 -2
- package/lib/projectsWatch.js +1 -1
- package/lib/prompts/cmsFieldPrompt.js +1 -1
- package/lib/serverlessLogs.js +9 -1
- package/lib/validation.js +3 -3
- package/package.json +2 -3
package/commands/accounts/use.js
CHANGED
|
@@ -4,7 +4,7 @@ const {
|
|
|
4
4
|
getConfigPath,
|
|
5
5
|
updateDefaultAccount,
|
|
6
6
|
getAccountId: getAccountIdFromConfig,
|
|
7
|
-
} = require('@hubspot/
|
|
7
|
+
} = require('@hubspot/local-dev-lib/config');
|
|
8
8
|
|
|
9
9
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
10
10
|
const { i18n } = require('../../lib/lang');
|
|
@@ -9,7 +9,7 @@ const { i18n } = require('../../lib/lang');
|
|
|
9
9
|
const {
|
|
10
10
|
FieldsJs,
|
|
11
11
|
isConvertableFieldJs,
|
|
12
|
-
} = require('@hubspot/local-dev-lib/cms/
|
|
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');
|
|
@@ -125,12 +125,33 @@ exports.handler = async options => {
|
|
|
125
125
|
|
|
126
126
|
// Upload all files if no build exists for this project yet
|
|
127
127
|
if (initialUpload || hasNoBuilds) {
|
|
128
|
-
await handleProjectUpload(
|
|
128
|
+
const result = await handleProjectUpload(
|
|
129
129
|
accountId,
|
|
130
130
|
projectConfig,
|
|
131
131
|
projectDir,
|
|
132
132
|
startWatching
|
|
133
133
|
);
|
|
134
|
+
|
|
135
|
+
if (result.uploadError) {
|
|
136
|
+
if (
|
|
137
|
+
isSpecifiedError(result.uploadError, {
|
|
138
|
+
subCategory: PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
|
139
|
+
})
|
|
140
|
+
) {
|
|
141
|
+
logger.log();
|
|
142
|
+
logger.error(i18n(`${i18nKey}.errors.projectLockedError`));
|
|
143
|
+
logger.log();
|
|
144
|
+
} else {
|
|
145
|
+
logApiErrorInstance(
|
|
146
|
+
result.uploadError,
|
|
147
|
+
new ApiErrorContext({
|
|
148
|
+
accountId,
|
|
149
|
+
projectName: projectConfig.name,
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
process.exit(EXIT_CODES.ERROR);
|
|
154
|
+
}
|
|
134
155
|
} else {
|
|
135
156
|
await startWatching();
|
|
136
157
|
}
|
|
@@ -14,7 +14,9 @@ const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
|
14
14
|
const { loadAndValidateOptions } = require('../../lib/validation');
|
|
15
15
|
const { previewPrompt } = require('../../lib/prompts/previewPrompt');
|
|
16
16
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
17
|
-
const {
|
|
17
|
+
const {
|
|
18
|
+
FILE_UPLOAD_RESULT_TYPES,
|
|
19
|
+
} = require('@hubspot/local-dev-lib/constants/files');
|
|
18
20
|
const i18nKey = 'cli.commands.preview';
|
|
19
21
|
const cliProgress = require('cli-progress');
|
|
20
22
|
const {
|
|
@@ -121,7 +123,7 @@ exports.handler = async options => {
|
|
|
121
123
|
});
|
|
122
124
|
initialUploadProgressBar.stop();
|
|
123
125
|
results.forEach(result => {
|
|
124
|
-
if (result.resultType ==
|
|
126
|
+
if (result.resultType == FILE_UPLOAD_RESULT_TYPES.FAILURE) {
|
|
125
127
|
logger.error('Uploading file "%s" to "%s" failed', result.file, dest);
|
|
126
128
|
logApiUploadErrorInstance(
|
|
127
129
|
result.error,
|
package/lang/en.lyaml
CHANGED
|
@@ -957,6 +957,7 @@ en:
|
|
|
957
957
|
srcOutsideProjectDir: "Invalid value for 'srcDir' in {{ projectConfig }}: {{#bold}}srcDir: \"{{ srcDir }}\"{{/bold}}\n\t'srcDir' must be a relative path to a folder under the project root, such as \".\" or \"./src\""
|
|
958
958
|
uploadProjectFiles:
|
|
959
959
|
add: "Uploading {{#bold}}{{ projectName }}{{/bold}} project files to {{ accountIdentifier }}"
|
|
960
|
+
fail: "Failed to upload {{#bold}}{{ projectName }}{{/bold}} project files to {{ accountIdentifier }}"
|
|
960
961
|
succeed: "Uploaded {{#bold}}{{ projectName }}{{/bold}} project files to {{ accountIdentifier }}"
|
|
961
962
|
buildCreated: "Project \"{{ projectName }}\" uploaded and build #{{ buildId }} created"
|
|
962
963
|
handleProjectUpload:
|
package/lib/commonOpts.js
CHANGED
|
@@ -2,9 +2,6 @@ const {
|
|
|
2
2
|
LOG_LEVEL,
|
|
3
3
|
setLogLevel: setLoggerLogLevel,
|
|
4
4
|
} = require('@hubspot/local-dev-lib/logger');
|
|
5
|
-
const {
|
|
6
|
-
setLogLevel: setCliLibLoggerLogLevel,
|
|
7
|
-
} = require('@hubspot/cli-lib/logger');
|
|
8
5
|
const {
|
|
9
6
|
DEFAULT_MODE,
|
|
10
7
|
MODE,
|
|
@@ -74,14 +71,8 @@ const setLogLevel = (options = {}) => {
|
|
|
74
71
|
const { debug } = options;
|
|
75
72
|
if (debug) {
|
|
76
73
|
setLoggerLogLevel(LOG_LEVEL.DEBUG);
|
|
77
|
-
|
|
78
|
-
// TODO remove this when we remove cli-lib as a dep
|
|
79
|
-
setCliLibLoggerLogLevel(LOG_LEVEL.DEBUG);
|
|
80
74
|
} else {
|
|
81
75
|
setLoggerLogLevel(LOG_LEVEL.LOG);
|
|
82
|
-
|
|
83
|
-
// TODO remove this when we remove cli-lib as a dep
|
|
84
|
-
setCliLibLoggerLogLevel(LOG_LEVEL.LOG);
|
|
85
76
|
}
|
|
86
77
|
};
|
|
87
78
|
|
|
@@ -7,9 +7,7 @@ const {
|
|
|
7
7
|
SCOPE_GROUPS,
|
|
8
8
|
PERSONAL_ACCESS_KEY_AUTH_METHOD,
|
|
9
9
|
} = require('@hubspot/local-dev-lib/constants/auth');
|
|
10
|
-
const {
|
|
11
|
-
fetchScopeData,
|
|
12
|
-
} = require('@hubspot/cli-lib/api/localDevAuth/authenticated');
|
|
10
|
+
const { fetchScopeData } = require('@hubspot/local-dev-lib/api/localDevAuth');
|
|
13
11
|
const {
|
|
14
12
|
debugErrorAndContext,
|
|
15
13
|
logErrorInstance,
|
package/lib/process.js
CHANGED
|
@@ -4,7 +4,6 @@ const {
|
|
|
4
4
|
setLogLevel,
|
|
5
5
|
LOG_LEVEL,
|
|
6
6
|
} = require('@hubspot/local-dev-lib/logger');
|
|
7
|
-
const { setLogLevel: setCliLibLogLevel } = require('@hubspot/cli-lib/logger');
|
|
8
7
|
const { i18n } = require('./lang');
|
|
9
8
|
|
|
10
9
|
const i18nKey = 'cli.lib.process';
|
|
@@ -33,10 +32,6 @@ const handleExit = callback => {
|
|
|
33
32
|
// Prevent logs when terminal closes
|
|
34
33
|
if (isSIGHUP) {
|
|
35
34
|
setLogLevel(LOG_LEVEL.NONE);
|
|
36
|
-
|
|
37
|
-
// Update the log level in cli-lib's instance of the logger
|
|
38
|
-
// We can remove this when we remove cli-lib as a dep
|
|
39
|
-
setCliLibLogLevel(LOG_LEVEL.NONE);
|
|
40
35
|
}
|
|
41
36
|
|
|
42
37
|
logger.debug(i18n(`${i18nKey}.exitDebug`, { signal }));
|
package/lib/projects.js
CHANGED
|
@@ -380,8 +380,12 @@ const uploadProjectFiles = async (
|
|
|
380
380
|
})
|
|
381
381
|
);
|
|
382
382
|
} catch (err) {
|
|
383
|
-
SpinniesManager.fail('upload'
|
|
384
|
-
|
|
383
|
+
SpinniesManager.fail('upload', {
|
|
384
|
+
text: i18n(`${i18nKey}.uploadProjectFiles.fail`, {
|
|
385
|
+
accountIdentifier,
|
|
386
|
+
projectName,
|
|
387
|
+
}),
|
|
388
|
+
});
|
|
385
389
|
|
|
386
390
|
error = err;
|
|
387
391
|
}
|
package/lib/projectsWatch.js
CHANGED
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
logApiErrorInstance,
|
|
7
7
|
ApiErrorContext,
|
|
8
8
|
} = require('./errorHandlers/apiErrors');
|
|
9
|
-
const { i18n } = require('
|
|
9
|
+
const { i18n } = require('./lang');
|
|
10
10
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
11
11
|
const { isAllowedExtension } = require('@hubspot/local-dev-lib/path');
|
|
12
12
|
const { shouldIgnoreFile } = require('@hubspot/local-dev-lib/ignoreRules');
|
|
@@ -2,7 +2,7 @@ const path = require('path');
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const { promptUser } = require('./promptUtils');
|
|
4
4
|
const { i18n } = require('../lang');
|
|
5
|
-
const escapeRegExp = require('@hubspot/
|
|
5
|
+
const escapeRegExp = require('@hubspot/local-dev-lib/escapeRegExp');
|
|
6
6
|
const i18nKey = 'cli.lib.prompts.uploadPrompt';
|
|
7
7
|
const FIELDS_FILES = ['fields.json', 'fields.js', 'fields.cjs', 'fields.mjs'];
|
|
8
8
|
|
package/lib/serverlessLogs.js
CHANGED
|
@@ -9,12 +9,20 @@ const {
|
|
|
9
9
|
logApiErrorInstance,
|
|
10
10
|
ApiErrorContext,
|
|
11
11
|
} = require('./errorHandlers/apiErrors');
|
|
12
|
-
const { base64EncodeString } = require('@hubspot/cli-lib/lib/encoding');
|
|
13
12
|
|
|
14
13
|
const { EXIT_CODES } = require('../lib/enums/exitCodes');
|
|
15
14
|
|
|
16
15
|
const TAIL_DELAY = 5000;
|
|
17
16
|
|
|
17
|
+
const base64EncodeString = valueToEncode => {
|
|
18
|
+
if (typeof valueToEncode !== 'string') {
|
|
19
|
+
return valueToEncode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const stringBuffer = Buffer.from(valueToEncode);
|
|
23
|
+
return encodeURIComponent(stringBuffer.toString('base64'));
|
|
24
|
+
};
|
|
25
|
+
|
|
18
26
|
const handleUserInput = () => {
|
|
19
27
|
const onTerminate = async () => {
|
|
20
28
|
SpinniesManager.remove('tailLogs');
|
package/lib/validation.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
4
|
-
const {
|
|
4
|
+
const { MODE } = require('@hubspot/local-dev-lib/constants/files');
|
|
5
5
|
const {
|
|
6
6
|
API_KEY_AUTH_METHOD,
|
|
7
7
|
OAUTH_AUTH_METHOD,
|
|
@@ -175,10 +175,10 @@ async function validateAccount(options) {
|
|
|
175
175
|
*/
|
|
176
176
|
function validateMode(options) {
|
|
177
177
|
const mode = getMode(options);
|
|
178
|
-
if (
|
|
178
|
+
if (MODE[mode]) {
|
|
179
179
|
return true;
|
|
180
180
|
}
|
|
181
|
-
const modesMessage = `Available modes are: ${Object.values(
|
|
181
|
+
const modesMessage = `Available modes are: ${Object.values(MODE).join(
|
|
182
182
|
', '
|
|
183
183
|
)}.`;
|
|
184
184
|
if (mode != null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "CLI for working with HubSpot",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"url": "https://github.com/HubSpot/hubspot-cms-tools"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@hubspot/cli-lib": "^9.0.0",
|
|
12
11
|
"@hubspot/local-dev-lib": "^0.3.10",
|
|
13
12
|
"@hubspot/serverless-dev-runtime": "5.1.4-beta.6",
|
|
14
13
|
"@hubspot/theme-preview-dev-server": "0.0.4",
|
|
@@ -46,5 +45,5 @@
|
|
|
46
45
|
"publishConfig": {
|
|
47
46
|
"access": "public"
|
|
48
47
|
},
|
|
49
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "b617fec2c05af70815192d7a41127d90f5c6b6d2"
|
|
50
49
|
}
|