Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import fs from 'fs'; import path from 'path'; import { promisify } from 'util'; import mustache from 'mustache'; const writeFile = promisify(fs.writeFile); async function createReadme(options) { let template = `# {{name}} \n## Description \n{{description}} \n## Author \n{{author}} \n## License \n{{license}}`; const { name, description, author, license, targetDir } = options; const targetPath = path.join(targetDir, 'README.md'); const readmeContent = mustache.render(template, { name, description, author, license, }); return writeFile(targetPath, readmeContent, 'utf8'); } export default createReadme; |