Skip to content

Commit

Permalink
修复sync命名Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaZhengRefn committed Feb 16, 2018
1 parent c70619e commit 0a730a5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bin/pharah
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const program = require('commander')
const path = require('path')

const req = command => path.resolve('./commands/', command)
const req = command => path.resolve(__dirname, '../commands/', command)

program
.version(require('../package.json').version, '-v, --version')
Expand Down
8 changes: 5 additions & 3 deletions commands/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ module.exports = inquirer.prompt([
}
])
.then(({ url, mode }) => {
download(url, path.resolve(__dirname, '../'), { encoding: 'utf8' })
download(url, { encoding: 'utf8' })
.then(data => {

try {
data = JSON.parse(data)
} catch (error) {
Expand All @@ -46,8 +45,11 @@ module.exports = inquirer.prompt([
if(mode === 'merge'){
templateList = Object.assign(templateList, data)
} else if(mode === 'replace'){
templateList = data
templateList = Object.assign({}, data)
}
writeTemplateList(templateList, path.resolve(__dirname, '../template.json'))
})
.catch(e => {
console.log(e)
})
})
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "pharah-cli",
"version": "1.0.4",
"version": "1.0.7",
"description": "A cli that aims to managing template code.",
"main": "index.js",
"bin": {
"pharah": "./bin/pharah"
"pharah": "bin/pharah"
},
"scripts": {},
"repository": {
Expand Down

0 comments on commit 0a730a5

Please sign in to comment.