Skip to content

Commit 3d140b8

Browse files
committed
Adressed PR comments.
1 parent f1012a1 commit 3d140b8

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
type: Feature
2+
type: Other
33
---
44

55
Added logging CDN fetch errors to console when an exception is thrown.

.changelog/20250310142248_i_3923_update_node.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

scripts/utils/parsearguments.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,11 @@ export default function parseArguments( cliArguments ) {
3838

3939
const options = minimist( cliArguments, config );
4040

41-
options.compileOnly = options[ 'compile-only' ];
42-
delete options[ 'compile-only' ];
43-
44-
options.npmTag = options[ 'npm-tag' ];
45-
delete options[ 'npm-tag' ];
46-
47-
options.dryRun = options[ 'dry-run' ];
48-
delete options[ 'dry-run' ];
41+
replaceKebabCaseWithCamelCase( options, [
42+
'npm-tag',
43+
'compile-only',
44+
'dry-run'
45+
] );
4946

5047
if ( process.env.CI ) {
5148
options.ci = true;
@@ -54,6 +51,27 @@ export default function parseArguments( cliArguments ) {
5451
return options;
5552
}
5653

54+
function replaceKebabCaseWithCamelCase( options, keys ) {
55+
for ( const key of keys ) {
56+
const camelCaseKey = toCamelCase( key );
57+
58+
options[ camelCaseKey ] = options[ key ];
59+
delete options[ key ];
60+
}
61+
}
62+
63+
function toCamelCase( value ) {
64+
return value.split( '-' )
65+
.map( ( item, index ) => {
66+
if ( index == 0 ) {
67+
return item.toLowerCase();
68+
}
69+
70+
return item.charAt( 0 ).toUpperCase() + item.slice( 1 ).toLowerCase();
71+
} )
72+
.join( '' );
73+
}
74+
5775
/**
5876
* @typedef {Object} ReleaseOptions
5977
*

0 commit comments

Comments
 (0)