Skip to content

Commit

Permalink
fix: support npm@5’s --save default for postinstall script (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
janl authored and gr2m committed Jun 3, 2017
1 parent 2bc4c6d commit 79dde6b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions bin/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ var path = require('path')
var fs = require('fs')
var log = require('npmlog')

// use process.env to access npm config environment variables.
// - https://docs.npmjs.com/misc/config#environment-variables
// - https://docs.npmjs.com/misc/config#save
var saveRequested = process.env.npm_config_save

// This block only executes if Hoodie is installed with `-S` or `--save` flags.
if (saveRequested) {
var installIntoApp = process.env.PWD.indexOf('node_modules') !== -1
// This block only executes if Hoodie is installed with as a dependency
if (installIntoApp) {
var pathToAppRoot = path.resolve('..', '..')
var packageJson = require(path.join(pathToAppRoot, 'package.json'))

Expand Down

0 comments on commit 79dde6b

Please sign in to comment.