@hubspot/cli 4.1.3-beta.1 → 4.1.3-beta.3
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/bin/cli.js +3 -3
- package/commands/cms/convertFields.js +4 -4
- package/commands/upload.js +12 -16
- package/lib/usageTracking.js +2 -2
- package/package.json +4 -4
package/bin/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ const { logErrorInstance } = require('@hubspot/cli-lib/errorHandlers');
|
|
|
9
9
|
const { setLogLevel, getCommandName } = require('../lib/commonOpts');
|
|
10
10
|
const {
|
|
11
11
|
trackHelpUsage,
|
|
12
|
-
|
|
12
|
+
trackConvertFieldsUsage,
|
|
13
13
|
} = require('../lib/usageTracking');
|
|
14
14
|
const { getIsInProject } = require('../lib/projects');
|
|
15
15
|
const pkg = require('../package.json');
|
|
@@ -170,6 +170,6 @@ if (argv.help) {
|
|
|
170
170
|
trackHelpUsage(getCommandName(argv));
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
if (argv.
|
|
174
|
-
|
|
173
|
+
if (argv.convertFields) {
|
|
174
|
+
trackConvertFieldsUsage(getCommandName(argv));
|
|
175
175
|
}
|
|
@@ -8,10 +8,10 @@ const { getThemeJSONPath } = require('@hubspot/cli-lib/lib/files');
|
|
|
8
8
|
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
9
9
|
const {
|
|
10
10
|
FieldsJs,
|
|
11
|
-
|
|
11
|
+
isConvertableFieldJs,
|
|
12
12
|
} = require('@hubspot/cli-lib/lib/handleFieldsJs');
|
|
13
13
|
|
|
14
|
-
const {
|
|
14
|
+
const { trackConvertFieldsUsage } = require('../../lib/usageTracking');
|
|
15
15
|
const i18nKey = 'cli.commands.convertFields';
|
|
16
16
|
|
|
17
17
|
exports.command = 'convert-fields';
|
|
@@ -39,7 +39,7 @@ exports.handler = async options => {
|
|
|
39
39
|
invalidPath(src);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
trackConvertFieldsUsage('process');
|
|
43
43
|
|
|
44
44
|
if (stats.isFile()) {
|
|
45
45
|
const fieldsJs = await new FieldsJs(
|
|
@@ -61,7 +61,7 @@ exports.handler = async options => {
|
|
|
61
61
|
})
|
|
62
62
|
.filter(createIgnoreFilter());
|
|
63
63
|
for (const filePath of allowedFilePaths) {
|
|
64
|
-
if (
|
|
64
|
+
if (isConvertableFieldJs(projectRoot, filePath, true)) {
|
|
65
65
|
const fieldsJs = await new FieldsJs(
|
|
66
66
|
projectRoot,
|
|
67
67
|
filePath,
|
package/commands/upload.js
CHANGED
|
@@ -40,7 +40,7 @@ const i18nKey = 'cli.commands.upload';
|
|
|
40
40
|
const { EXIT_CODES } = require('../lib/enums/exitCodes');
|
|
41
41
|
const {
|
|
42
42
|
FieldsJs,
|
|
43
|
-
|
|
43
|
+
isConvertableFieldJs,
|
|
44
44
|
cleanupTmpDirSync,
|
|
45
45
|
} = require('@hubspot/cli-lib/lib/handleFieldsJs');
|
|
46
46
|
|
|
@@ -81,15 +81,11 @@ exports.handler = async options => {
|
|
|
81
81
|
// Check for theme.json file and determine the root path for the project based on it if it exists
|
|
82
82
|
const themeJsonPath = getThemeJSONPath(absoluteSrcPath);
|
|
83
83
|
const projectRoot = themeJsonPath && path.dirname(themeJsonPath);
|
|
84
|
-
const
|
|
84
|
+
const convertFields =
|
|
85
85
|
projectRoot &&
|
|
86
|
-
|
|
87
|
-
projectRoot,
|
|
88
|
-
absoluteSrcPath,
|
|
89
|
-
options.processFieldsJs
|
|
90
|
-
);
|
|
86
|
+
isConvertableFieldJs(projectRoot, absoluteSrcPath, options.convertFields);
|
|
91
87
|
let fieldsJs;
|
|
92
|
-
if (
|
|
88
|
+
if (convertFields) {
|
|
93
89
|
fieldsJs = await new FieldsJs(
|
|
94
90
|
projectRoot,
|
|
95
91
|
absoluteSrcPath,
|
|
@@ -137,7 +133,7 @@ exports.handler = async options => {
|
|
|
137
133
|
process.exit(EXIT_CODES.WARNING);
|
|
138
134
|
}
|
|
139
135
|
if (stats.isFile()) {
|
|
140
|
-
if (!isAllowedExtension(src) && !
|
|
136
|
+
if (!isAllowedExtension(src) && !convertFields) {
|
|
141
137
|
logger.error(
|
|
142
138
|
i18n(`${i18nKey}.errors.invalidPath`, {
|
|
143
139
|
path: src,
|
|
@@ -188,7 +184,7 @@ exports.handler = async options => {
|
|
|
188
184
|
process.exit(EXIT_CODES.WARNING);
|
|
189
185
|
})
|
|
190
186
|
.finally(() => {
|
|
191
|
-
if (!
|
|
187
|
+
if (!convertFields) return;
|
|
192
188
|
if (saveOutput) {
|
|
193
189
|
fieldsJs.saveOutput();
|
|
194
190
|
}
|
|
@@ -206,7 +202,7 @@ exports.handler = async options => {
|
|
|
206
202
|
// Generate the first-pass file list in here, and pass to uploadFolder.
|
|
207
203
|
const filePaths = await getUploadableFileList(
|
|
208
204
|
absoluteSrcPath,
|
|
209
|
-
options.
|
|
205
|
+
options.convertFields
|
|
210
206
|
);
|
|
211
207
|
uploadFolder(
|
|
212
208
|
accountId,
|
|
@@ -252,9 +248,9 @@ exports.handler = async options => {
|
|
|
252
248
|
|
|
253
249
|
/*
|
|
254
250
|
* Walks the src folder for files, filters them based on ignore filter.
|
|
255
|
-
* If
|
|
251
|
+
* If convertFields is true then will check for any JS fields conflicts (i.e., JS fields file and fields.json file) and prompt to resolve
|
|
256
252
|
*/
|
|
257
|
-
const getUploadableFileList = async (src,
|
|
253
|
+
const getUploadableFileList = async (src, convertFields) => {
|
|
258
254
|
const filePaths = await walk(src);
|
|
259
255
|
const allowedFiles = filePaths
|
|
260
256
|
.filter(file => {
|
|
@@ -264,7 +260,7 @@ const getUploadableFileList = async (src, processFieldsJs) => {
|
|
|
264
260
|
return true;
|
|
265
261
|
})
|
|
266
262
|
.filter(createIgnoreFilter());
|
|
267
|
-
if (!
|
|
263
|
+
if (!convertFields) {
|
|
268
264
|
return allowedFiles;
|
|
269
265
|
}
|
|
270
266
|
|
|
@@ -273,8 +269,8 @@ const getUploadableFileList = async (src, processFieldsJs) => {
|
|
|
273
269
|
for (const filePath of allowedFiles) {
|
|
274
270
|
const fileName = path.basename(filePath);
|
|
275
271
|
if (skipFiles.includes(filePath)) continue;
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
272
|
+
const isConvertable = isConvertableFieldJs(src, filePath, convertFields);
|
|
273
|
+
if (isConvertable || fileName == 'fields.json') {
|
|
278
274
|
// This prompt checks if there are multiple field files in the folder and gets user to choose.
|
|
279
275
|
const [choice, updatedSkipFiles] = await fieldsJsPrompt(
|
|
280
276
|
filePath,
|
package/lib/usageTracking.js
CHANGED
|
@@ -78,7 +78,7 @@ async function trackHelpUsage(command) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
async function
|
|
81
|
+
async function trackConvertFieldsUsage(command) {
|
|
82
82
|
if (!isTrackingAllowed()) {
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
@@ -136,6 +136,6 @@ module.exports = {
|
|
|
136
136
|
trackCommandUsage,
|
|
137
137
|
trackHelpUsage,
|
|
138
138
|
addHelpUsageTracking,
|
|
139
|
-
|
|
139
|
+
trackConvertFieldsUsage,
|
|
140
140
|
trackAuthAction,
|
|
141
141
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "4.1.3-beta.
|
|
3
|
+
"version": "4.1.3-beta.3",
|
|
4
4
|
"description": "CLI for working with HubSpot",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"url": "https://github.com/HubSpot/hubspot-cms-tools"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@hubspot/cli-lib": "4.1.3-beta.
|
|
12
|
-
"@hubspot/serverless-dev-runtime": "4.1.3-beta.
|
|
11
|
+
"@hubspot/cli-lib": "4.1.3-beta.3",
|
|
12
|
+
"@hubspot/serverless-dev-runtime": "4.1.3-beta.3",
|
|
13
13
|
"archiver": "^5.3.0",
|
|
14
14
|
"chalk": "^4.1.2",
|
|
15
15
|
"express": "^4.17.1",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "ee16ed8dc9f1716fb16ad04aa4473d68766e67d3"
|
|
41
41
|
}
|