better cli arg supper
This commit is contained in:
17
src/main.ts
17
src/main.ts
@@ -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 }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user