Skip to content

docs(site): add a tutorial that walks a new app through edits, a type error and a build - #170

Merged
ChristopherPHolder merged 1 commit into
mainfrom
docs/tutorial
Dec 4, 2026
Merged

ChristopherPHolder merged 1 commit into
mainfrom
docs/tutorial

Conversation

@ChristopherPHolder

Copy link
Copy Markdown
Collaborator

Closes #159

What changed

  • site/content/tutorial.md, a new page. It walks someone who has never used the plugin through it in four steps. Each step shows the terminal output and says what the browser shows.
    1. Create an app with npm create @push-based/ngp@latest -- shop --template app --no-monorepo, install it and run npm run dev.
    2. Click the counter to 3, then edit app.html: the template updates in place and the count stays at 3. Next, edit the class (n + 1 → n + 2): the page reloads. The page explains the rule and links How it works § Component HMR. An inline template edit in home.ts also updates in place.
    3. Misspell clicks() as clikcs() in the template. Then fix it and watch the overlay close and the terminal print type-check: no errors.
    4. npm test fails because of the step-2 change, so the spec gets fixed. Then npm run build passes, and fails with the typo put back. npm run preview serves the result.
    • Where next: Getting started, Configuration, How it works.
  • site/src/app/docs.ts: a Tutorial entry in Guide, right after Creating an app. The tutorial starts by creating an app, so it comes after the page that documents that command. Readers with an existing app still find Getting started first.
  • site/content/creating-an-app.md: one new line under "After you scaffold" that links the tutorial. The open PRs that edit this page don't touch that spot: feat(create-ngp): publish an unscoped create-ngp so vp create ngp works #136 changes lines 7–65 and ci(workflows): run the packed plugin on windows with the wasm engine #149 line ~226.
  • site/content/changelog.md: one line under 4 December 2026 → Docs.

How I checked it

I ran every step as written. The app was in a temp directory outside the repo, on create-ngp 0.4.4 from npm, Angular 22.3.2, Vite 8.3.4 and Node 26.12.1, on an Apple M4 Max. The dev server ran on port 5401. I deleted the app afterwards.

Observed in a browser preview tab (DOM reads and screenshots):

  • After the app.html edit the <h1> changed and Clicks: 3 stayed. A window marker I set before the edit was still there, so the page didn't reload. The terminal printed hmr update src/app/app.ts@App.
  • After the .ts edit the marker was gone, the counter was back at 0 and one click gave 2. The terminal printed page reload src/app/app.ts.
  • The home.ts inline-template edit updated in place and kept the marker and the count.
  • With the typo, the overlay showed TS2551 … 'clikcs' … Did you mean 'clicks'? at app.html:9:54. After the fix, the overlay element was gone.

Two things I found while running it, and the page says both:

  • The broken template is sent to the page before the type-check runs, so Angular throws ctx.clikcs is not a function and the plugin reloads the page (HMR failed … Reloading.). The type-check reports about 100 ms later.
  • A failed vite build empties dist/. A preview right after the failure returned 404, so the page says to build again before serving.

Also: npm test (fail, then pass), npm run build (pass, then fail on the typo, then pass), and npm run preview (fetched /, got the built index.html).

The timings in the terminal excerpts are from that one run, and the page names the date, versions and machine. It gives no other timings.

Site: pnpm docs:check passed (20 pages, 471 links). pnpm site:build passed. I served site/dist/client under /vite-plugin-ngp/ on port 4336 and looked at the page at 1280 and 390 px, in light and dark. The sidebar entry sits under Guide, and nothing scrolls sideways at 390 px. Wide terminal lines scroll inside their code block.

Not done

  • I passed every scaffolder option, so the run never showed the interactive prompts. The page doesn't describe them.

🤖 Generated with Claude Code

… error and a build

The page creates an app with create-ngp, edits a template while the page
holds state, edits the class to show the reload, plants a template type
error in the terminal and overlay, then runs the spec and the build.
Every step was run on create-ngp 0.4.4 and the excerpts are from that run.

Closes #159

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChristopherPHolder
ChristopherPHolder merged commit dba5a92 into main Dec 4, 2026
2 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.

Docs: a tutorial that teaches how the plugin behaves

1 participant