Skip to content

Commit 3375f38

Browse files
bugfix for binary template files
1 parent 795e737 commit 3375f38

File tree

5 files changed

+1456
-2982
lines changed

5 files changed

+1456
-2982
lines changed

index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env node
22
'use strict'
33

4-
const compatRequire = require('node-compat-require')
5-
compatRequire('./lib', { node: '>= 8' })
4+
require('./lib/cli')

lib/index.js lib/cli.js

File renamed without changes.

lib/create-library.js

+17-7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ const pEachSeries = require('p-each-series')
1111

1212
const pkg = require('../package')
1313

14+
const templateBlacklist = new Set([
15+
'example/public/favicon.ico'
16+
])
17+
1418
module.exports = async (info) => {
1519
const {
1620
manager,
@@ -75,14 +79,20 @@ module.exports.copyTemplateFile = async (opts) => {
7579
const destFilePath = path.join(dest, fileRelativePath)
7680
const destFileDir = path.parse(destFilePath).dir
7781

78-
const template = handlebars.compile(fs.readFileSync(file, 'utf8'))
79-
const content = template({
80-
...info,
81-
yarn: (info.manager === 'yarn')
82-
})
83-
8482
await mkdirp(destFileDir)
85-
fs.writeFileSync(destFilePath, content, 'utf8')
83+
84+
if (templateBlacklist.has(fileRelativePath)) {
85+
const content = fs.readFileSync(file)
86+
fs.writeFileSync(destFilePath, content)
87+
} else {
88+
const template = handlebars.compile(fs.readFileSync(file, 'utf8'))
89+
const content = template({
90+
...info,
91+
yarn: (info.manager === 'yarn')
92+
})
93+
94+
fs.writeFileSync(destFilePath, content, 'utf8')
95+
}
8696

8797
return fileRelativePath
8898
}

package.json

+13-14
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,26 @@
3030
"publish"
3131
],
3232
"dependencies": {
33-
"chalk": "2.4.1",
34-
"commander": "^2.16.0",
35-
"conf": "^2.0.0",
33+
"chalk": "^2.4.2",
34+
"commander": "^2.19.0",
35+
"conf": "^2.2.0",
3636
"cp-file": "^6.0.0",
37-
"execa": "^0.10.0",
38-
"git-config-path": "^1.0.1",
37+
"execa": "^1.0.0",
38+
"git-config-path": "^2.0.0",
3939
"github-username": "^4.1.0",
40-
"globby": "^8.0.1",
41-
"handlebars": "^4.0.11",
42-
"inquirer": "^6.0.0",
43-
"make-dir": "^1.3.0",
44-
"node-compat-require": "^1.0.5",
45-
"ora": "^3.0.0",
40+
"globby": "^9.0.0",
41+
"handlebars": "^4.1.0",
42+
"inquirer": "^6.2.2",
43+
"make-dir": "^2.0.0",
44+
"ora": "^3.1.0",
4645
"p-each-series": "^1.0.0",
47-
"parse-git-config": "^2.0.2",
46+
"parse-git-config": "^3.0.0",
4847
"validate-npm-package-name": "^3.0.0",
4948
"which": "^1.3.1"
5049
},
5150
"devDependencies": {
52-
"ava": "^0.25.0",
51+
"ava": "^1.2.1",
5352
"rmfr": "^2.0.0",
54-
"standard": "^11.0.1"
53+
"standard": "^12.0.1"
5554
}
5655
}

0 commit comments

Comments
 (0)