( emptyOutDir: boolean | null, root: string, outDirs: Set<string>, logger?: Logger, )
| 24 | } |
| 25 | |
| 26 | export function resolveEmptyOutDir( |
| 27 | emptyOutDir: boolean | null, |
| 28 | root: string, |
| 29 | outDirs: Set<string>, |
| 30 | logger?: Logger, |
| 31 | ): boolean { |
| 32 | if (emptyOutDir != null) return emptyOutDir |
| 33 | |
| 34 | for (const outDir of outDirs) { |
| 35 | if (!normalizePath(outDir).startsWith(withTrailingSlash(root))) { |
| 36 | // warn if outDir is outside of root |
| 37 | logger?.warn( |
| 38 | colors.yellow( |
| 39 | `\n${colors.bold(`(!)`)} outDir ${colors.white( |
| 40 | colors.dim(outDir), |
| 41 | )} is not inside project root and will not be emptied.\n` + |
| 42 | `Use --emptyOutDir to override.\n`, |
| 43 | ), |
| 44 | ) |
| 45 | return false |
| 46 | } |
| 47 | } |
| 48 | return true |
| 49 | } |
| 50 | |
| 51 | export function resolveChokidarOptions( |
| 52 | options: WatchOptions | undefined, |
no test coverage detected