MCPcopy Create free account
hub / github.com/codegowhere/react-inject-env / generateFromTo

Function generateFromTo

src/utils/File.ts:7–19  ·  view source on GitHub ↗
(envCfg: Record<string, string>)

Source from the content-addressed store, hash-verified

5import { writeFileSync } from 'fs'
6
7function generateFromTo(envCfg: Record<string, string>): {
8 from: string[] | RegExp[]
9 to: string[]
10} {
11 const from = Object.keys(envCfg)
12 .map((key) => `${Cfg.PLACEHOLDER_2}${key}`)
13 .map((key) => new RegExp(`\\b${key}\\b`, 'g'))
14 const to = Object.values(envCfg)
15 return {
16 from: from,
17 to: to
18 }
19}
20
21export function copyFolder(dir: string, copyDir: string): string {
22 shell.cp('-R', dir, copyDir)

Callers 1

replaceFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected