| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,12 @@ | |||
| 1 | + { | ||
| 2 | + "name": "Sentry JavaScript SDK Development", | ||
| 3 | + "install": "curl https://get.volta.sh | bash && export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1 && yarn install", | ||
| 4 | + "start": "export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1", | ||
| 5 | + "terminals": [ | ||
| 6 | + { | ||
| 7 | + "name": "Development", | ||
| 8 | + "command": "export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1 && echo 'Volta setup complete. Node version:' && node --version && echo 'Yarn version:' && yarn --version", | ||
| 9 | + "description": "Main development terminal with Volta environment configured" | ||
| 10 | + } | ||
| 11 | + ] | ||
| 12 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,7 @@ description: Use this rule if you are looking to upgrade a dependency in the Sen | |||
| 3 | 3 | globs: | |
| 4 | 4 | alwaysApply: false | |
| 5 | 5 | --- | |
| 6 | + | ||
| 6 | 7 | # Yarn v1 Dependency Upgrades | |
| 7 | 8 | ||
| 8 | 9 | ## Upgrade Process | |
@@ -45,10 +46,12 @@ Avoid upgrading top-level dependencies (defined in `package.json`), especially i | |||
| 45 | 46 | **STOP UPGRADE IMMEDIATELY** if upgrading any dependency with `opentelemetry` in the name and the new version or any of its dependencies uses forbidden OpenTelemetry versions. | |
| 46 | 47 | ||
| 47 | 48 | **FORBIDDEN VERSION PATTERNS:** | |
| 49 | + | ||
| 48 | 50 | - `2.x.x` versions (e.g., `2.0.0`, `2.1.0`) | |
| 49 | 51 | - `0.2xx.x` versions (e.g., `0.200.0`, `0.201.0`) | |
| 50 | 52 | ||
| 51 | 53 | When upgrading OpenTelemetry dependencies: | |
| 54 | + | ||
| 52 | 55 | 1. Check the dependency's `package.json` after upgrade | |
| 53 | 56 | 2. Verify the package itself doesn't use forbidden version patterns | |
| 54 | 57 | 3. Verify none of its dependencies use `@opentelemetry/*` packages with forbidden version patterns | |
@@ -153,6 +156,7 @@ yarn info <package-name> versions | |||
| 153 | 156 | ``` | |
| 154 | 157 | ||
| 155 | 158 | The `yarn info` command provides detailed dependency information without requiring installation, making it particularly useful for: | |
| 159 | + | ||
| 156 | 160 | - Verifying OpenTelemetry packages don't introduce forbidden version patterns (`2.x.x` or `0.2xx.x`) | |
| 157 | 161 | - Checking what dependencies a package will bring in before upgrading | |
| 158 | 162 | - Understanding package version history and compatibility | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,12 +12,13 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by | |||
| 12 | 12 | **CRITICAL**: All changes must pass these checks before committing: | |
| 13 | 13 | ||
| 14 | 14 | 1. **Always run `yarn lint`** - Fix all linting issues | |
| 15 | - 2. **Always run `yarn test`** - Ensure all tests pass | ||
| 15 | + 2. **Always run `yarn test`** - Ensure all tests pass | ||
| 16 | 16 | 3. **Always run `yarn build:dev`** - Verify TypeScript compilation | |
| 17 | 17 | ||
| 18 | 18 | ## Development Commands | |
| 19 | 19 | ||
| 20 | 20 | ### Build Commands | |
| 21 | + | ||
| 21 | 22 | - `yarn build` - Full production build with package verification | |
| 22 | 23 | - `yarn build:dev` - Development build (transpile + types) | |
| 23 | 24 | - `yarn build:dev:watch` - Development build in watch mode (recommended) | |
@@ -26,13 +27,11 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by | |||
| 26 | 27 | - `yarn build:bundle` - Build browser bundles only | |
| 27 | 28 | ||
| 28 | 29 | ### Testing | |
| 29 | - - `yarn test` - Run all tests (excludes integration tests) | ||
| 30 | - - `yarn test:unit` - Run unit tests only | ||
| 31 | - - `yarn test:pr` - Run tests affected by changes (CI mode) | ||
| 32 | - - `yarn test:pr:browser` - Run affected browser-specific tests | ||
| 33 | - - `yarn test:pr:node` - Run affected Node.js-specific tests | ||
| 30 | + | ||
| 31 | + - `yarn test` - Run all unit tests | ||
| 34 | 32 | ||
| 35 | 33 | ### Linting and Formatting | |
| 34 | + | ||
| 36 | 35 | - `yarn lint` - Run ESLint and Prettier checks | |
| 37 | 36 | - `yarn fix` - Auto-fix linting and formatting issues | |
| 38 | 37 | - `yarn lint:es-compatibility` - Check ES compatibility | |
@@ -42,12 +41,17 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by | |||
| 42 | 41 | This repository uses **Git Flow**. See [docs/gitflow.md](docs/gitflow.md) for details. | |
| 43 | 42 | ||
| 44 | 43 | ### Key Rules | |
| 44 | + | ||
| 45 | 45 | - **All PRs target `develop` branch** (NOT `master`) | |
| 46 | 46 | - `master` represents the last released state | |
| 47 | 47 | - Never merge directly into `master` (except emergency fixes) | |
| 48 | 48 | - Avoid changing `package.json` files on `develop` during pending releases | |
| 49 | + - Never update dependencies, package.json content or build scripts unless explicitly asked for | ||
| 50 | + - When asked to do a task on a set of files, always make sure that all occurences in the codebase are covered. Double check that no files have been forgotten. | ||
| 51 | + - Unless explicitly asked for, make sure to cover all files, including files in `src/` and `test/` directories. | ||
| 49 | 52 | ||
| 50 | 53 | ### Branch Naming | |
| 54 | + | ||
| 51 | 55 | - Features: `feat/descriptive-name` | |
| 52 | 56 | - Releases: `release/X.Y.Z` | |
| 53 | 57 | ||
@@ -56,27 +60,33 @@ This repository uses **Git Flow**. See [docs/gitflow.md](docs/gitflow.md) for de | |||
| 56 | 60 | This is a Lerna monorepo with 40+ packages in the `@sentry/*` namespace. | |
| 57 | 61 | ||
| 58 | 62 | ### Core Packages | |
| 63 | + | ||
| 59 | 64 | - `packages/core/` - Base SDK with interfaces, type definitions, core functionality | |
| 60 | - - `packages/types/` - Shared TypeScript type definitions (active) | ||
| 65 | + - `packages/types/` - Shared TypeScript type definitions - this is deprecated, never modify this package | ||
| 61 | 66 | - `packages/browser-utils/` - Browser-specific utilities and instrumentation | |
| 67 | + - `packages/node-core/` - Node Core SDK which contains most of the node-specific logic, excluding OpenTelemetry instrumentation. | ||
| 62 | 68 | ||
| 63 | 69 | ### Platform SDKs | |
| 70 | + | ||
| 64 | 71 | - `packages/browser/` - Browser SDK with bundled variants | |
| 65 | - - `packages/node/` - Node.js SDK with server-side integrations | ||
| 72 | + - `packages/node/` - Node.js SDK. All general Node code should go into node-core, the node package itself only contains OpenTelemetry instrumentation on top of that. | ||
| 66 | 73 | - `packages/bun/`, `packages/deno/`, `packages/cloudflare/` - Runtime-specific SDKs | |
| 67 | 74 | ||
| 68 | 75 | ### Framework Integrations | |
| 76 | + | ||
| 69 | 77 | - Framework packages: `packages/{framework}/` (react, vue, angular, etc.) | |
| 70 | 78 | - Client/server entry points where applicable (nextjs, nuxt, sveltekit) | |
| 71 | 79 | - Integration tests use Playwright (Remix, browser-integration-tests) | |
| 72 | 80 | ||
| 73 | 81 | ### User Experience Packages | |
| 82 | + | ||
| 74 | 83 | - `packages/replay-internal/` - Session replay functionality | |
| 75 | 84 | - `packages/replay-canvas/` - Canvas recording for replay | |
| 76 | 85 | - `packages/replay-worker/` - Web worker support for replay | |
| 77 | 86 | - `packages/feedback/` - User feedback integration | |
| 78 | 87 | ||
| 79 | 88 | ### Development Packages (`dev-packages/`) | |
| 89 | + | ||
| 80 | 90 | - `browser-integration-tests/` - Playwright browser tests | |
| 81 | 91 | - `e2e-tests/` - End-to-end tests for 70+ framework combinations | |
| 82 | 92 | - `node-integration-tests/` - Node.js integration tests | |
@@ -88,41 +98,55 @@ This is a Lerna monorepo with 40+ packages in the `@sentry/*` namespace. | |||
| 88 | 98 | ## Development Guidelines | |
| 89 | 99 | ||
| 90 | 100 | ### Build System | |
| 101 | + | ||
| 91 | 102 | - Uses Rollup for bundling (`rollup.*.config.mjs`) | |
| 92 | 103 | - TypeScript with multiple tsconfig files per package | |
| 93 | 104 | - Lerna manages package dependencies and publishing | |
| 94 | 105 | - Vite for testing with `vitest` | |
| 95 | 106 | ||
| 96 | 107 | ### Package Structure Pattern | |
| 108 | + | ||
| 97 | 109 | Each package typically contains: | |
| 110 | + | ||
| 98 | 111 | - `src/index.ts` - Main entry point | |
| 99 | 112 | - `src/sdk.ts` - SDK initialization logic | |
| 100 | 113 | - `rollup.npm.config.mjs` - Build configuration | |
| 101 | 114 | - `tsconfig.json`, `tsconfig.test.json`, `tsconfig.types.json` | |
| 102 | 115 | - `test/` directory with corresponding test files | |
| 103 | 116 | ||
| 104 | 117 | ### Key Development Notes | |
| 118 | + | ||
| 105 | 119 | - Uses Volta for Node.js/Yarn version management | |
| 106 | 120 | - Requires initial `yarn build` after `yarn install` for TypeScript linking | |
| 107 | 121 | - Integration tests use Playwright extensively | |
| 108 | - - Native profiling requires Python <3.12 for binary builds | ||
| 122 | + - Never change the volta, yarn, or package manager setup in general unless explicitly asked for | ||
| 123 | + | ||
| 124 | + ### Notes for Background Tasks | ||
| 125 | + | ||
| 126 | + - Make sure to use [volta](https://volta.sh/) for development. Volta is used to manage the node, yarn and pnpm version used. | ||
| 127 | + - Make sure that [PNPM support is enabled in volta](https://docs.volta.sh/advanced/pnpm). This means that the `VOLTA_FEATURE_PNPM` environment variable has to be set to `1`. | ||
| 128 | + - Yarn, Node and PNPM have to be used through volta, in the versions defined by the volta config. NEVER change any versions unless explicitly asked to. | ||
| 109 | 129 | ||
| 110 | 130 | ## Testing Single Packages | |
| 131 | + | ||
| 111 | 132 | - Test specific package: `cd packages/{package-name} && yarn test` | |
| 112 | 133 | - Build specific package: `yarn build:dev:filter @sentry/{package-name}` | |
| 113 | 134 | ||
| 114 | 135 | ## Code Style Rules | |
| 136 | + | ||
| 115 | 137 | - Follow existing code conventions in each package | |
| 116 | 138 | - Check imports and dependencies - only use libraries already in the codebase | |
| 117 | 139 | - Look at neighboring files for patterns and style | |
| 118 | 140 | - Never introduce code that exposes secrets or keys | |
| 119 | 141 | - Follow security best practices | |
| 120 | 142 | ||
| 121 | 143 | ## Before Every Commit Checklist | |
| 144 | + | ||
| 122 | 145 | 1. ✅ `yarn lint` (fix all issues) | |
| 123 | 146 | 2. ✅ `yarn test` (all tests pass) | |
| 124 | 147 | 3. ✅ `yarn build:dev` (builds successfully) | |
| 125 | 148 | 4. ✅ Target `develop` branch for PRs (not `master`) | |
| 126 | 149 | ||
| 127 | 150 | ## Documentation Sync | |
| 128 | - **IMPORTANT**: When editing CLAUDE.md, also update .cursor/rules/sdk_development.mdc and vice versa to keep both files in sync. | ||
| 151 | + | ||
| 152 | + **IMPORTANT**: When editing CLAUDE.md, also update .cursor/rules/sdk_development.mdc and vice versa to keep both files in sync. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments