@hubspot/cli 4.1.1 → 4.1.3-beta.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/customObject.js +18 -9
- package/commands/theme/marketplace-validate.js +35 -0
- package/lib/ui.js +10 -1
- package/package.json +4 -4
package/commands/customObject.js
CHANGED
|
@@ -1,30 +1,39 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
1
2
|
const { addConfigOptions, addAccountOptions } = require('../lib/commonOpts');
|
|
2
3
|
const schemaCommand = require('./customObject/schema');
|
|
3
4
|
const createCommand = require('./customObject/create');
|
|
4
5
|
const { i18n } = require('@hubspot/cli-lib/lib/lang');
|
|
6
|
+
const { logger } = require('@hubspot/cli-lib/logger');
|
|
7
|
+
const { uiBetaWarning } = require('../lib/ui');
|
|
5
8
|
|
|
6
9
|
const i18nKey = 'cli.commands.customObject';
|
|
7
10
|
|
|
8
11
|
exports.command = ['custom-object', 'custom', 'co'];
|
|
9
12
|
exports.describe = i18n(`${i18nKey}.describe`);
|
|
10
13
|
|
|
14
|
+
const logBetaMessage = () => {
|
|
15
|
+
uiBetaWarning(() => {
|
|
16
|
+
logger.log(chalk.reset.yellow(i18n(`${i18nKey}.betaMessage`)));
|
|
17
|
+
logger.log(
|
|
18
|
+
chalk.reset.yellow(
|
|
19
|
+
i18n(`${i18nKey}.seeMoreLink`, {
|
|
20
|
+
link:
|
|
21
|
+
'https://developers.hubspot.com/docs/api/crm/crm-custom-objects',
|
|
22
|
+
})
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
11
28
|
exports.builder = yargs => {
|
|
12
29
|
addConfigOptions(yargs, true);
|
|
13
30
|
addAccountOptions(yargs, true);
|
|
14
31
|
|
|
15
32
|
yargs
|
|
33
|
+
.middleware([logBetaMessage])
|
|
16
34
|
.command(schemaCommand)
|
|
17
35
|
.command(createCommand)
|
|
18
36
|
.demandCommand(1, '');
|
|
19
37
|
|
|
20
|
-
console.warn(i18n(`${i18nKey}.warning`));
|
|
21
|
-
console.warn(i18n(`${i18nKey}.betaMessage`));
|
|
22
|
-
console.warn(
|
|
23
|
-
i18n(`${i18nKey}.seeMoreLink`, {
|
|
24
|
-
link: 'https://developers.hubspot.com/docs/api/crm/crm-custom-objects',
|
|
25
|
-
})
|
|
26
|
-
);
|
|
27
|
-
console.warn(i18n(`${i18nKey}.warning`));
|
|
28
|
-
|
|
29
38
|
return yargs;
|
|
30
39
|
};
|
|
@@ -100,6 +100,24 @@ exports.handler = async options => {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
const displayResults = checks => {
|
|
103
|
+
const displayFileInfo = (file, line) => {
|
|
104
|
+
if (file) {
|
|
105
|
+
logger.log(
|
|
106
|
+
i18n(`${i18nKey}.results.warnings.file`, {
|
|
107
|
+
file,
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
if (line) {
|
|
112
|
+
logger.log(
|
|
113
|
+
i18n(`${i18nKey}.results.warnings.lineNumber`, {
|
|
114
|
+
line,
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
};
|
|
120
|
+
|
|
103
121
|
if (checks) {
|
|
104
122
|
const { status, results } = checks;
|
|
105
123
|
|
|
@@ -107,13 +125,30 @@ exports.handler = async options => {
|
|
|
107
125
|
const failedValidations = results.filter(
|
|
108
126
|
test => test.status === 'FAIL'
|
|
109
127
|
);
|
|
128
|
+
const warningValidations = results.filter(
|
|
129
|
+
test => test.status === 'WARN'
|
|
130
|
+
);
|
|
131
|
+
|
|
110
132
|
failedValidations.forEach(val => {
|
|
111
133
|
logger.error(`${val.message}`);
|
|
134
|
+
displayFileInfo(val.file, val.line);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
warningValidations.forEach(val => {
|
|
138
|
+
logger.warn(`${val.message}`);
|
|
139
|
+
displayFileInfo(val.file, val.line);
|
|
112
140
|
});
|
|
113
141
|
}
|
|
114
142
|
|
|
115
143
|
if (status === 'PASS') {
|
|
116
144
|
logger.success(i18n(`${i18nKey}.results.noErrors`));
|
|
145
|
+
|
|
146
|
+
results.forEach(test => {
|
|
147
|
+
if (test.status === 'WARN') {
|
|
148
|
+
logger.warn(`${test.message}`);
|
|
149
|
+
displayFileInfo(test.file, test.line);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
117
152
|
}
|
|
118
153
|
}
|
|
119
154
|
return null;
|
package/lib/ui.js
CHANGED
|
@@ -49,7 +49,7 @@ const uiLink = (linkText, url) => {
|
|
|
49
49
|
return terminalUISupport.color ? chalk.cyan(result) : result;
|
|
50
50
|
} else {
|
|
51
51
|
return terminalUISupport.color
|
|
52
|
-
? `${linkText}: ${chalk.cyan(encodedUrl)}`
|
|
52
|
+
? `${linkText}: ${chalk.reset.cyan(encodedUrl)}`
|
|
53
53
|
: `${linkText}: ${encodedUrl}`;
|
|
54
54
|
}
|
|
55
55
|
};
|
|
@@ -93,8 +93,17 @@ const uiFeatureHighlight = (commands, title) => {
|
|
|
93
93
|
});
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
+
const uiBetaWarning = logMessage => {
|
|
97
|
+
const i18nKey = 'cli.lib.ui.betaWarning';
|
|
98
|
+
|
|
99
|
+
logger.log(i18n(`${i18nKey}.header`));
|
|
100
|
+
logMessage();
|
|
101
|
+
logger.log(i18n(`${i18nKey}.footer`));
|
|
102
|
+
};
|
|
103
|
+
|
|
96
104
|
module.exports = {
|
|
97
105
|
uiAccountDescription,
|
|
106
|
+
uiBetaWarning,
|
|
98
107
|
uiFeatureHighlight,
|
|
99
108
|
uiInfoSection,
|
|
100
109
|
uiLine,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3-beta.0",
|
|
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.
|
|
12
|
-
"@hubspot/serverless-dev-runtime": "4.1.
|
|
11
|
+
"@hubspot/cli-lib": "4.1.3-beta.0",
|
|
12
|
+
"@hubspot/serverless-dev-runtime": "4.1.3-beta.0",
|
|
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": "1fa007888ab796fb8a6905e7a3112a1d1144085d"
|
|
41
41
|
}
|