1-
21import { strToU8 , zip } from 'fflate' ;
32import { existsSync , mkdirSync , readFileSync , statSync , writeFileSync } from 'node:fs' ;
3+ import { parseArgs } from 'node:util' ;
44import normalizePath from 'normalize-path' ;
55import { globSync } from 'tinyglobby' ;
6- import { hideBin } from 'yargs/helpers' ;
7- import yargs from 'yargs' ;
86
97const inputFolder1 = './dist/bundle' ;
108const inputFolder2 = '../common/dist/styles' ;
11- const argv = yargs ( hideBin ( process . argv ) ) . argv ;
12- const outputFilename = argv . outputFilename || 'bundle' ;
13- const outputFolder = argv . outputFolder || './dist/' ;
9+
10+ const { values : args } = parseArgs ( {
11+ options : {
12+ outputFilename : { type : 'string' } ,
13+ outputFolder : { type : 'string' } ,
14+ 'output-filename' : { type : 'string' } ,
15+ 'output-folder' : { type : 'string' } ,
16+ } ,
17+ allowPositionals : true ,
18+ } ) ;
19+
20+ // Prefer kebab-case if provided, otherwise camelCase, otherwise default
21+ const outputFilename = args [ 'output-filename' ] || args . outputFilename || 'bundle' ;
22+ const outputFolder = args [ 'output-folder' ] || args . outputFolder || './dist/' ;
1423
1524if ( ! existsSync ( outputFolder ) ) {
1625 mkdirSync ( outputFolder ) ;
@@ -25,7 +34,7 @@ const files = [
2534
2635// get all files from `common/dist/styles`
2736const styleFiles = globSync ( '../common/dist/styles/**/*.*' ) ;
28- styleFiles . forEach ( file => {
37+ styleFiles . forEach ( ( file ) => {
2938 const [ styleName ] = file . match ( / ( s t y l e s .* ) / gi) || [ ] ;
3039 files . push ( { name : normalizePath ( styleName ) , path : normalizePath ( file ) } ) ;
3140} ) ;
0 commit comments