| 38 | export const writeFile: BrowserCommand< |
| 39 | Parameters<BrowserCommands['writeFile']> |
| 40 | > = async ({ project }, path, data, options) => { |
| 41 | assertWrite(path, project) |
| 42 | const filepath = resolve(project.config.root, path) |
| 43 | assertFileAccess(slash(filepath), project) |
| 44 | const dir = dirname(filepath) |
| 45 | if (!fs.existsSync(dir)) { |
| 46 | await fsp.mkdir(dir, { recursive: true }) |
| 47 | } |
| 48 | await fsp.writeFile(filepath, data, options) |
| 49 | } |
| 50 | |
| 51 | export const removeFile: BrowserCommand< |
| 52 | Parameters<BrowserCommands['removeFile']> |