(dirPath: string, envConfig: Record<string, string>)
| 24 | } |
| 25 | |
| 26 | export function replaceFile(dirPath: string, envConfig: Record<string, string>) { |
| 27 | const { from, to } = generateFromTo(envConfig) |
| 28 | const results = replace.sync({ |
| 29 | files: `${dirPath}/**/*`, |
| 30 | from: from, |
| 31 | to: to, |
| 32 | countMatches: true |
| 33 | }) |
| 34 | results.forEach((it) => { |
| 35 | if (it.hasChanged) { |
| 36 | console.info(`Replaced ${it.numReplacements} variable(s) in '${it.file}'`) |
| 37 | } |
| 38 | }) |
| 39 | } |
| 40 | |
| 41 | export function replaceFilesInDir(dir: string) { |
| 42 | const envCfg = { ...retrieveDotEnvCfg(), ...retrieveReactEnvCfg() } |
no test coverage detected