generator-docor
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -25,8 +25,8 @@ 'use strict'; | ||
default: 'byted-docor project' | ||
}, | ||
{ | ||
type: 'confirm', | ||
name: 'scripts', | ||
message: 'Add scripts to package.json?' | ||
} | ||
// { | ||
// type: 'confirm', | ||
// name: 'scripts', | ||
// message: 'Add scripts to package.json?' | ||
// } | ||
]; | ||
@@ -53,30 +53,30 @@ | ||
); | ||
if (this.props.scripts) { | ||
const scripts = { | ||
'docs:dev': 'byted-docor dev docs', | ||
'docs:build': 'byted-docor build docs' | ||
}; | ||
if ( | ||
this.fs.exists(this.destinationPath(`${this.props.destination}/package.json`)) | ||
) { | ||
let pack = JSON.parse(this.fs.read(`${this.props.destination}/package.json`)); | ||
if (pack.scripts === undefined) pack.scripts = {}; | ||
pack.scripts = Object.assign(pack.scripts, scripts); | ||
this.fs.write( | ||
`${this.props.destination}/package.json`, | ||
JSON.stringify(pack, null, 2) | ||
); | ||
} else { | ||
this.fs.write( | ||
`${this.props.destination}/package.json`, | ||
JSON.stringify( | ||
{ | ||
scripts: scripts | ||
}, | ||
null, | ||
2 | ||
) + '\n' | ||
); | ||
} | ||
// if (this.props.scripts) { | ||
const scripts = { | ||
'docs:dev': 'byted-docor dev docs', | ||
'docs:build': 'byted-docor build docs' | ||
}; | ||
if ( | ||
this.fs.exists(this.destinationPath(`${this.props.destination}/package.json`)) | ||
) { | ||
let pack = JSON.parse(this.fs.read(`${this.props.destination}/package.json`)); | ||
if (pack.scripts === undefined) pack.scripts = {}; | ||
pack.scripts = Object.assign(pack.scripts, scripts); | ||
this.fs.write( | ||
`${this.props.destination}/package.json`, | ||
JSON.stringify(pack, null, 2) | ||
); | ||
} else { | ||
this.fs.write( | ||
`${this.props.destination}/package.json`, | ||
JSON.stringify( | ||
{ | ||
scripts: scripts | ||
}, | ||
null, | ||
2 | ||
) + '\n' | ||
); | ||
} | ||
// } | ||
} | ||
@@ -83,0 +83,0 @@ |
{ | ||
"name": "generator-docor", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "CLI for docor", | ||
@@ -5,0 +5,0 @@ "homepage": "", |
13859