Skip to content

Commit

Permalink
Merge pull request #23 from flowbased/fix_package_json
Browse files Browse the repository at this point in the history
Fix dependency on package.json existence
  • Loading branch information
bergie committed Mar 3, 2017
2 parents 6478120 + fc8189f commit 247626e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/runtimes/noflo.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,16 @@ listGraphs = (componentDir, options, callback) ->
getModuleInfo = (baseDir, options, callback) ->
packageFile = path.resolve baseDir, 'package.json'
readfile packageFile, 'utf-8'
.catch (e) ->
return Promise.reject e unless e?.code is 'ENOENT'
# Fake package with just dirname
Promise.resolve
name: path.basename baseDir
description: null
.then (json) ->
packageData = JSON.parse json
return Promise.resolve json if typeof json is 'object'
Promise.resolve JSON.parse json
.then (packageData) ->
module =
name: packageData.name
description: packageData.description
Expand Down

0 comments on commit 247626e

Please sign in to comment.