Skip to content

Packages using lerna are not distributed including LICENSE #1213

@kylef

Description

@kylef

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions