Skip to content
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

Packages using lerna are not distributed including LICENSE #1213

Closed
kylef opened this issue Jan 18, 2018 · 7 comments · Fixed by #1465
Closed

Packages using lerna are not distributed including LICENSE #1213

kylef opened this issue Jan 18, 2018 · 7 comments · Fixed by #1465

Comments

@kylef
Copy link

kylef commented Jan 18, 2018

Packages which are distributed with lerna are often do not include a LICENSE file, this makes consuming packages that use lerna tricky as the license file and copyright notice are not included in the NPM distribution. Tools such as license-checker won't be able to find the license file and respective copyright notice and author.

NPM would normally include files such as the LICENSE file in the NPM distribution. When running npm pack or such the license will be included in the created tarball.

Certain files are always included, regardless of settings:

  • README
  • CHANGES / CHANGELOG / HISTORY
  • LICENSE / LICENCE
  • NOTICE

From https://docs.npmjs.com/files/package.json#files.

The common pattern I've seen in libraries using lerna is that the LICENSE file is found in the root of the repository. Since lerna will publish each package in the package/ directory, the package inside repository doesn't contain a copy of the LICENSE.

You can see this in babel, the repository contains a LICENSE file, and package such as babel-runtime on NPM (tarball: https://registry.npmjs.org/babel-runtime/-/babel-runtime-7.0.0-beta.2.tgz) will not have any license file.

I am wondering if there is an automated way that this problem can be solved and the project LICENSE can be present in the distributed NPM tarball. Perhaps in lerna publish the license could be injected into the package?

@evocateur
Copy link
Member

Would symlinking the root LICENSE file into the package roots work? (just checked with npm pack, nope 😞)

So yeah, either copy the LICENSE file into each root manually, or lerna can do it I guess. fstream-npm's implementation is probably "good enough" in terms of identifying if a root license file exists.

@honzajavorek
Copy link
Contributor

It would be great if Lerna automatically dealt with this problem as it propagates to many packages using Lerna. Otherwise we who care about licensing need to go to every single monorepo maintainer and to ask them to add a custom mechanism to copy the licenses into the individual packages, which is, let's say, a long run.

@evocateur
Copy link
Member

evocateur commented Feb 7, 2018 via email

@honzajavorek
Copy link
Contributor

@evocateur I think I can work on this. If you have any advice on what to do or where to start, let me know.

@honzajavorek
Copy link
Contributor

My proposal would be:

  1. Right before publishing the package, look whether there is a license present in the sub package.
  2. If yes, do nothing. If not, look whether there is a license in the root package.
  3. If yes, copy the license to the sub package, temporarily. On success or failure remove the temporary file.
  4. If there is no license in the sub package nor in the root package, print a warning the published package is not going to be licensed properly.

@evocateur
Copy link
Member

evocateur commented May 28, 2018 via email

honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jun 13, 2018
honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jun 15, 2018
honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jun 15, 2018
honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jun 15, 2018
honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jun 15, 2018
honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jun 15, 2018
honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jun 15, 2018
honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jun 15, 2018
honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jun 19, 2018
honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jul 13, 2018
honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jul 13, 2018
honzajavorek added a commit to honzajavorek/lerna that referenced this issue Jul 16, 2018
evocateur pushed a commit to honzajavorek/lerna that referenced this issue Jul 16, 2018
@lock
Copy link

lock bot commented Dec 27, 2018

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 27, 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 a pull request may close this issue.

3 participants