From 7eefcbcb8b0c1274531dad85ebfad2cb4e5cfbf9 Mon Sep 17 00:00:00 2001 From: s1gr1d Date: Tue, 1 Jul 2025 13:31:39 +0200 Subject: [PATCH 1/2] fix(nuxt): Add `@sentry/cloudflare` as optional peerDependency --- docs/creating-a-new-sdk.md | 30 ++++++++++++++++++++++++++++++ packages/nuxt/package.json | 10 ++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/docs/creating-a-new-sdk.md b/docs/creating-a-new-sdk.md index 549f224d5cc4..91bb11bf3daa 100644 --- a/docs/creating-a-new-sdk.md +++ b/docs/creating-a-new-sdk.md @@ -144,3 +144,33 @@ provide an abstraction layer of options that we expose on top of that. We generally want to support Node runtimes for the server. However, sometimes there may be alternate runtimes that may be supported, e.g. Cloudflare Workers or Vercel Edge Functions. We generally do not need to support these in an MVP, but may decide to support them later. + +#### Cloudflare Workers/Pages + +To add support for Cloudflare Workers or Pages in a specific SDK, you need to do the following: + +1. Add `@sentry/cloudflare` as an optional peer dependency to the `package.json` of the SDK. + This ensures that users who want to use the SDK with Cloudflare will install the necessary package, but it won't be a requirement for users on other platforms. + + ```json + "peerDependencies": { + "@sentry/cloudflare": ">=9.33.0" + }, + "peerDependenciesMeta": { + "@sentry/cloudflare": { + "optional": true + } + } + ``` + +2. Add `@sentry/cloudflare` to the `devDependencies` in the SDK's `package.json`. + This is necessary for local development and testing, allowing you to use the Cloudflare-specific APIs in the development environment. + + ```json + "devDependencies": { + "@sentry/cloudflare": "9.33.0", + } + ``` + +3. Add documentation to the [Cloudflare Frameworks docs](https://docs.sentry.io/platforms/javascript/guides/cloudflare/frameworks/) explaining how to set up the SDK for Cloudflare Workers/Pages. + This documentation should include instructions for users to add the `@sentry/cloudflare` package to their project. You can then link to the main Cloudflare SDK documentation from the framework-specific docs. diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 47386983dfd7..47beff4a0884 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -43,12 +43,17 @@ "access": "public" }, "peerDependencies": { - "nuxt": ">=3.7.0 || 4.x" + "nuxt": ">=3.7.0 || 4.x", + "@sentry/cloudflare": ">=9.34.0" + }, + "peerDependenciesMeta": { + "@sentry/cloudflare": { + "optional": true + } }, "dependencies": { "@nuxt/kit": "^3.13.2", "@sentry/browser": "9.34.0", - "@sentry/cloudflare": "9.34.0", "@sentry/core": "9.34.0", "@sentry/node": "9.34.0", "@sentry/rollup-plugin": "^3.5.0", @@ -57,6 +62,7 @@ }, "devDependencies": { "@nuxt/module-builder": "^0.8.4", + "@sentry/cloudflare": "9.34.0", "nuxt": "^3.13.2" }, "scripts": { From e7d3e8485f998e3f330d749b9207f6c8a70b5bf7 Mon Sep 17 00:00:00 2001 From: s1gr1d Date: Tue, 1 Jul 2025 14:21:15 +0200 Subject: [PATCH 2/2] add clearer docs --- docs/creating-a-new-sdk.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/creating-a-new-sdk.md b/docs/creating-a-new-sdk.md index 91bb11bf3daa..5ed201681d54 100644 --- a/docs/creating-a-new-sdk.md +++ b/docs/creating-a-new-sdk.md @@ -173,4 +173,5 @@ To add support for Cloudflare Workers or Pages in a specific SDK, you need to do ``` 3. Add documentation to the [Cloudflare Frameworks docs](https://docs.sentry.io/platforms/javascript/guides/cloudflare/frameworks/) explaining how to set up the SDK for Cloudflare Workers/Pages. - This documentation should include instructions for users to add the `@sentry/cloudflare` package to their project. You can then link to the main Cloudflare SDK documentation from the framework-specific docs. + This documentation should include instructions for users to add the `@sentry/cloudflare` package to their project. + You can then link from the framework-specific docs pages to the Cloudflare SDK docs page by adding an entry to "Next Steps" on the "Getting Started" and "Manual Setup" pages.