fix(cli): first-consumer polish - templates, theme sync, footer extraction - #9
Merged
Conversation
… version and resource links
…or improved project scaffolding and integration with existing Blazor projects
…ay, including social links and customizable columns
…ted styles for a cleaner layout
…k/light mode across enhanced navigation events
…nhancements for improved user onboarding experience
…g the split of `shelldocs init` into create and attach modes for improved project scaffolding.
…d names and assertions for improved clarity and functionality
…r project versioning
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
Bundle of small fixes discovered while dogfooding
shelldocs initin a real external repo (shell-tech). None of these are architectural changes — they're the "wait, why doesn't ___ work" edges that only surface when you use the CLI outside its own test suite.What's in it
Templates
DocsPage.razortemplate emits 6 explicit@usingdirectives (ShellDocs.Components,.Chrome,.Content,.Layouts,ShellDocs.Core,ShellDocs.Markdown). Fresh consumer projects don't inherit ShellDocs namespaces from_Imports.razorthe way the preview project does — the DocsPage template was failing to compile withCS0246: NavigationGraph could not be found.Home.razortemplate also declares@using ShellDocs.Components.Chromeso it can render<DocsFooter />.PatchAppRazorfixed for the realdotnet new blazoroutput shape<script src="_framework/blazor.web.js">and the<script src="@Assets["_framework/blazor.web.js"]">variant .NET 10 templates emit. Previous regex missed the wrapped form, soshelldocs.js+ the Shiki module never got injected into the head — dead theme sync, dead syntax highlighting.@rendermode="InteractiveServer"to bare<Routes />. Fresh Blazor Web App renders static SSR by default when this attribute is missing, which meant<ThemeToggle>clicks did nothing (no interactivity).<link>tags for Bootstrap CSS and defaultapp.css. Bootstrap'scode { color: #d63384 }was painting every inline<code>in the welcome page pink; the token system carries the correct styling.Theme sync survives enhanced navigation
shelldocs.jsnow registers adocument.addEventListener('enhancedload', applyTheme). Blazor's enhanced nav swaps the DOM on route change and strips the.darkclass from<html>(server response doesn't know about the user's localStorage). Re-applying from localStorage on theenhancedloadevent keeps the theme sticky across navigation.window.shelldocsApplyThemefor cases where explicit re-apply is useful.Site name inference
CreateModenow strips a trailing.Docsfrom the folder-derived site name.docs/shell-tech.Docs/(project folder) →shell-tech(brand shown in header/footer). Was previously writingo.SiteName = "shell-tech.Docs"verbatim.shelldocs init packages/my-cool-site) uses the folder name as-is; only strips.Docswhen it's the auto-inferred suffix.Strip fresh template's demo pages in create mode
StripFreshTemplatehelper called fromCreateMode(notAttachMode, on purpose — attach leaves your existing app alone).Counter.razor,Weather.razor,Home.razor.css,Components/Layout/NavMenu.razor(+ .css),Components/Layout/MainLayout.razor.css.MainLayout.razorwith a bare@inherits LayoutComponentBase\n@Body(routes.razor still references it asDefaultLayout; every real page overrides via@layout HomeLayoutor@layout DocsLayout).Home.razor— fumadocs-style welcome page (centered hero + CTA to/docs/introduction+ three cards explaining how to customize this page / add pages / register components).Footer extracted from
HomeLayoutinto a<DocsFooter />componentsrc/ShellDocs.Components/Chrome/DocsFooter.razor+.razor.css— takesVersion,TwitterHandle,Columns(RenderFragmentslot for custom columns; falls back to default Resources + Support columns).HomeLayoutnow renders<DocsHeader />+<main>@Body</main>, nothing else. Footer is opt-in per page — consumer drops<DocsFooter />anywhere they want it.<DocsFooter />explicitly with the same visual result as before.Home.razorincludes<DocsFooter Version="0.1.0-alpha" />so new projects still get a default footer that consumers can freely delete or customize.Rationale: the previous baked-in footer in HomeLayout carried ShellDocs-specific opinions (X socials pointing at
@shellui_, links to Showcase/Blog pages consumers don't have). Extraction removes those opinions from the framework — consumers now own their footer content and layout.Version bump plumbing
Directory.Build.propsgains<Version>0.1.0-alpha</Version>sodotnet packproduces0.1.0-alpha-versioned .nupkgs matching the version stringInitCommandwrites into scaffolded csprojs. Was previously defaulting to1.0.0.Test plan
dotnet build shelldocs.slnx— cleandotnet test shelldocs.slnx— 94 passingdotnet new blazor+shelldocs init --yesend-to-end — all patches apply, project builds,/docs/introductionrenders/ → /docs/introductionnavigation<code>in Home.razor renders with token-system styling (no Bootstrap pink)