fix(scaffold,ui): unbreak fresh-install module pages + scaffold workspace (#110-#117) - #118
Merged
Merged
Conversation
…pace (#110-#117) * packages/ui: move lucide-react, sonner, radix-ui, and 11 other runtime imports out of peerDependencies into dependencies so a host that pulls in @simple-module-py/ui actually gets them installed; only React/Inertia stay as peers (singletons). Drop the catch-all "./*": "./src/*" exports entry and pin every subpath ("./components/*", "./layouts/*", etc.) to its real .tsx/.ts target with a types conditional, fixing vite resolve failures from module pages. (#114, #115, #110) * modules/{users,dashboard,permissions,feature_flags,background_tasks, file_storage}: declare lucide-react and/or sonner as dependencies — the modules import these directly, but every wheel was shipping "dependencies": {} so `sm host sync-js-deps` had nothing to install. Wire sync-js-deps into the scaffolded Makefile's `install` target so a fresh `sm new` host gets module JS deps without a manual extra step. (#116) * sm new: default to a workspace layout — scaffold modules/hello/ as a working authoring template (module.py + settings.py + endpoints/api.py), add [tool.uv.workspace] members=["modules/*"] + a workspace source for the sample, and "workspaces": ["client_app", "modules/*"] in package.json so npm + vite resolve module .tsx files naturally. New --flat flag preserves the legacy single-host layout. The module template gained a settings.py.tpl (module.py.tpl was already importing it) and pydantic-settings as a dep. (#117) #111 (SM017 pointing inside .venv/site-packages) was already fixed in #113 and is covered by test_silent_when_module_lives_in_site_packages — no code change needed.
Deploying simple-module-python with |
| Latest commit: | 3244e4c |
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3eb97934.simple-module-python.pages.dev |
| Branch Preview URL: | https://feature-compassionate-robins.simple-module-python.pages.dev |
Review feedback on #118: - _inject_py_deps had two correlated booleans (workspace_sources, drop_workspace); collapse to a single flat: bool and rename the helper to _rewrite_pyproject since it now configures the uv workspace too, not just deps. - Reuse _module_to_pypi_name from scaffolding.py instead of re-templating simple_module_{_SAMPLE_MODULE_NAME} inline. - Trim WHAT-narration comments in the host pyproject template and drop the duplicated lookup in the helper.
ty narrowed the literal-dict branch to dict[str, str | bool] and rejected the data['workspaces'] = list assignment. Explicit annotation widens it.
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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
Addresses the open frontend / scaffold issues that compose into a single broken-out-of-the-box experience for
sm new0.0.7.packages/uimoves 14 third-party runtime imports (lucide-react, sonner, radix-ui, recharts, …) frompeerDependencies→dependencies. Only React/ReactDOM/Inertia stay as peers (host singletons). Hosts now get the deps automatically when they install@simple-module-py/ui.packages/uiexports map. Drop the broken"./*": "./src/*"catch-all and pin every subpath (./components/*,./components/ui/*,./layouts/*,./hooks/*,./lib/*,./styles/*,./types) to its real.tsx/.tstarget with atypesconditional. Vite + Node resolve subpath imports from module pages cleanly.lucide-react/sonnerdirectly (users, dashboard, permissions, feature_flags, background_tasks, file_storage) now declares them independencies, so wheel-installed modules carry the infosm host sync-js-depsreads. Wiresync-js-depsinto the scaffoldedMakefile'sinstalltarget so a freshsm newhost gets module JS deps without the user discovering an undocumented extra step.sm newnow defaults to a workspace layout. Scaffoldsmodules/hello/as a working authoring template, adds[tool.uv.workspace] members = [\"modules/*\"]and a workspace[tool.uv.sources]entry for the sample, and\"workspaces\": [\"client_app\", \"modules/*\"]inpackage.json. New--flatflag preserves the legacy single-host layout. The module template gained asettings.py.tpl(the existingmodule.py.tplwas already importing one) andpydantic-settingsas a dep.test_silent_when_module_lives_in_site_packages). The issue was not auto-closed — flagging here for closure, no code change.Test plan
uv run pytest framework/— 416 passeduv run pytest framework/cli/tests/test_cli_new.py— 17 passed (4 new tests for workspace mode +--flat)ruff checkandruff format --checkclean on all changed Python filespackage.jsonfiles parse as valid JSONuv run sm new myapp --yes --no-installproducesmodules/hello/with module.py + settings.py + endpoints/api.py + tests, top-level pyproject has[tool.uv.workspace]and[tool.uv.sources.simple_module_hello], top-level package.json has\"workspaces\".uv run sm new myapp --yes --flat --no-installskipsmodules/, omits workspace plumbing.make install && make migrate && make devproduces a running app whose module pages render in vite withoutFailed to resolveerrors. (Requiresnpm install; not runnable in worktree.)Closes#110, #114, #115, #116, #117. Resolves#111.