(configPath: string)
| 195 | } |
| 196 | |
| 197 | export function loadConfig(configPath: string): CopyConfig { |
| 198 | const ext = path.extname(configPath).toLowerCase(); |
| 199 | const rawConfig = fs.readFileSync(configPath, 'utf8'); |
| 200 | |
| 201 | if (ext === '.json') { |
| 202 | return JSON.parse(rawConfig) as CopyConfig; |
| 203 | } else { |
| 204 | throw new Error(`Unsupported config file format: ${ext}`); |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | function precompilePatterns(patterns?: string[]): RegExp[] { |
| 209 | return patterns?.map(pattern => new RegExp(pattern)) ?? []; |
nothing calls this directly
no test coverage detected