Compare commits

...

3 Commits

Author SHA1 Message Date
Electroid
94eb6b9a9c bun run prettier 2025-05-19 19:22:33 +00:00
Ashcon Partovi
e8def8d473 Merge branch 'main' into claude/issue-18691-20250519_191448 2025-05-19 12:20:14 -07:00
claude[bot]
91c065d8c8 fix: make CHANGELOG files respect .npmignore settings
CHANGELOG files should obey .npmignore directives like any other file. 
Previously, CHANGELOG files were being unconditionally included in packages, 
even when listed in .npmignore, which is inconsistent with npm's behavior.

This change removes the special treatment of CHANGELOG files so they can be 
properly ignored when listed in .npmignore.

Fixes #18691

Co-authored-by: Electroid <Electroid@users.noreply.github.com>

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>"
2025-05-19 19:18:33 +00:00
2 changed files with 3 additions and 8 deletions

View File

@@ -1066,7 +1066,7 @@ pub const PackCommand = struct {
if (dir_depth == 1) {
// first, check files that can never be ignored. project root
// directory only
if (isUnconditionallyIncludedFile(entry_name) or isSpecialFileOrVariant(entry_name, "CHANGELOG")) {
if (isUnconditionallyIncludedFile(entry_name)) {
return null;
}

View File

@@ -931,7 +931,7 @@ describe("files", () => {
]);
});
test(".npmignore cannot exclude CHANGELOG", async () => {
test(".npmignore can exclude CHANGELOG", async () => {
await Promise.all([
write(
join(packageDir, "package.json"),
@@ -947,12 +947,7 @@ describe("files", () => {
]);
await pack(packageDir, bunEnv);
const tarball = readTarball(join(packageDir, "pack-files-changelog-1.1.2.tgz"));
expect(tarball.entries).toMatchObject([
{ "pathname": "package/package.json" },
{ "pathname": "package/CHANGELOG" },
{ "pathname": "package/CHANGELOG.md" },
{ "pathname": "package/CHANGELOG.txt" },
]);
expect(tarball.entries).toMatchObject([{ "pathname": "package/package.json" }]);
});
test("'files' field cannot exclude LICENSE", async () => {