better cli arg supper

This commit is contained in:
2022-06-09 11:33:13 -05:00
parent e8de01b48a
commit ba1ca2fc83
7 changed files with 107 additions and 88 deletions

View File

@@ -6,11 +6,17 @@ import { readmeData, updateReadmeFile } from './readmefile'
import runBuild from './build'
import { UserScriptMetaFull } from './types'
export interface CLIArgs {
watch: boolean
minify: boolean
prettier: boolean
}
const CLIArgs = commandLineArgs([
{ name: 'watch', alias: 'w', type: Boolean },
]) as {
watch: boolean
}
{ name: 'minify', alias: 'm', type: Boolean },
{ name: 'prettier', alias: 'p', type: Boolean },
]) as CLIArgs
//if package.json doesn't exist then there is no point in continuing
if (!existsSync('package.json') || !lstatSync('package.json').isFile()) {
@@ -50,8 +56,9 @@ for (let name of scripts) {
let [meta, error] = runBuild(
name,
CLIArgs.watch ? postWatchUpdate : false,
PrettierConfig
postWatchUpdate,
PrettierConfig,
CLIArgs
)
scriptMeta[id] = { meta, error }