feat: Set up Craft-based release workflow for npm and GitHub Releases#28
feat: Set up Craft-based release workflow for npm and GitHub Releases#28
Conversation
8b6306b to
773f46f
Compare
Configure the project for release as `sentry` package on npm (v0.2.0) using Craft and the getsentry/publish workflow. Distribution: - npm: Single bundled JS file (42KB) via esbuild for fast `npx sentry` startup - GitHub Releases: Native Bun binaries for all platforms Key changes: - Add .craft.yml with npm + github targets - Add build.yml workflow with matrix builds and smoke tests - Add release.yml and changelog-preview.yml workflows - Add esbuild bundler with Bun API polyfills for Node.js compatibility - Rename package to `sentry`, set version to 0.2.0 - Move all dependencies to devDependencies (bundled at build time) - Remove old publish.yml and platform package scripts
773f46f to
8c5d442
Compare
- Add biome-ignore comments for intentional barrel files - Add biome-ignore for formatEventDetails complexity (formatting logic) - Configure biome overrides for test files (regex in assertions, delete, etc.) - Apply auto-fixes from biome (numeric separators, formatting) - Add .turbo to .gitignore
- CI workflow now includes lint, test, and build jobs - Build jobs depend on lint and test passing first - Revert test.yml to original (main branch) state - Keep build.yml as reusable workflow for release.yml - Use v4 for all actions (checkout, setup-node, upload/download-artifact)
Codecov Results 📊❌ Patch coverage is 14.29%. Project has 654 uncovered lines. Files with missing lines (14)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 62.79% 62.65% -0.14%
==========================================
Files 26 26 —
Lines 1747 1751 +4
Branches 0 0 —
==========================================
+ Hits 1097 1097 —
- Misses 650 654 +4
- Partials 0 0 —Generated by Codecov Action |
- Merge build.yml into ci.yml for simplicity - Add Bun dependency caching via setup-bun cache option - Use --frozen-lockfile for reproducible installs - Update release.yml to use ci.yml workflow - Delete standalone build.yml
The CLI is useless without OAuth, so fail the build if SENTRY_CLIENT_ID environment variable is not set.
- Move packages/cli/* to root (src/, test/, script/) - Merge package.json files, remove turbo dependency - Remove turbo.json - Update all workflow files to use root paths - Update biome.jsonc test overrides path - Update documentation (AGENTS.md, README.md, DEVELOPMENT.md) This simplifies the repo since it's not actually a monorepo.
These tests can be slow due to network latency. Increase timeout from default 5s to 15s to prevent flaky test failures.
- darwin-x64: build on macos-latest (ARM) with cross-compilation - linux-arm64: build on ubuntu-latest (x64) with cross-compilation macOS-13 runners are retired, and ARM runners aren't available for private repos. Bun supports cross-compilation natively.
- Add --target flag to build.ts for explicit target specification - Update CI to use --target instead of --single for matrix builds - Enables cross-compilation (e.g., build darwin-x64 on darwin-arm64)
Cross-compiled binaries (darwin-x64 on arm64, linux-arm64 on x64) cannot be executed on the build runner. Add can-test matrix flag to skip smoke tests for these targets.
Remove separate test.yml and merge coverage reporting into ci.yml. Single test job now handles both CI gating and coverage uploads.
The monorepo was flattened - package.json is now at root.
fast-glob uses CommonJS dynamic require() which fails in ESM bundles. tinyglobby is a pure ESM alternative that bundles correctly. Also fixes the bundle to inline all npm packages (external: ['node:*']) so the CLI works standalone without dependencies installed.
Assigning undefined to process.env converts it to string 'undefined' rather than removing the variable.
Setting process.env.X = undefined creates string 'undefined', not unset.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| async *scan(opts?: { cwd?: string }): AsyncIterable<string> { | ||
| const results = await glob(this.pattern, { | ||
| cwd: opts?.cwd || process.cwd(), | ||
| }); |
There was a problem hiding this comment.
Glob polyfill ignores onlyFiles option from production code
Medium Severity
The BunGlobPolyfill.scan() method only accepts { cwd?: string } as options and only passes cwd to tinyglobby. However, production code in src/lib/dsn/languages/index.ts calls scan({ cwd, onlyFiles: true }). Since tinyglobby supports onlyFiles, this option should be passed through. Currently, the npm package running on Node.js will return both files and directories instead of only files, causing behavior mismatch with native Bun.
Summary
Sets up a complete release pipeline using Craft for publishing to npm and GitHub Releases. Flattens the monorepo structure (moves
packages/cli/*to root) and consolidates CI workflows into a singleci.ymlwith lint, test, and multi-platform builds.npm package: Single-file ESM bundle (~165KB) that works standalone without dependencies. Replaced
fast-globwithtinyglobbyfor ESM compatibility and fixed the bundle to inline all npm packages (external: ["node:*"]). GitHub Releases: Native Bun-compiled binaries for darwin-arm64, darwin-x64, linux-arm64, linux-x64, and windows-x64. Cross-compilation enabled for platforms without available CI runners.CI improvements: Consolidated test workflows (removed duplicate
test.yml), added coverage reporting, propernode_modulescaching, and cross-compilation support via--targetflag for unavailable runners (macOS-13 retired, ARM runners not available for private repos).