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

Builder scripts using global npm dependencies instead of locals #47

Closed
dandelany opened this issue Dec 8, 2015 · 3 comments · Fixed by #48
Closed

Builder scripts using global npm dependencies instead of locals #47

dandelany opened this issue Dec 8, 2015 · 3 comments · Fixed by #48
Labels

Comments

@dandelany
Copy link

Opening another ticket here per @boygirl 's request... See FormidableLabs/victory#97 for more details & examples.

While I was working on Victory, I discovered that builder scripts which call node binaries like babel end up using the globally installed versions of those binaries, rather than the local versions in node_modules. This is contrary to the behavior of regular old npm scripts which use the local versions. This can cause major problems and build inconsistencies if the user's global module version does not match the local version.

@ryan-roemer ryan-roemer added the bug label Dec 8, 2015
@ryan-roemer
Copy link
Member

So this behavior likely comes from: https://github.com/FormidableLabs/builder/blob/master/lib/environment.js#L68-L72

Environment.prototype.updateNodePath = function (archetypeNodePaths) {
  return (this.env.NODE_PATH || "")
    .split(DELIM)
    .filter(function (x) { return x; }) // Remove empty strings
    .concat([CWD_NODE_PATH].concat(archetypeNodePaths || []))
    .join(DELIM);
};

PROPOSAL: Resolve in this order:

  • Current Working directory
  • Archetype directories
  • then pre-existing NODE_PATH

How does that sound?

/cc @dandelany @boygirl @exogen @chaseadamsio

@dandelany
Copy link
Author

That sounds pretty good to me! Of course, that order would allow the user's local project deps to override the Archetype's dependency version... But maybe that is preferred, so that the user's project can consciously extend the archetype... I'm still too much of a builder n00b to be sure :)

@ryan-roemer
Copy link
Member

Released as builder@2.1.4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants