E528 fix: Add shebang to npm bundle for global installs by BYK · Pull Request #101 · getsentry/cli · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@BYK
Copy link
Member
@BYK BYK commented Jan 28, 2026

Summary

Fixes a bug where the npm package failed to execute on Unix systems with:

syntax error near unexpected token `('

The npm bundle (dist/bin.cjs) was missing the #!/usr/bin/env node shebang line. When users installed the package globally and ran sentry auth login, Unix shells tried to interpret the JavaScript code as shell commands.

Changes

  • Add esbuild banner option to prepend the Node.js shebang to the bundle
  • Remove redundant shebang from src/bin.ts (was being duplicated in output)
  • Add smoke tests to verify the bundle has correct shebang and executes properly

The npm bundle was missing the Node.js shebang line, causing Unix shells
to interpret JavaScript as shell commands when running globally installed
CLI (e.g., `npm install -g sentry && sentry auth login`).

- Add esbuild banner option to prepend `#!/usr/bin/env node`
- Remove redundant shebang from source (now added by esbuild)
- Add smoke tests to verify bundle executes correctly
@github-actions
Copy link
github-actions bot commented Jan 28, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • Add shebang to npm bundle for global installs by BYK in #101

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
github-actions bot commented Jan 28, 2026

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 1756 uncovered lines.
✅ Project coverage is 66.66%. Comparing base (base) to head (head).

Files with missing lines (24)
File Patch % Lines
human.ts 30.83% ⚠️ 673 Missing
resolve-target.ts 18.93% ⚠️ 257 Missing
oauth.ts 21.71% ⚠️ 202 Missing
resolver.ts 3.23% ⚠️ 120 Missing
errors.ts 5.94% ⚠️ 95 Missing
api-client.ts 68.77% ⚠️ 94 Missing
migration.ts 47.44% ⚠️ 82 Missing
api.ts 89.80% ⚠️ 47 Missing
seer.ts 75.54% ⚠️ 45 Missing
errors.ts 73.17% ⚠️ 33 Missing
seer.ts 76.15% ⚠️ 31 Missing
preload.ts 39.02% ⚠️ 25 Missing
detector.ts 87.79% ⚠️ 16 Missing
telemetry.ts 89.87% ⚠️ 8 Missing
auth.ts 93.69% ⚠️ 7 Missing
index.ts 95.06% ⚠️ 4 Missing
colors.ts 91.84% ⚠️ 4 Missing
env-file.ts 97.17% ⚠️ 3 Missing
utils.ts 98.64% ⚠️ 2 Missing
alias.ts 98.56% ⚠️ 2 Missing
project-aliases.ts 97.40% ⚠️ 2 Missing
schema.ts 90.00% ⚠️ 2 Missing
java.ts 97.22% ⚠️ 1 Missing
parser.ts 98.63% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    66.66%    66.66%        —%
==========================================
  Files           45        45         —
  Lines         5267      5267         —
  Branches         0         0         —
==========================================
+ Hits          3511      3511         —
- Misses        1756      1756         —
- Partials         0         0         —

Generated by Codecov Action

Use --version instead of --help and don't require exit code 0
since the CLI may have config-related errors in test environments.
@BYK BYK marked this pull request as ready for review January 29, 2026 00:04
@BYK BYK merged commit fcb1a8d into main Jan 29, 2026
21 checks passed
@BYK BYK deleted the fix/npm-bundle-shebang branch January 29, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0