From 8a5fe1a5359d8268b27245bc761e0d93de4ae87e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 23 Aug 2026 14:18:03 +0000 Subject: [PATCH 1/2] fix(package): ship `apply_patches` and its patches, invoke via bash The job `Node.js v16`/`v18`/`v20` (windows-latest) on workflow `windows_test_npm_install` has failed on every scheduled run against develop for the past month with `npm ERR! 'tools' is not recognized as an internal or external command`. Root cause: `.npmignore` excluded `/etc/` and `/tools/` in their entirety, so the `postinstall` script (`tools/scripts/apply_patches`) declared in package.json, along with the patches it applies under `etc/patches/`, were never included in the published npm tarball. `npm install` therefore always tried to execute a lifecycle script that does not exist in the installed package, regardless of platform; on Windows this surfaces as the "not recognized" error above because cmd.exe (npm's default script-shell there) cannot interpret the missing path as a command at all. This commit selectively un-ignores `etc/patches/` and `tools/scripts/apply_patches`, using the same negation technique `.npmignore` already applies to `/docs/*` + `!/docs/types/*`, so the postinstall script and its patches are shipped. It also prefixes the `postinstall` command with `bash`, since npm spawns lifecycle scripts via cmd.exe on Windows regardless of the invoking shell, and cmd.exe cannot execute a bash-shebang script directly; `bash` resolves on PATH via the Git-for-Windows/MSYS2 toolchain already required by the windows_test_npm_install runner. Behavior on Linux/macOS is unchanged, since the script already required bash and takes no positional arguments. Validated by `npm pack`, extracting the resulting tarball into a directory with no `.git` (matching how `make test-npm-install` installs `@stdlib/stdlib@latest` from the registry), and confirming `bash tools/scripts/apply_patches` now runs and exits 0 from within it. Ref: https://github.com/stdlib-js/stdlib/actions/runs/32564185436 --- .npmignore | 8 ++++++-- package.json | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.npmignore b/.npmignore index 125c4b03a14d..b2a1ff1bdbfc 100644 --- a/.npmignore +++ b/.npmignore @@ -57,10 +57,14 @@ workshops/ !/deps/test/openblas* # Only top-level directories: -/etc/ +/etc/* +!/etc/patches/ /docs/* !/docs/types/* -/tools/ +/tools/* +!/tools/scripts/ +/tools/scripts/* +!/tools/scripts/apply_patches # Compiled source # ################### diff --git a/package.json b/package.json index d6672b72b383..a8652c850cd7 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "clean": "make clean", "check-deps": "make check-deps", "check-licenses": "make check-licenses", - "postinstall": "tools/scripts/apply_patches" + "postinstall": "bash tools/scripts/apply_patches" }, "homepage": "https://github.com/stdlib-js/stdlib", "repository": { From df171223c6f032af6e7fd2c97610ff7fd431c3e5 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 23 Aug 2026 14:23:35 +0000 Subject: [PATCH 2/2] fix(package): make `apply_patches` postinstall best-effort Follow-up to 8a5fe1a53. On Windows, a default Git for Windows install only adds `Git\cmd` to PATH (not `Git\bin`/`Git\usr\bin`, where `bash.exe` lives), so `bash` is not guaranteed to resolve for every Windows contributor running `npm install` outside of CI (CI's windows_test_npm_install runner uses an MSYS2 shell, which does put `bash` on PATH reliably). The patch this script applies only targets a transitive dev-only lint dependency (`unified-message-control`), not a runtime dependency, and the script itself already treats every patch application as best-effort (`git apply ... || true`). This commit extends that same best-effort philosophy to the invocation itself: if `bash` cannot be found at all, `npm install` now succeeds anyway instead of failing with `'bash' is not recognized as an internal or external command`. Validated by simulating both the happy path and a PATH with no `bash` present via `sh -c "bash tools/scripts/apply_patches || exit 0"`; both exit 0. Ref: https://github.com/stdlib-js/stdlib/actions/runs/32564185436 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a8652c850cd7..2408a6f7739d 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "clean": "make clean", "check-deps": "make check-deps", "check-licenses": "make check-licenses", - "postinstall": "bash tools/scripts/apply_patches" + "postinstall": "bash tools/scripts/apply_patches || exit 0" }, "homepage": "https://github.com/stdlib-js/stdlib", "repository": {