feat(cli): detect Lynx (rspeedy) projects in rozenite init - #504
Merged
Merged
Conversation
`rozenite init` now recognizes an rspeedy/Rsbuild project (via lynx.config.ts/js, or @lynx-js/rspeedy in package.json), installs @rozenite/lynx, and adds rozeniteLynxPlugin() to the plugins array in lynx.config.ts, mirroring Metro/Re.Pack support. It also prints a reminder to turn on Lynx DevTool, and the project-detection gate no longer rejects Lynx projects for lacking a react-native dependency. Closes #493 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018XyA3ckZz2ZFvmH659mBAT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
rozenite initnow detects rspeedy/Rsbuild (Lynx) projects, installs@rozenite/lynx, and wires it intolynx.config.ts— the same experience it already gives Metro and Re.Pack projects, instead of the previous "Could not determine bundler type" dead end.getAvailableBundlerTypes(@rozenite/tools) gains alynxmember, detected vialynx.config.ts/lynx.config.jsor an@lynx-js/rspeedydependency inpackage.json.rozenite init's project-detection gate no longer rejects Lynx projects: it previously required"react-native"to appear inpackage.json, which a pure Lynx project never has.wrapConfigFileaddsimport { rozeniteLynxPlugin } from '@rozenite/lynx/rspeedy';and insertsrozeniteLynxPlugin()into thepluginsarray oflynx.config.ts, matching the same import-style/quote-style detection Metro and Re.Pack use.initprints a reminder to turn on Lynx DevTool, since it's off by default and nothing is discoverable without it.lynx.config.ts.rozenite initdoesn't cover rspeedy yet" caveat from the getting-started docs.Related Issue
Closes #493
Context
Metro/Re.Pack configs are wrapped by wrapping the whole config export (
withRozenite(config)), but rspeedy'slynx.config.tsdeclares plugins as a list (plugins: [pluginReactLynx(), ...]) rather than composing around the exported object — see the Rozenite for Lynx manual-install docs. So the Lynx path insertsrozeniteLynxPlugin()as the last entry of thatpluginsarray instead of reusing the export-wrapping regexes, using a small bracket-matching helper (skipping over strings/comments) to find the array's end reliably even when a plugin call itself contains braces, template literals, or comments — whichcreate-rspeedy's scaffolded config does.Testing
Automated:
pnpm checks:affected(typecheck, lint, format) — passingpnpm test:affected— passing, including new tests:packages/tools/src/__tests__/project-type.test.ts— Lynx detection via config file /package.jsondependency, and mixed-bundler workspacespackages/cli/src/__tests__/is-project.test.ts— the project gate now accepts Lynx projectspackages/cli/src/__tests__/config-wrapper.test.ts— newlynxdescribe block covering a basic config, an emptyplugins: [], an already-configured config (no-op), a missing config file, a missingpluginsarray, and a real-world config (mirroringcreate-rspeedy's react template, with nested braces/template literals/comments inside a plugin call) to make sure the bracket matcher doesn't get confusedManual verification:
npx create-rspeedy@0.16.4 . --template react.initcommand against it end-to-end: it installed@rozenite/lynx, rewrotelynx.config.tsto add the plugin, and printed the Lynx DevTool reminder.lynx.config.tstypechecks (tsc --noEmit) and thatnpx rspeedy devboots against it, logging[Rozenite] No plugins found.— proof the plugin is wired in and running.🤖 Generated with Claude Code
https://claude.ai/code/session_018XyA3ckZz2ZFvmH659mBAT
Generated by Claude Code