fix(create): generate valid Sentry app scripts #560
main fromrefs/pull/560/head·merged by tannerlinsley A new React app with the Sentry add-on generated invalid build and dev commands. The EJS template HTML-escaped shell operators and quotes before writing them into package.json. The template now emits JSON strings with the intended shell syntax. The demo error component also handles the router’s unknown error type so the generated app passes TypeScript.
The current pinned Nitro version supports the existing top-level Rollup configuration, so this leaves the Nitro plugin options alone. Related to #457.
Checks#
- The normal hook passed 10 builds, 558 unit tests, and eight blocking Chrome tests. The partner add-on test covers the generated build and dev strings, and existing Vercel cases still pass.
- Fresh React apps with Sentry and Nitro, Railway, and Render built and typechecked outside the monorepo. The generic Nitro app served the demo route through both generated start and dev commands on localhost.
- No provider calls, deploy commands, or credentials were involved.
Summary by CodeRabbit#
- Bug Fixes
- The Sentry demo now shows a fallback message when an error is thrown without a message, instead of failing to display the error.
- New Features
- React projects created with the Sentry add-on now receive build and development scripts that work with the add-on’s instrumentation setup. The build process also includes the server instrumentation file in the generated output, and development runs with instrumentation enabled.
- 1
No actionable comments were generated in the recent review.
Walkthrough
-
The Sentry add-on updates generated React build and development scripts, adds scaffold test expectations for those scripts, and displays a fallback message when the demo route receives a non-Error value.
Changes: Sentry add-on
Layer / File(s) Summary Generated scripts and scaffold checks
packages/create/src/frameworks/react/add-ons/sentry/package.json.ejs,packages/create/tests/partner-addons.test.ts,.changeset/sentry-package-scripts.mdThe script templates emit raw JSON.stringifyoutput. The scaffold test checks that the build script copies the instrumentation file and that the development script imports it throughNODE_OPTIONS. The changeset records the script and demo error changes.Demo route error handling
packages/create/src/frameworks/react/add-ons/sentry/assets/src/routes/demo/sentry.testing.tsxThe route displays error.messageforErrorvalues and “The Sentry demo could not load.” for other thrown values.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Merge Risk:
Minimal · up toe81fc-
The generated Sentry scripts reference the emitted instrumentation file correctly, and the demo route safely handles unknown errors. No merge-blocking risk is established.
Pre-merge checks:
5-
Check name Status Explanation Description Check Check skipped - CodeRabbit’s high-level summary is enabled. Title check The title "fix(create): generate valid Sentry app scripts" matches the main change. The PR fixes the build and dev scripts that the Sentry add-on generates into package.json. The template previously H… Docstring Coverage No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title "fix(create): generate valid Sentry app scripts" matches the main change. The PR fixes the build and dev scripts that the Sentry add-on generates into package.json. The template previously HTML-escaped shell operators and quotes, and now emits JSON.stringify output unescaped. The demo error route also gets a fix for non-Error thrown values, which the title does not name but which is a secondary change.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (2 skipped: 2 unsupported.)
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
ESLint-
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
packages/create/tests/partner-addons.test.ts
-
Parsing error: "parserOptions.project" has been provided for
@typescript-eslint/parser. The file was not found in any of the provided project(s): packages/create/tests/partner-addons.test.ts
-
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
7bf8d6f4-b1c9-4cf4-98a3-4649c06b623b
Commits-
Reviewing files that changed from the base of the PR and between 9fe6af85b1c0029d8f3e244020ce2df25c6ee647 and e81fc9da570872b4a6bd492e45bc3e4c6a8b4ce5.
Files selected for processing: 4-
.changeset/sentry-package-scripts.mdpackages/create/src/frameworks/react/add-ons/sentry/assets/src/routes/demo/sentry.testing.tsxpackages/create/src/frameworks/react/add-ons/sentry/package.json.ejspackages/create/tests/partner-addons.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
-
-
tannerlinsley merged thisb42d225
tannerlinsley closed this
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: e81fc9da570872b4a6bd492e45bc3e4c6a8b4ce5
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR