sentry-wizard icon indicating copy to clipboard operation
sentry-wizard copied to clipboard

feat(cloudflare): Enable update of the wrangler file

Open JPeer264 opened this issue 1 week ago • 3 comments

(closes #1148)

This PR will update the wrangler config automagically. The wrangler config can exist in .toml, .json and .jsonc (source) that is why I added ~smol-toml (BSD-3) and~ jsonc-parser (MIT).

These are the new steps:

  1. Wrangler config does not exist: We create a minimal jsonc config with the minimum required keys (also jsonc is recommended for new projects)
    • On top we instruct that the name and the main line has to be changed
  2. Wrangler config does exist in either format: It adds Sentry specifics
    • For .toml we add a copy paste snippet

For now we add:

  • nodejs_als instead of nodejs_compat to keep the bundle size smaller, and it is not yet required
  • compatibility_date to the date of creation (suggested by the Cloudflare docs)
  • And our required version_metadata

Drawbacks

~Toml parsers are not quite popular and are not really feature complete, that is why toml files would loose all comments, once we update them (another option would be to not support .toml at all and give only a hint)~ (the toml parser has been removed)

JPeer264 avatar Dec 16 '25 15:12 JPeer264