Skip to content

feat(sveltekit): Add Support for SvelteKit SDK setup#251

Merged
Lms24 merged 10 commits intomasterfrom
lms/sveltekit-support
May 3, 2023
Merged

feat(sveltekit): Add Support for SvelteKit SDK setup#251
Lms24 merged 10 commits intomasterfrom
lms/sveltekit-support

Conversation

@Lms24
Copy link
Copy Markdown
Member

@Lms24 Lms24 commented Apr 19, 2023

This PR adds full support for setting up the SvelteKit SDK with the wizard:

npx sentry-wizard -i sveltekit

This includes:

  • Logging in to sentry, obtaining project/org config and auth token
  • Adding/modifying the necessary SvelteKit files
    • hooks.(client|server).(js|ts)
    • vite.config.(js|ts)
  • Reading configuration from svelte.config.js
  • Adding an example page to send a first error to Sentry

closes #244

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 19, 2023

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 66da979

@Lms24 Lms24 force-pushed the lms/sveltekit-support branch 2 times, most recently from 753065f to f37bfe4 Compare April 21, 2023 10:32
Lms24 added 8 commits May 3, 2023 09:22
adds the creation of Sentry CLI config files to the SvelteKit SDK setup
Add basic SDK setup code generation to the wizard. 

During SDK setup, we distinguish between two cases for each SvelteKit (client and server) hook file:
* If no hook file exists, we can just copy our hooks file template with the complete instrumentation. Great! 🎉
* If there is a pre-existing hooks file, we partially merge it with a Sentry import and init call and request additional manual intervention from the user
To respect custom hooks file locations that users can specifiy in `svelte.config.js`, we import the svelte config and use these custom paths if they're available. Otherwise, we fall back to the default paths.
…#257)

Replace the "old" init call injection approach with using magicast to modify the file
…oks (#259)

Add our handlers to the `handle` and `handleError` hooks in the SveltKit hooks files. Uses magicast and advanced AST manipulation to merge user-defined handlers with ours.
Converts the CLI appearance to use the `clack` library. Rewriting the flow to the new NextJS wizard flow.
@Lms24 Lms24 force-pushed the lms/sveltekit-support branch from 0135845 to 4dea9d3 Compare May 3, 2023 07:24
Update the usage of `sentryHandle` in the wizard after the breaking change in 7.50.0 where we converted it to a factory function.
@Lms24 Lms24 force-pushed the lms/sveltekit-support branch from 4dea9d3 to a3fe2df Compare May 3, 2023 07:26
Add the creation of a sample SvelteKit route with a page and an API route to send example frontend and backend errors (+ a transaction) to Sentry.
@Lms24 Lms24 marked this pull request as ready for review May 3, 2023 07:33
@Lms24 Lms24 requested review from AbhiPrasad and lforst May 3, 2023 07:33
@Lms24 Lms24 merged commit 3fd172f into master May 3, 2023
@Lms24 Lms24 deleted the lms/sveltekit-support branch May 3, 2023 07:43
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.

Support SvelteKit SDK Setup

2 participants