fix: scaffolded-project path assumptions (#283, #284, #287, #288) - #289
Open
antosubash wants to merge 2 commits into
Open
fix: scaffolded-project path assumptions (#283, #284, #287, #288)#289antosubash wants to merge 2 commits into
antosubash wants to merge 2 commits into
Conversation
Four reports from a `sm new project` scaffold, all the same root cause: the framework assumed its own monorepo layout, where a module's directory and assembly are both `SimpleModule.<Module>`. `sm new module` scaffolds a bare `<Module>` for both. Page bundle 404 (#287) The client guessed `_content/SimpleModule.<Module>/`, but an RCL serves its assets under its AssemblyName, so every scaffolded module 404'd on first load. The renderer now declares the module name -> assembly name mapping in the page shell and the resolver reads it, so the first request goes to the path that actually serves the bundle. Probing remains as a fallback for shells that predate the map. The same prefix assumption also kept a bare-named module's stylesheet from ever being linked; module CSS discovery now consults the same mapping. types.ts written to a directory no project owns (#283, #284) extract-ts-types.mjs hardcoded `SimpleModule.<Module>` as the output project and created it unconditionally. It now resolves the project directory that actually exists and skips modules with no local source, so NuGet-installed modules no longer materialise phantom source trees in a consumer's repo and deleting a module no longer resurrects one. Removes the orphan modules/Identity/src/SimpleModule.Identity/, which held only a generated types.ts for a contracts-only module and belonged to no project. Tailwind never recompiled for new pages (#288) Styles/app.css declares module pages as @source globs, but the MSBuild target did not treat them as inputs, so a new page's utility classes were silently never generated. Module Pages/Views, the host ClientApp, and the staged module bundles are now inputs, with @(TailwindExtraSourceFiles) as an extension point. Verified: reproduced the stale-CSS failure on unmodified main and confirmed the fix compiles the class; exercised the extraction script against both layouts and a package-only module; confirmed the shell mapping and a single 200 for the page bundle in a browser. Full suite green (20 assemblies), npm run check clean.
…s error Follow-up to the review on #289. Tailwind up-to-date check was still incomplete. `Styles/app.css` declares five @source roots; only the module pages and ClientApp were tracked, so editing `packages/SimpleModule.UI` — the most-edited shared code in the repo — left the compiled CSS stale with exactly the #288 symptom. Adds the UI and client package roots (via `SimpleModuleUiDir`/`SimpleModuleClientDir`, which resolve to the npm packages in a scaffold and to `packages/` in the monorepo) and tracks `docs/design-system/` through the `@(TailwindExtraSourceFiles)` extension point. Moves the `Styles/_scan/**/*.js` glob into `CollectModuleAssets`. It was in an evaluation-time ItemGroup, but those files are staged during execution, so on the first build after installing a packaged module the glob expanded to nothing and `TailwindBuild` was judged up to date. Declaring the item in the target that stages them means the Inputs check, which runs afterwards, sees them. Anchors the module glob to `*/src/*/Pages/**` instead of `**/Pages/**` so evaluation no longer walks every module's bin/ and obj/ on every build, including design-time builds. `resolvePage` now reports the declared candidate's error rather than the last probe's. With the declaration authoritative, a real failure in the module's own bundle was being buried under a 404 from a fallback URL that was never going to resolve. Notes the scaffold's stripped `@source "./_scan/"` (#290) where the staging target could otherwise be misread as covering packaged modules everywhere.
Owner
Author
|
Addressed the review in 10bc18b. Four of six findings fixed; two declined with reasons. Fixed
Declined
One correction to my own verification. My first attempt to reproduce the untracked-UI-root gap reported a false pass — a leftover mtime from a previous probe, then incidental input churn that reruns Tailwind on many builds in this repo. A clean before/after via timestamps is not reliable here. The finding is settled by inspection instead (none of the committed globs cover Full suite green (20 assemblies, 0 failures), |
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.
Fixes #283, fixes #284, fixes #287, fixes #288.
Four reports filed against a
sm new projectscaffold, all one root cause: the framework assumed its own monorepo layout, where a module's directory and assembly are bothSimpleModule.<Module>.sm new modulescaffolds a bare<Module>for both.#287 — page bundle 404 on every page load
The client built the bundle URL as
_content/SimpleModule.<Module>/…, but an RCL serves its assets under itsAssemblyName, so every scaffolded module 404'd before the fallback probe found it.HtmlFileInertiaPageRenderernow declares the module-name → assembly-name mapping in the page shell, andresolvePagereads it, so the first request goes to the path that actually serves the bundle. Probing stays as a fallback for shells that predate the map, and for an unparseable one.The same prefix assumption also meant a bare-named module's stylesheet was never linked —
BuildModuleCssLinksonly matched_content/SimpleModule.*. Module CSS discovery now consults the same mapping.#283 / #284 —
types.tswritten into a directory no project ownsextract-ts-types.mjshardcodedSimpleModule.<Module>as the output project andmkdirSync'd it unconditionally. It now resolves the project directory that actually exists and skips modules with no local source, so:Pages/that import them (extract-ts-types.mjs writes types.ts into a SimpleModule.<Module> directory that sm new module never creates #284)generate:typesAlso removes
modules/Identity/src/SimpleModule.Identity/, which held only a generatedtypes.tsfor a contracts-only module and belonged to no project — the exact artifact #284 describes, committed here.#288 — Tailwind never recompiled for new pages
Styles/app.cssdeclares the module pages as@sourceglobs, butTailwindBuilddid not treat them as inputs, so a new page's utility classes were silently never generated. ModulePages//Views/, the hostClientApp, and the staged module bundles are now inputs, with@(TailwindExtraSourceFiles)as an extension point for hosts that add@sourcedirectives of their own.Verification
main: addedbg-lime-700to a module page, rebuilt, class absent fromapp.css. With the fix,bg-fuchsia-800compiles in.src/<Name>(scaffold),src/SimpleModule.<Name>(framework), and a module with no source. Writes into the first two, skips and creates nothing for the third. Re-running against this repo produces zero changes to any existingtypes.ts.InertiaEndpoint_DeclaresAssemblyNameThatServesEachModuleBundleasserts every module with pages is declared and every declared value is a real loaded assembly — it fails outright on the pre-fix shell.npm run checkclean,dotnet build0 warnings.Note for a follow-up
The scaffold's
HostTemplates.AppCss()strips the@source "./_scan/"line, so a scaffolded host never scans the staged bundles of packaged modules — their utility classes would be missing for the same silent reason as #288. Left alone here since it is a separate change to the CLI templates.