Skip to content

Add private package support - #10

Closed
patrickheeney wants to merge 1 commit into
lerna:masterfrom
patrickheeney:private
Closed

patrickheeney wants to merge 1 commit into
lerna:masterfrom
patrickheeney:private

Conversation

@patrickheeney

Copy link
Copy Markdown

I am looking to use lerna to manage our monorepo, but we don't have packages published on npm. This causes npm install to fail on lerna bootstrap because the package was not found on the registry.

I added a simple check to see if private: true is set in package.json. I am not sure if this is the best way to do it because it bypasses the version check. However, in my case I don't have a version because my dependencies look like this:

# packages/some-other-package/package.json
  "dependencies": {
    "some-local-dependency": "file:../some-local-dependency"
  },

Is there a better way to do this?

@jamiebuilds

Copy link
Copy Markdown
Contributor

I'm confused, you have some packages in your lerna repo that are private and others that are not?

@jamiebuilds

Copy link
Copy Markdown
Contributor

Closing due to inactivity.

@patrickheeney

Copy link
Copy Markdown
Author

@thejameskyle Sorry, I missed this notification. Yes I have a private mono repo with private packages and some that get published to npm as public packages. The use case for this all the reasons you would use file:// or private packages.

@jamiebuilds

Copy link
Copy Markdown
Contributor

I don't understand the use case of having public and private packages. If things are public then their source code should be public too. I don't want to support mixing these

@patrickheeney

Copy link
Copy Markdown
Author

There are dozens of use cases for private packages which I won't get into here. Not all my private packages are published to npm, but I would think supporting private packages would fall in line with the purpose of the tool: A tool for managing JavaScript projects with multiple packages (only public?)..

@patrickheeney

Copy link
Copy Markdown
Author

Perhaps you are also thinking that the mono repo is open source, it's not. We have a private git repo using lerna to manage it. We have some packages that sync to open source, but the mono repo is not. Lerna does not currently support private packages of any sort, this PR fixes that.

@jamiebuilds

Copy link
Copy Markdown
Contributor

I use lerna for a ton of private packages, it supports them fine. What you are asking for is local dependencies and mixing of local and remote, and I don't get the use case for that.

@patrickheeney

Copy link
Copy Markdown
Author

We have some local dependencies to the project that are not published to npm, but bundled with the project itself. Npm supports file:// based dependencies so I am looking for lerna to support it as well. Without this simple change, the packages do not get bootstrapped for local development.

@jamiebuilds

Copy link
Copy Markdown
Contributor

Could you create an example repo with the structure you have in mind?

@patrickheeney

Copy link
Copy Markdown
Author

I am not sure why the directory structure would matter with this, but I reckon something like:

packages/foo
packages/foo/internal_modules/bar
packages/baz

// packages/foo/package.json
"dependencies": {
  "bar": "file:./internal_modules/bar"
}

If you don't understand the use case (of file:// packages), I don't want to keep pushing for local dependencies support. Perhaps I should look into other projects or rolling my own?

@jamiebuilds

Copy link
Copy Markdown
Contributor

Okay good luck

@sebmck

sebmck commented Feb 12, 2016

Copy link
Copy Markdown
Contributor

Feel free. We don't get paid to work on this :)

@patrickheeney

Copy link
Copy Markdown
Author

@kittens This is a PR that I took the time to write and submit? I wanted to contribute to the community and this repository, but I don't know how else to explain the importance of npm local packages, which this adds support for.

@patrickheeney

Copy link
Copy Markdown
Author

In case there was some confusion: My comments about rolling my own or searching for other projects was not intended to be snarky, but rather ask if my time would be better spent finding an alternative solution vs attempting to get this re-opened.

@sebmck

sebmck commented Feb 12, 2016

Copy link
Copy Markdown
Contributor

@patrickheeney Ah right, my bad.

@thejameskyle I don't see why we shouldn't just support this flag, especially since the addition is so simple. We've even had some packages inside babel/babel that were internal and weren't meant for public consumption.

@hzoo

hzoo commented Feb 12, 2016

Copy link
Copy Markdown
Contributor

Sounds like a low complexity change to support; will be better when we have more tests?

Also we can add some more to the readme about this (support public, private, local) etc - or add to #48

@patrickheeney

Copy link
Copy Markdown
Author

@kittens @hzoo It sounds like you are both in support of this (private / local packages). Should this be closed? If the PR in its current format can't be accepted, should I open an issue to discuss potential implementations of this feature?

@lock

lock Bot commented Dec 28, 2018

Copy link
Copy Markdown

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Dec 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants