Include LICENSE file in published SignalR npm packages#67496
Open
BrennanConroy wants to merge 4 commits into
Open
Include LICENSE file in published SignalR npm packages#67496BrennanConroy wants to merge 4 commits into
BrennanConroy wants to merge 4 commits into
Conversation
The published @microsoft/signalr and @microsoft/signalr-protocol-msgpack npm packages did not contain the project LICENSE file, which OSS compliance tools rely on. The license only existed at the repo root, so npm pack never picked it up. Copy the repo-root LICENSE.txt into each package directory before npm pack and remove it afterward. npm always includes a top-level LICENSE file in the tarball, even with a files allowlist, so no package.json changes are needed. This also covers @microsoft/dotnet-js-interop. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the shared npm packing workflow to ensure the repository’s root MIT license text (LICENSE.txt) is included in the published tarballs for the public workspace packages (notably @microsoft/signalr and @microsoft/signalr-protocol-msgpack), improving compatibility with license scanning/compliance tooling.
Changes:
- Copy repo-root
LICENSE.txtinto each package directory immediately beforenpm pack. - Ensure the copied license file is removed afterward via a
finallyblock to avoid leaving build artifacts in the source tree.
Show a summary per file
| File | Description |
|---|---|
| eng/scripts/npm/pack-workspace.mjs | Copies LICENSE.txt into each workspace package before packing and cleans it up afterward. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 2
Comment on lines
81
to
82
| const packageFileName = `${normalizedPackageName}-${packageVersion}.tgz`; | ||
| const packageTarball = resolve(packageDir, `${packageFileName}`); |
wtgodbe
approved these changes
Jun 30, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
BrennanConroy
commented
Jun 30, 2026
wtgodbe
approved these changes
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The published
@microsoft/signalrand@microsoft/signalr-protocol-msgpacknpm packages do not contain the projectLICENSEfile. While both correctly set thelicensefield inpackage.json, many OSS compliance and license-scanning tools rely on the full license text being present as aLICENSEfile in the package, and currently report it as missing.The license only exists at the repo root (
LICENSE.txt), sonpm pack(which runs per package directory) never picked it up.Approach
The npm packages are produced by
eng/scripts/npm/pack-workspace.mjs, which runsnpm pack <packageDir>for each public workspace package. This change copies the repo-rootLICENSE.txtinto each package directory just beforenpm pack, and removes it afterward in afinallyblock so no build artifact is left behind in the source tree (mirroring the existing version-bump/rename cleanup pattern).No changes to the
filesallowlists are required: npm always includes a top-levelLICENSEfile in the tarball, even whenfilesis specified.Notes
@microsoft/dotnet-js-interop. They are all the same MIT-licensed repo, so this is correct and consistent.Verification
npm pack --dry-runagainst the real@microsoft/signalrpackage (with the LICENSE copied in) showsLICENSE.txtincluded in the tarball, and the source tree is clean afterward.LICENSE.txteven when a restrictivefilesallowlist is set.Fixes #67486