@hubspot/cli 4.1.3-beta.0 → 4.1.3-beta.2
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
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');
|
|
@@ -38,7 +38,6 @@ const moduleCommand = require('../commands/module');
|
|
|
38
38
|
const configCommand = require('../commands/config');
|
|
39
39
|
const accountsCommand = require('../commands/accounts');
|
|
40
40
|
const sandboxesCommand = require('../commands/sandbox');
|
|
41
|
-
const processCommand = require('../commands/process');
|
|
42
41
|
const cmsCommand = require('../commands/cms');
|
|
43
42
|
const feedbackCommand = require('../commands/feedback');
|
|
44
43
|
const { EXIT_CODES } = require('../lib/enums/exitCodes');
|
|
@@ -159,7 +158,6 @@ const argv = yargs
|
|
|
159
158
|
.command(configCommand)
|
|
160
159
|
.command(accountsCommand)
|
|
161
160
|
.command(sandboxesCommand)
|
|
162
|
-
.command(processCommand, false)
|
|
163
161
|
.command(feedbackCommand)
|
|
164
162
|
.help()
|
|
165
163
|
.recommendCommands()
|
|
@@ -172,6 +170,6 @@ if (argv.help) {
|
|
|
172
170
|
trackHelpUsage(getCommandName(argv));
|
|
173
171
|
}
|
|
174
172
|
|
|
175
|
-
if (argv.
|
|
176
|
-
|
|
173
|
+
if (argv.convertFields) {
|
|
174
|
+
trackConvertFieldsUsage(getCommandName(argv));
|
|
177
175
|
}
|
|
@@ -8,14 +8,14 @@ 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 {
|
|
15
|
-
const i18nKey = 'cli.commands.
|
|
14
|
+
const { trackConvertFieldsUsage } = require('../../lib/usageTracking');
|
|
15
|
+
const i18nKey = 'cli.commands.convertFields';
|
|
16
16
|
|
|
17
|
-
exports.command = '
|
|
18
|
-
exports.describe =
|
|
17
|
+
exports.command = 'convert-fields';
|
|
18
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
19
19
|
|
|
20
20
|
const invalidPath = src => {
|
|
21
21
|
logger.error(
|
|
@@ -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,
|
|
@@ -38,7 +38,7 @@ const DEFAULT_TABLE_HEADER = [
|
|
|
38
38
|
];
|
|
39
39
|
|
|
40
40
|
exports.command = 'lighthouse-score [--theme]';
|
|
41
|
-
exports.describe = i18n(`${i18nKey}.describe`);
|
|
41
|
+
exports.describe = false; // i18n(`${i18nKey}.describe`);
|
|
42
42
|
|
|
43
43
|
const selectTheme = async accountId => {
|
|
44
44
|
const { theme: selectedTheme } = await promptUser([
|
package/commands/cms.js
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
1
2
|
const { addConfigOptions, addAccountOptions } = require('../lib/commonOpts');
|
|
2
3
|
const lighthouseScore = require('./cms/lighthouseScore');
|
|
4
|
+
const convertFields = require('./cms/convertFields');
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
const i18nKey = 'cli.commands.cms';
|
|
5
7
|
|
|
6
8
|
exports.command = 'cms';
|
|
7
|
-
exports.describe =
|
|
9
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
8
10
|
|
|
9
11
|
exports.builder = yargs => {
|
|
10
12
|
addConfigOptions(yargs, true);
|
|
11
13
|
addAccountOptions(yargs, true);
|
|
12
14
|
|
|
13
|
-
yargs
|
|
15
|
+
yargs
|
|
16
|
+
.command(lighthouseScore)
|
|
17
|
+
.command(convertFields)
|
|
18
|
+
.demandCommand(1, '');
|
|
14
19
|
|
|
15
20
|
return yargs;
|
|
16
21
|
};
|
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,
|
|
@@ -314,14 +310,11 @@ exports.builder = yargs => {
|
|
|
314
310
|
describe: i18n(`${i18nKey}.options.saveOutput.describe`),
|
|
315
311
|
type: 'boolean',
|
|
316
312
|
default: false,
|
|
317
|
-
hidden: true,
|
|
318
313
|
});
|
|
319
|
-
yargs.option('
|
|
320
|
-
describe: i18n(`${i18nKey}.options.
|
|
321
|
-
alias: ['processFields'],
|
|
314
|
+
yargs.option('convertFields', {
|
|
315
|
+
describe: i18n(`${i18nKey}.options.convertFields.describe`),
|
|
322
316
|
type: 'boolean',
|
|
323
317
|
default: false,
|
|
324
|
-
hidden: true,
|
|
325
318
|
});
|
|
326
319
|
return yargs;
|
|
327
320
|
};
|
package/commands/watch.js
CHANGED
|
@@ -128,18 +128,15 @@ exports.builder = yargs => {
|
|
|
128
128
|
type: 'string',
|
|
129
129
|
requiresArg: true,
|
|
130
130
|
});
|
|
131
|
-
yargs.option('
|
|
132
|
-
describe: i18n(`${i18nKey}.options.
|
|
133
|
-
alias: ['processFields'],
|
|
131
|
+
yargs.option('convertFields', {
|
|
132
|
+
describe: i18n(`${i18nKey}.options.convertFields.describe`),
|
|
134
133
|
type: 'boolean',
|
|
135
134
|
default: false,
|
|
136
|
-
hidden: true,
|
|
137
135
|
});
|
|
138
136
|
yargs.option('saveOutput', {
|
|
139
137
|
describe: i18n(`${i18nKey}.options.saveOutput.describe`),
|
|
140
138
|
type: 'boolean',
|
|
141
139
|
default: false,
|
|
142
|
-
hidden: true,
|
|
143
140
|
});
|
|
144
141
|
return yargs;
|
|
145
142
|
};
|
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.2",
|
|
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.2",
|
|
12
|
+
"@hubspot/serverless-dev-runtime": "4.1.3-beta.2",
|
|
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": "71a8c4be0481062c68f035e1682634ac646c505c"
|
|
41
41
|
}
|