fix(scaffold): pin client_app deps to framework version + resolve module imports from host - #120
Merged
Merged
Conversation
…ule imports from host (#119, #116) - #119: client_app/package.json template hard-coded ^0.0.3 for @simple-module-py/{ui,i18n}. Caret on a 0.0.x version is locked to that exact patch, so a stale pin silently downgrades fresh installs even when newer versions ship the fixes they need. Substitute the running CLI's own framework version into the template at scaffold time so the pin always matches the rest of the wheel set. - #116 (vite resolution): module .tsx files live in .venv/.../site-packages/<mod>/ and vite's resolver walks up looking for node_modules/ — but the host's node_modules/ is in client_app/, a sibling of the venv, not an ancestor. Add a 'pre' resolver plugin to the scaffold's vite.config.ts that re-roots bare-import resolution at the host's node_modules whenever the importer lives outside the project. Generic — works for any module dep without per-package alias plumbing. https://claude.ai/code/session_01LmSbHXftZJ2p8vGs1TGYBZ
Deploying simple-module-python with
|
| Latest commit: |
ad8adad
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://554c2a49.simple-module-python.pages.dev |
| Branch Preview URL: | https://claude-fix-github-issues-nm6.simple-module-python.pages.dev |
… regression test - vite.config.ts: remove unused `moduleRoots` array; memoize `hostRequire.resolve` so repeat bare specifiers (`react`, `lucide-react`, `@simple-module-py/ui`, …) skip the FS walk on every transform. - test_cli_new.py: read the expected version via importlib.metadata instead of importing the private `_FRAMEWORK_VERSION` symbol; drop the ticket-narrating docstring. https://claude.ai/code/session_01LmSbHXftZJ2p8vGs1TGYBZ
antosubash
marked this pull request as ready for review
May 3, 2026 14:41
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.
Summary
Two scaffold fixes targeting open issues:
client_app/package.json.tplhard-coded^0.0.3pins for@simple-module-py/{ui,i18n}. Per npm semver, caret on a0.0.xversion is locked to that exact patch, so a stale pin silently downgrades fresh installs even when newer wheels ship the fixes they need. Now the template carries a{{FRAMEWORK_VERSION}}placeholder thatcreate_hostsubstitutes from the running CLI's own version, so the scaffold always pins matching versions. Added a regression test (test_sm_new_pins_client_app_simple_module_deps_to_framework_version)..tsxfiles live in.venv/.../site-packages/<mod>/, and vite's resolver walks UP from the importing file to findnode_modules/— but the host'snode_modules/lives inclient_app/, a sibling of the venv, not an ancestor. So bare imports from module pages (@simple-module-py/ui,lucide-react, …) fail with "could not be resolved" even though the host has them installed. Added apreresolver plugin in the scaffold'svite.config.tsthat re-roots bare-import resolution at the host'snode_moduleswhenever the importer lives outside the project. Generic — works for any module dep without per-package alias plumbing.Issue #117 (full workspace restructure with a
host/subdirectory) is a larger reshape and out of scope here.Test plan
uv run pytest framework/cli/tests/— 102 passed (includes new regression test)uv run ruff check framework/cli/— cleanuv run ruff format --check framework/cli/— cleanuvx --from <built-wheel> sm new my-app --yes --no-install, then verifyclient_app/package.jsonshows the CLI's version (not^0.0.3) andnpm run devresolves bare imports from a venv-installed module's.tsxhttps://claude.ai/code/session_01LmSbHXftZJ2p8vGs1TGYBZ
Generated by Claude Code