11# Implementation Plan: @fastify/create-vite-app CLI
22
33## Overview
4+
45Build a CLI scaffolding tool that copies the ` examples/react-vanilla-spa/ ` template and resolves pnpm catalog versions at build time.
56
67## Requirements Summary
8+
79- ** Template source** : ` examples/react-vanilla-spa/ ` (bundled at build time)
810- ** Prompts** : Project name only (using @clack/prompts )
911- ** Versions** : Baked in at build time from ` pnpm-workspace.yaml `
@@ -15,22 +17,27 @@ Build a CLI scaffolding tool that copies the `examples/react-vanilla-spa/` templ
1517## Implementation (Completed)
1618
1719### Step 1: Add dependencies
20+
1821** File** : ` packages/create-vite-app/package.json `
1922
2023Added:
24+
2125- ` @clack/prompts ` ^0.11.0 - interactive CLI prompts
2226- ` yaml ` ^2.8.2 (devDependency) - parse pnpm-workspace.yaml at build time
2327
2428### Step 2: Create build script
29+
2530** File** : ` packages/create-vite-app/scripts/generate-versions.ts `
2631
2732This script:
33+
28341 . Reads ` pnpm-workspace.yaml ` for catalog versions
29352 . Reads ` packages/fastify-vite/package.json ` for @fastify/vite version
30363 . Writes ` src/versions.json ` with resolved versions
31374 . Copies template files from ` examples/react-vanilla-spa ` to ` templates/react-spa `
3238
3339### Step 3: Update build script in package.json
40+
3441** File** : ` packages/create-vite-app/package.json `
3542
3643``` json
@@ -40,34 +47,38 @@ This script:
4047(Uses Node 22.18+ native TypeScript support - no tsx needed)
4148
4249### Step 4: Rewrite src/index.ts
50+
4351** File** : ` packages/create-vite-app/src/index.ts `
4452
4553Features:
54+
4655- Interactive project name prompt using @clack/prompts
4756- Copies template files from bundled ` templates/react-spa `
4857- Transforms package.json (resolves versions, updates name)
4958- Auto-detects package manager and installs dependencies
5059- Shows spinner during operations
5160
5261### Step 5: Create .gitignore
62+
5363** File** : ` packages/create-vite-app/.gitignore `
5464
5565Ignores build-time generated files:
66+
5667- ` src/versions.json `
5768- ` templates/ `
5869
5970---
6071
6172## Files Modified/Created
6273
63- | File | Action |
64- | ------| --------|
65- | ` packages/create-vite-app/package.json ` | Modified - added deps, updated build script |
66- | ` packages/create-vite-app/scripts/generate-versions.ts ` | Created |
67- | ` packages/create-vite-app/src/versions.json ` | Generated (gitignored) |
68- | ` packages/create-vite-app/src/index.ts ` | Rewritten |
69- | ` packages/create-vite-app/.gitignore ` | Created |
70- | ` packages/create-vite-app/templates/ ` | Generated (gitignored) |
74+ | File | Action |
75+ | ------------------------------------------------------- | ------------------------------------------- |
76+ | ` packages/create-vite-app/package.json ` | Modified - added deps, updated build script |
77+ | ` packages/create-vite-app/scripts/generate-versions.ts ` | Created |
78+ | ` packages/create-vite-app/src/versions.json ` | Generated (gitignored) |
79+ | ` packages/create-vite-app/src/index.ts ` | Rewritten |
80+ | ` packages/create-vite-app/.gitignore ` | Created |
81+ | ` packages/create-vite-app/templates/ ` | Generated (gitignored) |
7182
7283---
7384
@@ -89,11 +100,11 @@ project-name/
89100
90101## Version Mapping
91102
92- | Source Reference | Package | Resolved |
93- | ----------------- | ---------| ----------|
94- | ` workspace:^ ` | @fastify/vite | ^8.2.3 |
95- | ` catalog: ` | fastify | ^5.6.2 |
96- | ` catalog: ` | vite | ^7.3.0 |
97- | ` catalog:react ` | react | ^19.2.3 |
98- | ` catalog:react ` | react-dom | ^19.2.3 |
99- | ` catalog:react ` | @vitejs/plugin-react | ^5.1.2 |
103+ | Source Reference | Package | Resolved |
104+ | ---------------- | -------------------- | -------- |
105+ | ` workspace:^ ` | @fastify/vite | ^8.2.3 |
106+ | ` catalog: ` | fastify | ^5.6.2 |
107+ | ` catalog: ` | vite | ^7.3.0 |
108+ | ` catalog:react ` | react | ^19.2.3 |
109+ | ` catalog:react ` | react-dom | ^19.2.3 |
110+ | ` catalog:react ` | @vitejs/plugin-react | ^5.1.2 |
0 commit comments