Add `nx add preact` to configure Preact in an existing project
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
Start with nexy/modules/cli/commands/add.py and the existing nx add vercel behavior in issue #671. Read the shared web templates at nexy/modules/cli/templates/_shared/web/package.json.jinja2 and vite.config.ts.jinja2, plus issue #660 for the framework rule. Done means the command preserves existing settings, is idempotent, configures a Preact route for development and production, and has the requested tests and documentation.
Written by the indexing model from the issue text.
Description
Problem
Adding Preact to an existing Nexy project is manual. A developer has to edit nexyconfig.py, install the Preact packages, write vite.config.ts, and decide whether the project needs client-side rendering. A small mistake gives an unstyled page or a failed server render, with no clear error.
Proposed solution
Add nx add preact (also available as nexy add preact) that configures Preact in an existing project:
- Add
from nexy.frontend import preactanduseFF = preact()tonexyconfig.pywithout removing other settings. - Add
preact,@preact/preset-vite, andpreact-render-to-stringwith the versions fromnexy/modules/cli/templates/_shared/web/package.json.jinja2topackage.json. - Write or update
vite.config.tswith the Preact plugin fromnexy/modules/cli/templates/_shared/web/vite.config.ts.jinja2, preserving edits the developer already made. - Set
useCSRonly for the mode the project needs, and respect the one framework rule from issue #660. - Print every file changed, skip files that already have the wanted content, and leave the project unchanged on a second run, like
nx add vercel.
Acceptance criteria:
- Running the command twice produces no further changes.
- Existing
nexyconfig.py,package.json, andvite.config.tssettings are preserved. - A generated project builds and serves a Preact route in dev and production.
- Tests cover the config edit, package list, Vite config, conflict handling, and idempotency.
- The CLI reference and a dedicated docs page describe the command.
Alternative solutions
Keep the manual setup in the docs only, or extend nx new --framework preact. Both help new projects but do not help someone who already has a project and wants Preact added later.
Additional context
The command should follow the file writing behavior of nx add vercel (issue #671): data describing the generated files, no framework dependency added to the core, and no overwrite of a file the developer owns. The relevant templates are under nexy/modules/cli/templates/_shared/web/; the current add command is nexy/modules/cli/commands/add.py.
Validation
- I have searched existing issues and this is not a duplicate.
- I would be willing to help implement this feature.
- Dominant language
- Python
- Stars
- 11
- Forks
- 6
- Avg merge
- 2h 14m
- Merged PRs (30d)
- 265
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NexyPy/nexy
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area:cli difficulty:intermediate enhancement
Difficulty 2/5 Half a day Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
area:cli area:docs question
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area:docs difficulty:beginner good first issue priority:3
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
area:docs difficulty:beginner good first issue priority:3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
jxxghp/MoviePilot#7699 ·
Maintainers usually reply within 1 day
-
bug TAG: unit tests
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
learningequality/ricecooker#898 ·
-
next
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
j3ko/agent-plugins#80 ·
Maintainers usually reply within 1 day
-
bug:unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Heroic-Games-Launcher/HeroicGamesLauncher#6187 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
BCStudentSoftwareDevTeam/cas#491 ·
Maintainers usually reply within 8 days