Skip to content

Commit

Permalink
skip npm i if no dependencies in package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Escalante committed May 16, 2016
1 parent 5ab7a1f commit 8caa571
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,10 @@ function createTargetDirectory (target) {
}

function installDependenciesIfPresent () {
if (!fs.existsSync(path.join(this.path, 'package.json'))) { return }
const pkgPath = path.join(this.path, 'package.json')
if (!fs.existsSync(pkgPath)) { return }
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))
if (!pkg.dependencies) { return }
this.sprout.emit('msg', 'installing npm dependencies')
return exec('npm install --production', { cwd: this.path })
}
Expand Down

0 comments on commit 8caa571

Please sign in to comment.