Search code examples
gitnpmwalmart-electrode

npm package from inside another repo?


Related: Depend on a branch or tag using a git URL in a package.json?

The electrode-archetype-react-app npm package comes from a subdirectory of another package's git repository: electrode-io/electrodepackages/electrode-archetype-react-app.

  1. How is that possible?
  2. How can I hook onto a specific branch of the sub-package?

I tried

npm install electrode-io/electrode#electrode-archetype-react-app/some-branch

but got the following error:

fatal: ambiguous argument 'electrode-archetype-react-app': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

So then I tried

npm install github:electrode-io/electrode#electrode-archetype-react-app/some-branch
npm install github:electrode-io/electrode -- package/electrode-archetype-react-app#some-branch
npm install github:electrode-io/electrode#some-branch -- package/electrode-archetype-react-app

No dice

What dark wizardry is this?

Edit Thanks to an eagle-eyed colleague: Electrode is using Lerna, which might be the source of this dark magic.


Solution

  • It was indeed Lerna who was the puppet-master, and it is not possible to use a remote branch from origin. It can only be done locally using a relative path.