bugfix for binary template files
This commit is contained in:
parent
3472a121ab
commit
a91ecd1b3a
5 changed files with 1461 additions and 2987 deletions
|
@ -11,6 +11,10 @@ const pEachSeries = require('p-each-series')
|
|||
|
||||
const pkg = require('../package')
|
||||
|
||||
const templateBlacklist = new Set([
|
||||
'example/public/favicon.ico'
|
||||
])
|
||||
|
||||
module.exports = async (info) => {
|
||||
const {
|
||||
manager,
|
||||
|
@ -75,14 +79,20 @@ module.exports.copyTemplateFile = async (opts) => {
|
|||
const destFilePath = path.join(dest, fileRelativePath)
|
||||
const destFileDir = path.parse(destFilePath).dir
|
||||
|
||||
const template = handlebars.compile(fs.readFileSync(file, 'utf8'))
|
||||
const content = template({
|
||||
...info,
|
||||
yarn: (info.manager === 'yarn')
|
||||
})
|
||||
|
||||
await mkdirp(destFileDir)
|
||||
fs.writeFileSync(destFilePath, content, 'utf8')
|
||||
|
||||
if (templateBlacklist.has(fileRelativePath)) {
|
||||
const content = fs.readFileSync(file)
|
||||
fs.writeFileSync(destFilePath, content)
|
||||
} else {
|
||||
const template = handlebars.compile(fs.readFileSync(file, 'utf8'))
|
||||
const content = template({
|
||||
...info,
|
||||
yarn: (info.manager === 'yarn')
|
||||
})
|
||||
|
||||
fs.writeFileSync(destFilePath, content, 'utf8')
|
||||
}
|
||||
|
||||
return fileRelativePath
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue