* removing global flags before passing as command specific sub-configs
( options: Options, )
| 102 | * removing global flags before passing as command specific sub-configs |
| 103 | */ |
| 104 | function cleanGlobalCLIOptions<Options extends GlobalCLIOptions>( |
| 105 | options: Options, |
| 106 | ): Omit<Options, keyof GlobalCLIOptions> { |
| 107 | const ret = { ...options } |
| 108 | delete ret['--'] |
| 109 | delete ret.c |
| 110 | delete ret.config |
| 111 | delete ret.base |
| 112 | delete ret.l |
| 113 | delete ret.logLevel |
| 114 | delete ret.clearScreen |
| 115 | delete ret.configLoader |
| 116 | delete ret.d |
| 117 | delete ret.debug |
| 118 | delete ret.f |
| 119 | delete ret.filter |
| 120 | delete ret.m |
| 121 | delete ret.mode |
| 122 | delete ret.force |
| 123 | delete ret.w |
| 124 | |
| 125 | // convert the sourcemap option to a boolean if necessary |
| 126 | if ('sourcemap' in ret) { |
| 127 | const sourcemap = ret.sourcemap as `${boolean}` | 'inline' | 'hidden' |
| 128 | ret.sourcemap = |
| 129 | sourcemap === 'true' |
| 130 | ? true |
| 131 | : sourcemap === 'false' |
| 132 | ? false |
| 133 | : ret.sourcemap |
| 134 | } |
| 135 | if ('watch' in ret) { |
| 136 | const watch = ret.watch |
| 137 | ret.watch = watch ? {} : undefined |
| 138 | } |
| 139 | |
| 140 | return ret |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * removing builder flags before passing as command specific sub-configs |