From 91c065d8c8f02df428509a4cef6a9bb2a33b1d70 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 19:18:33 +0000 Subject: [PATCH] fix: make CHANGELOG files respect .npmignore settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude " --- src/cli/pack_command.zig | 2 +- test/cli/install/bun-pack.test.ts | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/cli/pack_command.zig b/src/cli/pack_command.zig index 3518d52956..3b67ccb81c 100644 --- a/src/cli/pack_command.zig +++ b/src/cli/pack_command.zig @@ -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; } diff --git a/test/cli/install/bun-pack.test.ts b/test/cli/install/bun-pack.test.ts index ea3693d1e6..3767bf19f5 100644 --- a/test/cli/install/bun-pack.test.ts +++ b/test/cli/install/bun-pack.test.ts @@ -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"), @@ -949,9 +949,6 @@ describe("files", () => { 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" }, ]); });