Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Commit

Permalink
bugfix for binary template files
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Mar 3, 2019
1 parent 795e737 commit 3375f38
Show file tree
Hide file tree
Showing 5 changed files with 1,456 additions and 2,982 deletions.
3 changes: 1 addition & 2 deletions index.js
@@ -1,5 +1,4 @@
#!/usr/bin/env node
'use strict'

const compatRequire = require('node-compat-require')
compatRequire('./lib', { node: '>= 8' })
require('./lib/cli')
0 lib/index.js → lib/cli.js 100644 → 100755
File renamed without changes.
24 changes: 17 additions & 7 deletions lib/create-library.js
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
Expand Down
27 changes: 13 additions & 14 deletions package.json
Expand Up @@ -30,27 +30,26 @@
"publish"
],
"dependencies": {
"chalk": "2.4.1",
"commander": "^2.16.0",
"conf": "^2.0.0",
"chalk": "^2.4.2",
"commander": "^2.19.0",
"conf": "^2.2.0",
"cp-file": "^6.0.0",
"execa": "^0.10.0",
"git-config-path": "^1.0.1",
"execa": "^1.0.0",
"git-config-path": "^2.0.0",
"github-username": "^4.1.0",
"globby": "^8.0.1",
"handlebars": "^4.0.11",
"inquirer": "^6.0.0",
"make-dir": "^1.3.0",
"node-compat-require": "^1.0.5",
"ora": "^3.0.0",
"globby": "^9.0.0",
"handlebars": "^4.1.0",
"inquirer": "^6.2.2",
"make-dir": "^2.0.0",
"ora": "^3.1.0",
"p-each-series": "^1.0.0",
"parse-git-config": "^2.0.2",
"parse-git-config": "^3.0.0",
"validate-npm-package-name": "^3.0.0",
"which": "^1.3.1"
},
"devDependencies": {
"ava": "^0.25.0",
"ava": "^1.2.1",
"rmfr": "^2.0.0",
"standard": "^11.0.1"
"standard": "^12.0.1"
}
}

0 comments on commit 3375f38

Please sign in to comment.