(filePath: string, data: string)
| 88 | |
| 89 | |
| 90 | export const writeFile = async (filePath: string, data: string) => { |
| 91 | try { |
| 92 | const dirname = path.dirname(filePath); |
| 93 | const exist = await isPathExists(dirname); |
| 94 | if (!exist) { |
| 95 | await fsp.mkdir(dirname, { recursive: true }); |
| 96 | } |
| 97 | |
| 98 | await fsp.writeFile(filePath, data, 'utf8'); |
| 99 | } catch (err) { |
| 100 | throw new Error(err); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | export const rootResolve = (val: string) => path.resolve(process.cwd(), val); |
| 105 |
no test coverage detected