2020-09-13 19:28:38 +00:00
|
|
|
const fs = require('fs')
|
|
|
|
const Handlebars = require('handlebars')
|
|
|
|
|
2020-10-03 13:41:02 +00:00
|
|
|
Handlebars.registerHelper('lowerCase', (string) => {
|
|
|
|
return string.toLowerCase()
|
|
|
|
})
|
|
|
|
|
2020-09-13 19:28:38 +00:00
|
|
|
module.exports = (defaults, templatesPath, destinationPath) => {
|
|
|
|
fs.mkdirSync(destinationPath)
|
|
|
|
|
2020-11-27 12:45:16 +00:00
|
|
|
const homeTemplate = fs.readFileSync(
|
|
|
|
`${templatesPath}/home.md.handlebars`,
|
|
|
|
'utf8'
|
|
|
|
)
|
2020-09-13 19:28:38 +00:00
|
|
|
const rootReadmeContent = Handlebars.compile(homeTemplate)(defaults)
|
|
|
|
fs.writeFileSync(`${destinationPath}/readme.md`, rootReadmeContent)
|
|
|
|
}
|