Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

BUG: builder help fails when using config fields. #113

Closed
ryan-roemer opened this issue Apr 13, 2016 · 0 comments
Closed

BUG: builder help fails when using config fields. #113

ryan-roemer opened this issue Apr 13, 2016 · 0 comments
Labels

Comments

@ryan-roemer
Copy link
Member

Scenario:

  • Archetype has config field in package.json
  • Root does not have config field in package.json

Error:

$ builder help
[builder:config:environment] {"cwd":"/PATH/TO/root-project","dir":"/PATH/TO/root-project/node_modules/builder/lib"}
[builder:local-detect] Switched to local builder at: /PATH/TO/root-project/node_modules/builder/bin/builder-core.js
[builder:builder-core:start:23706] Started: help
/PATH/TO/root-project/node_modules/builder/lib/config.js:218
      .filter(function (pkg) { return pkg[field][key]; })
                                                ^

TypeError: Cannot read property 'archetype' of undefined
    at /PATH/TO/root-project/node_modules/builder/lib/config.js:218:49
    at /PATH/TO/root-project/node_modules/lodash/index.js:1932:13
    at /PATH/TO/root-project/node_modules/lodash/index.js:3073:15
    at baseForOwn (/PATH/TO/root-project/node_modules/lodash/index.js:2046:14)
    at /PATH/TO/root-project/node_modules/lodash/index.js:3043:18
    at baseFilter (/PATH/TO/root-project/node_modules/lodash/index.js:1931:7)
    at filter (/PATH/TO/root-project/node_modules/lodash/index.js:6309:14)
    at interceptor (/PATH/TO/root-project/node_modules/lodash/index.js:12240:26)
    at Function.thru (/PATH/TO/root-project/node_modules/lodash/index.js:5927:26)
    at baseWrapperValue (/PATH/TO/root-project/node_modules/lodash/index.js:2768:30)

Notes:

Adding a root config will avoid error:

diff --git a/package.json b/package.json
index 92e9ccf..1193938 100644
--- a/package.json
+++ b/package.json
@@ -27,6 +27,7 @@
     "url": "github/root-project/issues"
   },
   "homepage": "github/root-project",
+  "config": {},
   "dependencies": {
     "foo": "0.0.5",
     "bar": "^4.0.0",
ryan-roemer added a commit that referenced this issue Apr 13, 2016
* Add permissive traverse of package.json's when searching for configs. Fixes #113
* Add regression test.
ryan-roemer added a commit that referenced this issue Apr 13, 2016
* Add permissive traverse of package.json's when searching for configs. Fixes #113
* Add regression test.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant