bugfix for binary template files
This commit is contained in:
parent
3472a121ab
commit
a91ecd1b3a
5 changed files with 1461 additions and 2987 deletions
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const compatRequire = require('node-compat-require')
|
require('./lib/cli')
|
||||||
compatRequire('./lib', { node: '>= 8' })
|
|
||||||
|
|
0
packages/create-freesewing-pattern/lib/index.js → packages/create-freesewing-pattern/lib/cli.js
Normal file → Executable file
0
packages/create-freesewing-pattern/lib/index.js → packages/create-freesewing-pattern/lib/cli.js
Normal file → Executable file
|
@ -11,6 +11,10 @@ const pEachSeries = require('p-each-series')
|
||||||
|
|
||||||
const pkg = require('../package')
|
const pkg = require('../package')
|
||||||
|
|
||||||
|
const templateBlacklist = new Set([
|
||||||
|
'example/public/favicon.ico'
|
||||||
|
])
|
||||||
|
|
||||||
module.exports = async (info) => {
|
module.exports = async (info) => {
|
||||||
const {
|
const {
|
||||||
manager,
|
manager,
|
||||||
|
@ -75,14 +79,20 @@ module.exports.copyTemplateFile = async (opts) => {
|
||||||
const destFilePath = path.join(dest, fileRelativePath)
|
const destFilePath = path.join(dest, fileRelativePath)
|
||||||
const destFileDir = path.parse(destFilePath).dir
|
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)
|
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
|
return fileRelativePath
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,27 +30,26 @@
|
||||||
"publish"
|
"publish"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "2.4.1",
|
"chalk": "^2.4.2",
|
||||||
"commander": "^2.16.0",
|
"commander": "^2.19.0",
|
||||||
"conf": "^2.0.0",
|
"conf": "^2.2.0",
|
||||||
"cp-file": "^6.0.0",
|
"cp-file": "^6.0.0",
|
||||||
"execa": "^0.10.0",
|
"execa": "^1.0.0",
|
||||||
"git-config-path": "^1.0.1",
|
"git-config-path": "^2.0.0",
|
||||||
"github-username": "^4.1.0",
|
"github-username": "^4.1.0",
|
||||||
"globby": "^8.0.1",
|
"globby": "^9.0.0",
|
||||||
"handlebars": "^4.0.11",
|
"handlebars": "^4.1.0",
|
||||||
"inquirer": "^6.0.0",
|
"inquirer": "^6.2.2",
|
||||||
"make-dir": "^1.3.0",
|
"make-dir": "^2.0.0",
|
||||||
"node-compat-require": "^1.0.5",
|
"ora": "^3.1.0",
|
||||||
"ora": "^3.0.0",
|
|
||||||
"p-each-series": "^1.0.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",
|
"validate-npm-package-name": "^3.0.0",
|
||||||
"which": "^1.3.1"
|
"which": "^1.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ava": "^0.25.0",
|
"ava": "^1.2.1",
|
||||||
"rmfr": "^2.0.0",
|
"rmfr": "^2.0.0",
|
||||||
"standard": "^11.0.1"
|
"standard": "^12.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue