Skip to content

Bug: Treatment of UNLICENSED when package not private #262

@Undistraction

Description

@Undistraction

We have a monorepo and publish private packages from it to NPM to be consumed by our applications.

The config for a package includes:

"name": "@example/packageName",
"license": "UNLICENSED",
"publishConfig": {
    "access": "restricted"
},

Packages marked as private: true are not published to the registry, so packages publishing private packages to NPM cannot use this.

From the NPM docs.

private

If you set "private": true in your package.json, then npm will refuse to publish it.

This is a way to prevent accidental publication of private repositories. If you would like to ensure that a given package is only ever published to a specific registry (for example, an internal registry), then use the publishConfig dictionary described below to override the registry config param at publish-time.

Inside apps that consume our packages we are running license-checker. Instead of reporting our packages as UNLICENSED, it reports them as UNKNOWN. This is because if the value of package's license field is UNKNOWN a value of null is returned from license. There is a subsequent check for UNLICENCED, but it only happens for packages that have private: true.

It is perfectly valid to have a license of UNLICENSED for a non-private package when published and consumed in this way so this feels like a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions