fix(wasm): list the licenses in the npm package's files array #324
No reviewers
Labels
No labels
area/ci-release
area/cli
area/docs
area/dungeon
area/ftl
area/graphics
area/gui
area/music
area/saves
area/tooling
port/amiga
port/dos
port/fm-towns
port/mac
port/pc98
port/sega-cd
priority/high
priority/low
priority/medium
type/bug
type/chore
type/docs
type/feature
type/research
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jqueuniet/dm2-tools!324
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/npm-license-files"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
dm2-tools@0.2.0is live on npm without either license text, despitedeclaring
"license": "MIT OR Apache-2.0". The published tarball has sixentries and neither is a license.
Why the earlier fix wasn't enough
Copying
LICENSE-MIT/LICENSE-APACHEnext toCargo.tomlgets wasm-pack toplace them in the package directory — which is as far as I verified it. But
packing is governed by
files, and wasm-pack always writes that array withoutthem.
npm's always-included rule doesn't close the gap. From
npm-packlist:The separator is a dot.
LICENSEandLICENSE.mdsurvive an explicitfilesarray; the hyphenated names a dual-licensed crate needs do not.
The fix
build-npm.shappends both tofiles, and throws if either is missing from thepackage directory rather than quietly publishing without them.
Verified with
npm pack --dry-runinnode:lts-trixie— eight entriesincluding both licenses, against six in what's published:
The published 0.2.0 stays as it is
npm will not let it be corrected in place: a version number cannot be reused
after an unpublish, and unpublishing the only version of a package blocks the
name for 24 hours. Bumping npm alone would also desync it from the workspace
version that
build-npm.shreads out ofCargo.toml. So the fix ships withthe next release, and the docs record why 0.2.0 lacks the texts. The license is
still declared in the package metadata and the repository link resolves, so the
terms are discoverable meanwhile.
`dm2-tools@0.2.0` shipped to npm without either license text, despite declaring `"license": "MIT OR Apache-2.0"`. Copying the files next to Cargo.toml gets wasm-pack to place them in the package directory, which is as far as this was verified, but packing is governed by `files` — and wasm-pack always writes that array without them. npm's always-included rule does not cover the gap. From npm-packlist: '!/license{,.*[^~$]}', '!/licence{,.*[^~$]}', The separator is a dot, so `LICENSE` and `LICENSE.md` survive an explicit `files` array while the hyphenated `LICENSE-MIT` and `LICENSE-APACHE` of a dual-licensed crate do not. `build-npm.sh` now appends both to `files`, and fails loudly if either is missing from the package directory rather than quietly publishing without them. Verified with `npm pack --dry-run`: eight entries including both licenses, against the six in the published tarball. The published 0.2.0 cannot be corrected in place — npm refuses to reuse a version number after an unpublish, and unpublishing the only version blocks the package name for 24 hours — so the fix lands with the next release.