1
0
Fork 0

add basic integration tests

This commit is contained in:
Travis Fischer 2018-03-09 18:45:50 -05:00 committed by Joost De Cock
parent f67003ccfc
commit 7ddd168b3a
8 changed files with 3093 additions and 75 deletions

View file

@ -13,10 +13,15 @@ const pkg = require('../package')
module.exports = async (info) => {
const {
dest,
manager
manager,
name
} = info
// handle scoped package names
const parts = name.split('/')
info.shortName = parts[parts.length - 1]
const dest = path.join(process.cwd(), info.shortName)
await mkdirp(dest)
const source = path.join(__dirname, '../template')
@ -48,6 +53,8 @@ module.exports = async (info) => {
ora.promise(promise, 'Initializing git repo')
await promise
}
return dest
}
module.exports.copyTemplateFile = async (opts) => {
@ -62,7 +69,10 @@ module.exports.copyTemplateFile = async (opts) => {
const destFilePath = path.join(dest, fileRelativePath)
const destFileDir = path.parse(destFilePath).dir
const content = await consolidate.handlebars(file, info)
const content = await consolidate.handlebars(file, {
...info,
yarn: (info.manager === 'yarn')
})
await mkdirp(destFileDir)
fs.writeFileSync(destFilePath, content, 'utf8')