New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to connect sibling packages? #200

Closed
reggi opened this Issue Jun 9, 2016 · 7 comments

Comments

Projects
None yet
5 participants
@reggi

reggi commented Jun 9, 2016

The doc says that bootstrap

Link together all Lerna packages that are dependencies of each other.

How do I go about making one package a dep of another?

  1. npm install ../my-sibling —save
  2. npm install @nspace/my-sibling —save (does it have to be published first)?
  3. npm link ../my-sibling —save
@gigabo

This comment has been minimized.

Member

gigabo commented Jun 9, 2016

Your package that depends on my-sibling needs the dependency to be specified in its package.json.

If my-sibling hasn't been published yet you'll need to add that dependency yourself by editing the JSON file. Once the dependency is added lerna bootstrap will create the "link" regardless of whether my-sibling has been published.

@jamiebuilds

This comment has been minimized.

Contributor

jamiebuilds commented Jun 10, 2016

I was considering at one point to have a replacement install command like this:

$ lerna install [package] [dependency][@version] [--save,--save-dev,...]

And if you installed a local dependency with the matching version or no version specified then Lerna would link them together.

There's probably a ticket for this already, but if there isn't there should be

@reggi

This comment has been minimized.

reggi commented Jun 10, 2016

@thejameskyle I'd love this and it would be nice to have tabbed auto completion because all of the options for what to install or where to install are in packages. :)

@hzoo

This comment has been minimized.

Member

hzoo commented Jun 13, 2016

Kinda in #53 but could be cleared up to desired behavior/cli

@jamiebuilds

This comment has been minimized.

Contributor

jamiebuilds commented Nov 16, 2016

Merging into #53

@spudly

This comment has been minimized.

Contributor

spudly commented Dec 15, 2016

If my-sibling hasn't been published yet you'll need to add that dependency yourself by editing the JSON file. Once the dependency is added lerna bootstrap will create the "link" regardless of whether my-sibling has been published.

@gigabo, When you say add the dependency yourself, do you mean as a local dependency? Like this?

{
  "dependencies": {
    "my-other-pkg": "file:../my-other-pkg",
  }
}
@gigabo

This comment has been minimized.

Member

gigabo commented Dec 15, 2016

@spudly Actually a caret-ranged version dependency, like:

{
  "dependencies": {
    "my-other-package": "^0.0.1",
  }
}

^ That assumes that the package.json for my-other-package has "version": "0.0.1", but my-other-package doesn't need to have been published yet.

Incidentally Asini recently got an add command, which is basically a yarn-flavored version of what is described in #200 (comment). Maybe we should port that over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment