(path, content, flag = 'w', verbose)
| 20 | } |
| 21 | |
| 22 | function writeFile(path, content, flag = 'w', verbose) { |
| 23 | try { |
| 24 | const parentDir = dirname(path); |
| 25 | if (parentDir) { |
| 26 | fs.mkdirSync(parentDir, { recursive: true }); |
| 27 | } |
| 28 | fs.writeFileSync(path, content, { flag }); |
| 29 | if (verbose) { |
| 30 | console.log(chalk.green(`Added "${path}" successfully`)); |
| 31 | } |
| 32 | } catch (err) { |
| 33 | console.log(chalk.red(`Cannot write file ${path}`)); |
| 34 | if (verbose) { |
| 35 | console.log(chalk.red(err)); |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | function appendFile(src, dest, verbose) { |
| 41 | const content = fs.readFileSync(src, 'utf8'); |
no outgoing calls
no test coverage detected