macos-defaults/build/vuepress/write-homepage.js
Yann Bertrand a6a996ddd2 🚨 Run Prettier
2020-11-27 14:39:16 +01:00

17 lines
493 B
JavaScript

const fs = require('fs')
const Handlebars = require('handlebars')
Handlebars.registerHelper('lowerCase', (string) => {
return string.toLowerCase()
})
module.exports = (defaults, templatesPath, destinationPath) => {
fs.mkdirSync(destinationPath)
const homeTemplate = fs.readFileSync(
`${templatesPath}/home.md.handlebars`,
'utf8'
)
const rootReadmeContent = Handlebars.compile(homeTemplate)(defaults)
fs.writeFileSync(`${destinationPath}/readme.md`, rootReadmeContent)
}