mirror of
https://github.com/garrytan/gstack.git
synced 2026-06-17 23:30:09 +02:00
8a24e896f1
Bun's Windows shell parser rejects multiple constructs the inline
package.json build chain used: brace groups `{ cmd; }`, subshells with
redirection `( git ... ) > path/.version`, and (in Bun 1.3.x) subshells
near redirections in general. Every Windows install + every
auto-upgrade since v1.34.2.0 has failed on `bun run build`.
Extracts the build chain to scripts/build.sh and the .version writes to
scripts/write-version-files.sh. POSIX-portable, no Bun shell parsing
involved. Also adds Windows-specific bun.exe handling for non-ASCII
PATHs (a separate Windows footgun where Bun's --compile fails when the
binary lives under a path with non-ASCII chars).
Updates test/build-script-shell-compat.test.ts to assert the new shape:
no subshells with redirections anywhere in the build chain, and build
delegates to scripts/build.sh which delegates .version writes.
Contributed by @Charlie-El via #1544. Supersedes #1531 (@scarson, fixed
in build helper), #1480 (@mikepsinn, partial overlap), #1460
(@realcarsonterry, brace-group fix subsumed) — credit retained.
Closes #1538, #1537, #1530, #1457, #1561.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
14 lines
229 B
Bash
Executable File
14 lines
229 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
if git_head="$(git rev-parse HEAD 2>/dev/null)"; then
|
|
:
|
|
else
|
|
git_head=""
|
|
fi
|
|
|
|
for version_file in "$@"; do
|
|
mkdir -p "$(dirname "$version_file")"
|
|
printf '%s\n' "$git_head" > "$version_file"
|
|
done
|