Skip to content

Commit 1a72e33

Browse files
committedFeb 7, 2025
show error if param is unknown
1 parent 72ef201 commit 1a72e33

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed
 

‎build.js

+8
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ function buildGeneral(options = {}) {
135135
return;
136136
}
137137

138+
if (helpers.hasAnyProcessParam()) {
139+
console.log("Unknown parameter.");
140+
141+
process.exit(1);
142+
143+
return;
144+
}
145+
138146
const flags = [
139147
['all', 'build all'],
140148
['extension', 'build extension package'],

‎helpers.js

+21-1
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,17 @@ Export.getProcessParam = name => {
207207
return value;
208208
}
209209

210+
/**
211+
* @param {string} string
212+
* @return {string}
213+
*/
210214
Export.camelCaseToHyphen = (string => string.replace( /([a-z])([A-Z])/g, '$1-$2' ).toLowerCase());
211215

216+
/**
217+
* @return {boolean}
218+
*/
212219
Export.hasProcessParam = param => {
213-
for (let i in process.argv) {
220+
for (const i in process.argv) {
214221
if (process.argv[i] === '--' + param) {
215222
return true;
216223
}
@@ -219,4 +226,17 @@ Export.hasProcessParam = param => {
219226
return false;
220227
}
221228

229+
/**
230+
* @return {boolean}
231+
*/
232+
Export.hasAnyProcessParam = () => {
233+
for (const i in process.argv) {
234+
if (process.argv[i].startsWith('--')) {
235+
return true;
236+
}
237+
}
238+
239+
return false;
240+
}
241+
222242
export default Export;

0 commit comments

Comments
 (0)
Please sign in to comment.