|
| 1 | +# Sentry JavaScript SDK |
| 2 | + |
| 3 | +Monorepo with 40+ packages in `@sentry/*`, managed with Yarn workspaces and Nx. |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +- [Volta](https://volta.sh/) for Node.js/Yarn/PNPM version management |
| 8 | +- Requires `VOLTA_FEATURE_PNPM=1` |
| 9 | +- After cloning: `yarn install && yarn build` |
| 10 | +- Never change Volta, Yarn, or package manager versions unless explicitly asked |
| 11 | + |
| 12 | +## Package Manager |
| 13 | + |
| 14 | +Use **yarn**: `yarn install`, `yarn build:dev`, `yarn test`, `yarn lint` |
| 15 | + |
| 16 | +| Command | Purpose | |
| 17 | +| ------------------------------------- | ----------------------------- | |
| 18 | +| `yarn build` | Full production build | |
| 19 | +| `yarn build:dev` | Dev build (transpile + types) | |
| 20 | +| `yarn build:dev:filter @sentry/<pkg>` | Build one package + deps | |
| 21 | +| `yarn build:bundle` | Browser bundles only | |
| 22 | +| `yarn test` | All unit tests | |
| 23 | +| `yarn lint` | ESLint + Oxfmt | |
| 24 | +| `yarn fix` | Auto-fix lint + format | |
| 25 | +| `yarn format` | Auto-fix formatting (Oxfmt) | |
| 26 | + |
| 27 | +Single package: `cd packages/<name> && yarn test` |
| 28 | + |
| 29 | +## Commit Attribution |
| 30 | + |
| 31 | +AI commits MUST include: |
| 32 | + |
| 33 | +``` |
| 34 | +Co-Authored-By: <agent model name> <noreply@anthropic.com> |
| 35 | +``` |
| 36 | + |
| 37 | +## Git Workflow |
| 38 | + |
| 39 | +Uses **Git Flow** (see `docs/gitflow.md`). |
| 40 | + |
| 41 | +- **All PRs target `develop`** (NOT `master`) |
| 42 | +- `master` = last released state — never merge directly |
| 43 | +- Feature branches: `feat/descriptive-name` |
| 44 | +- Never update dependencies, `package.json`, or build scripts unless explicitly asked |
| 45 | + |
| 46 | +## Before Every Commit |
| 47 | + |
| 48 | +1. `yarn format` |
| 49 | +2. `yarn lint` |
| 50 | +3. `yarn test` |
| 51 | +4. `yarn build:dev` |
| 52 | +5. NEVER push on `develop` |
| 53 | + |
| 54 | +## Architecture |
| 55 | + |
| 56 | +### Core |
| 57 | + |
| 58 | +- `packages/core/` — Base SDK: interfaces, types, core functionality |
| 59 | +- `packages/types/` — Shared types (**deprecated, never modify – instead find types in packages/core**) |
| 60 | +- `packages/browser-utils/` — Browser utilities and instrumentation |
| 61 | +- `packages/node-core/` — Node core logic (excludes OTel instrumentation) |
| 62 | + |
| 63 | +### Platform SDKs |
| 64 | + |
| 65 | +- `packages/browser/` — Browser SDK + CDN bundles |
| 66 | +- `packages/node/` — Node.js SDK (OTel instrumentation on top of node-core) |
| 67 | +- `packages/bun/`, `packages/deno/`, `packages/cloudflare/` |
| 68 | + |
| 69 | +### Framework Integrations |
| 70 | + |
| 71 | +- `packages/{framework}/` — React, Vue, Angular, Next.js, Nuxt, SvelteKit, Remix, etc. |
| 72 | +- Some have client/server entry points (nextjs, nuxt, sveltekit) |
| 73 | + |
| 74 | +### AI Integrations |
| 75 | + |
| 76 | +- `packages/core/src/tracing/{provider}/` — Core instrumentation |
| 77 | +- `packages/node/src/integrations/tracing/{provider}/` — Node.js integration + OTel |
| 78 | +- `packages/cloudflare/src/integrations/tracing/{provider}.ts` — Edge runtime |
| 79 | +- See `.cursor/rules/adding-a-new-ai-integration.mdc` for implementation guide |
| 80 | + |
| 81 | +### User Experience |
| 82 | + |
| 83 | +- `packages/replay-internal/`, `packages/replay-canvas/`, `packages/replay-worker/` — Session replay |
| 84 | +- `packages/feedback/` — User feedback |
| 85 | + |
| 86 | +### Dev Packages (`dev-packages/`) |
| 87 | + |
| 88 | +- `browser-integration-tests/` — Playwright browser tests |
| 89 | +- `e2e-tests/` — E2E tests (70+ framework combos) |
| 90 | +- `node-integration-tests/` — Node.js integration tests |
| 91 | +- `test-utils/` — Shared test utilities |
| 92 | +- `rollup-utils/` — Build utilities |
| 93 | + |
| 94 | +## Coding Standards |
| 95 | + |
| 96 | +- Follow existing conventions — check neighboring files |
| 97 | +- Only use libraries already in the codebase |
| 98 | +- Never expose secrets or keys |
| 99 | +- When modifying files, cover all occurrences (including `src/` and `test/`) |
| 100 | + |
| 101 | +## Skills |
| 102 | + |
| 103 | +### E2E Testing |
| 104 | + |
| 105 | +Use `/e2e` skill to run E2E tests. See `.claude/skills/e2e/SKILL.md` |
| 106 | + |
| 107 | +### Security Vulnerabilities |
| 108 | + |
| 109 | +Use `/fix-security-vulnerability` skill for Dependabot alerts. See `.claude/skills/fix-security-vulnerability/SKILL.md` |
| 110 | + |
| 111 | +### Issue Triage |
| 112 | + |
| 113 | +Use `/triage-issue` skill. See `.claude/skills/triage-issue/SKILL.md` |
| 114 | + |
| 115 | +### CDN Bundles |
| 116 | + |
| 117 | +Use `/add-cdn-bundle` skill. See `.claude/skills/add-cdn-bundle/SKILL.md` |
0 commit comments