Skip to content

fix(scaffold): pin client_app deps to framework version + resolve module imports from host - #120

Merged
antosubash merged 2 commits into
mainfrom
claude/fix-github-issues-Nm6fb
May 3, 2026
Merged

fix(scaffold): pin client_app deps to framework version + resolve module imports from host#120
antosubash merged 2 commits into
mainfrom
claude/fix-github-issues-Nm6fb

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

Two scaffold fixes targeting open issues:

  • sm new scaffold pins ^0.0.3 npm deps and ==0.0.7 python deps even when 0.0.8 is published; npm caret on 0.0.x silently blocks the bump #119client_app/package.json.tpl hard-coded ^0.0.3 pins for @simple-module-py/{ui,i18n}. Per npm semver, caret on a 0.0.x version 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 that create_host substitutes 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).
  • Module wheels declare empty 'dependencies' but their .tsx imports lucide-react/sonner directly; Makefile never runs sm host sync-js-deps #116 (vite resolution) — module .tsx files live in .venv/.../site-packages/<mod>/, and vite's resolver walks UP from the importing file to find node_modules/ — but the host's node_modules/ lives in client_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 a pre resolver plugin in 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.

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/ — clean
  • uv run ruff format --check framework/cli/ — clean
  • Smoke: uvx --from <built-wheel> sm new my-app --yes --no-install, then verify client_app/package.json shows the CLI's version (not ^0.0.3) and npm run dev resolves bare imports from a venv-installed module's .tsx

https://claude.ai/code/session_01LmSbHXftZJ2p8vGs1TGYBZ


Generated by Claude Code

…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
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 2, 2026

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

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

View logs

… 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
antosubash marked this pull request as ready for review May 3, 2026 14:41
@antosubash
antosubash merged commit b74ed15 into main May 3, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants