Skip to content

Commit

Permalink
fixup! fix(setup): fail gracefully when package.json cannot be found
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Jun 9, 2017
1 parent 13fff40 commit ee5a5a8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/setup.js
Expand Up @@ -6,8 +6,12 @@ var log = require('npmlog')

var isInstallIntoApp = /node_modules/.test(process.cwd())

// This block only executes if Hoodie is installed with as a dependency
// Run setup only if Hoodie is installed explicitly (npm install hoodie)
if (isInstallIntoApp) {
setup()
}

function setup () {
var pathToAppRoot = path.resolve('..', '..')

// log warning if package.json cannot be found (hoodiehq/hoodie#751)
Expand All @@ -20,7 +24,7 @@ if (isInstallIntoApp) {
log.warn('setup', 'Could not find package.json at ' + path.join(pathToAppRoot, 'package.json'))
log.warn('setup', 'You must manually set the start script in your app’s package.json to "hoodie" in order for "npm start" to work')

process.exit(0)
return
}

packageJson.scripts = packageJson.scripts || {}
Expand Down

0 comments on commit ee5a5a8

Please sign in to comment.