| | import { copyFile } from 'fs/promises'; |
| | import type { ReplaceInFileConfig } from 'replace-in-file'; |
| | import { replaceInFile } from 'replace-in-file'; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | export async function createTemplate( |
| | sourceFilePath: string, |
| | destinationFilePath: string, |
| | replaceValues: object, |
| | ): Promise<void> { |
| | |
| |
|
| | await copyFile(sourceFilePath, destinationFilePath); |
| |
|
| | |
| | const options: ReplaceInFileConfig = { |
| | files: [destinationFilePath], |
| | from: [], |
| | to: [], |
| | }; |
| | options.from = Object.keys(replaceValues).map((key) => { |
| | return new RegExp(key, 'g'); |
| | }); |
| | options.to = Object.values(replaceValues); |
| | await replaceInFile(options); |
| | } |
| |
|