beaver-build 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +383 -237
- package/dist/index.js +1378 -488
- package/package.json +57 -52
package/README.md
CHANGED
|
@@ -1,237 +1,383 @@
|
|
|
1
|
-
<div align="center"><img width="400" height="225" alt="Beaver CLI" src="https://raw.githubusercontent.com/hd1008-lang/beaver/main/media/beaver.gif" /></div>
|
|
2
|
-
|
|
3
|
-
# Beaver
|
|
4
|
-
|
|
5
|
-
An interactive CLI tool for scaffolding modern web projects. Select your project type, configure your stack through a guided menu, and get a production-ready project generated on disk with pinned library versions.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
|
140
|
-
|
|
141
|
-
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
|
154
|
-
|
|
155
|
-
|
|
|
156
|
-
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
|
161
|
-
|
|
162
|
-
|
|
|
163
|
-
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
|
168
|
-
|
|
169
|
-
|
|
|
170
|
-
|
|
|
171
|
-
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
1
|
+
<div align="center"><img width="400" height="225" alt="Beaver CLI" src="https://raw.githubusercontent.com/hd1008-lang/beaver/main/media/beaver.gif" /></div>
|
|
2
|
+
|
|
3
|
+
# Beaver
|
|
4
|
+
|
|
5
|
+
An interactive CLI tool for scaffolding modern web projects. Select your project type, configure your stack through a guided menu, and get a production-ready project generated on disk with pinned library versions.
|
|
6
|
+
|
|
7
|
+
**Current Version:** 1.0.7
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
### Prerequisites
|
|
12
|
+
|
|
13
|
+
- Node.js >= 20.0.0
|
|
14
|
+
- npm
|
|
15
|
+
|
|
16
|
+
### Installation
|
|
17
|
+
|
|
18
|
+
**Option 1: Install globally** (recommended for frequent use)
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g beaver-build
|
|
22
|
+
beaver
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Option 2: Use directly with npx** (no installation needed)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx beaver-build
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Commands & Options
|
|
32
|
+
|
|
33
|
+
**Main command:**
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
beaver # Interactive project scaffolding
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Options:**
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
beaver -v, --version # Show current version
|
|
43
|
+
beaver -h, --help # Show help and available commands
|
|
44
|
+
beaver update # Update beaver to the latest version from npm
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Usage
|
|
48
|
+
|
|
49
|
+
Simply run the command and follow the interactive prompts:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
beaver
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The CLI will guide you through:
|
|
56
|
+
|
|
57
|
+
1. **Project Type** — Choose React + Vite, Chrome Extension, or Next.js (upcoming)
|
|
58
|
+
2. **Project Name** — Enter your project directory name
|
|
59
|
+
3. **Configuration** — Select your preferred stack (layout, router, state management, styling, linter, AI setup, testing)
|
|
60
|
+
|
|
61
|
+
After answering all prompts, your production-ready project will be generated in the specified directory with:
|
|
62
|
+
|
|
63
|
+
- All dependencies pinned to stable versions
|
|
64
|
+
- GitHub Copilot custom instructions for your chosen stack
|
|
65
|
+
- Ready to run with `npm install && npm run dev`
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Development (Contributing)
|
|
70
|
+
|
|
71
|
+
To contribute or develop locally:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install
|
|
75
|
+
|
|
76
|
+
# Development & Building
|
|
77
|
+
npm run dev # Run CLI directly in development mode (using tsx)
|
|
78
|
+
npm run dev:build # Compile TypeScript, resolve aliases, then run
|
|
79
|
+
npm run build # Compile TypeScript for distribution (outputs to dist/)
|
|
80
|
+
|
|
81
|
+
# Documentation
|
|
82
|
+
npm run docs:index # Regenerate docs/INDEX.md
|
|
83
|
+
npm run docs:lint # Validate frontmatter in docs/
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Publishing:**
|
|
87
|
+
|
|
88
|
+
When ready to publish a new version:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npm version patch|minor|major # Update version in package.json
|
|
92
|
+
npm publish # Publishes to npm (runs build automatically)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Project Types
|
|
98
|
+
|
|
99
|
+
| Type | Description | Status |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| React + Vite | React 19 + Vite with comprehensive tooling options | ✅ Available |
|
|
102
|
+
| Chrome Extension | React 19 + Vite for Chrome Manifest v3 extensions | ✅ Available |
|
|
103
|
+
| Next.js | Next 15 with app router and modern features | 🔄 Upcoming |
|
|
104
|
+
| Nuxt | Nuxt 4 with Vue 3 composition API | 🔄 Upcoming |
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## React + Vite
|
|
109
|
+
|
|
110
|
+
The CLI walks you through the following choices:
|
|
111
|
+
|
|
112
|
+
### 1. Project Name
|
|
113
|
+
|
|
114
|
+
Validated to allow only letters, numbers, hyphens, and underscores (`[a-zA-Z0-9_-]`).
|
|
115
|
+
|
|
116
|
+
### 2. Layout
|
|
117
|
+
|
|
118
|
+
| Option | Description |
|
|
119
|
+
|---|---|
|
|
120
|
+
| FSD | Feature Slice Design — modular file structure |
|
|
121
|
+
| BPR | Bulletproof React — scalable architecture |
|
|
122
|
+
|
|
123
|
+
### 3. Router
|
|
124
|
+
|
|
125
|
+
| Option | Version |
|
|
126
|
+
|---|---|
|
|
127
|
+
| Not Using | — |
|
|
128
|
+
| TanStack Router | v1.144.0 |
|
|
129
|
+
|
|
130
|
+
### 4. State Management
|
|
131
|
+
|
|
132
|
+
| Option | Version |
|
|
133
|
+
|---|---|
|
|
134
|
+
| Not Using | — |
|
|
135
|
+
| Zustand | v5.0.5 |
|
|
136
|
+
|
|
137
|
+
### 5. Data Fetching
|
|
138
|
+
|
|
139
|
+
| Option | Version |
|
|
140
|
+
|---|---|
|
|
141
|
+
| Not Using | — |
|
|
142
|
+
| TanStack Query | v5.74.4 |
|
|
143
|
+
|
|
144
|
+
### 6. CSS / Styling
|
|
145
|
+
|
|
146
|
+
| Option | Version |
|
|
147
|
+
|---|---|
|
|
148
|
+
| Not Using | — |
|
|
149
|
+
| Tailwind CSS | v4.1.3 |
|
|
150
|
+
|
|
151
|
+
### 7. AI Setup
|
|
152
|
+
|
|
153
|
+
| Option | Description |
|
|
154
|
+
|---|---|
|
|
155
|
+
| Not Using | — |
|
|
156
|
+
| Claude (Claude Code) | CLAUDE.md + .claude/ agents + feature docs |
|
|
157
|
+
|
|
158
|
+
### 8. Testing
|
|
159
|
+
|
|
160
|
+
| Option | Description |
|
|
161
|
+
|---|---|
|
|
162
|
+
| Not Using | — |
|
|
163
|
+
| Setup Testing Base | Vitest + React Testing Library configuration |
|
|
164
|
+
|
|
165
|
+
### 9. Linter / Formatter
|
|
166
|
+
|
|
167
|
+
| Option | Version | Notes |
|
|
168
|
+
|---|---|---|
|
|
169
|
+
| Not Using | — | — |
|
|
170
|
+
| Biome | v1.9.4 | All-in-one lint + format |
|
|
171
|
+
| ESLint | v9.39.4 | Flat config + typescript-eslint |
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Chrome Extension
|
|
176
|
+
|
|
177
|
+
Build Chrome Manifest v3 extensions with React 19 and Vite. The CLI guides you through:
|
|
178
|
+
|
|
179
|
+
### 1. Project Name
|
|
180
|
+
|
|
181
|
+
Validated to allow only letters, numbers, hyphens, and underscores (`[a-zA-Z0-9_-]`).
|
|
182
|
+
|
|
183
|
+
### 2. State Management
|
|
184
|
+
|
|
185
|
+
| Option | Version |
|
|
186
|
+
|---|---|
|
|
187
|
+
| Not Using | — |
|
|
188
|
+
| Zustand | v5.0.5 |
|
|
189
|
+
|
|
190
|
+
### 3. Data Fetching
|
|
191
|
+
|
|
192
|
+
| Option | Version |
|
|
193
|
+
|---|---|
|
|
194
|
+
| Not Using | — |
|
|
195
|
+
| TanStack Query | v5.74.4 |
|
|
196
|
+
|
|
197
|
+
### 4. CSS / Styling
|
|
198
|
+
|
|
199
|
+
| Option | Version |
|
|
200
|
+
|---|---|
|
|
201
|
+
| Not Using | — |
|
|
202
|
+
| Tailwind CSS | v4.1.3 |
|
|
203
|
+
|
|
204
|
+
### 5. AI Setup
|
|
205
|
+
|
|
206
|
+
| Option | Description |
|
|
207
|
+
|---|---|
|
|
208
|
+
| Not Using | — |
|
|
209
|
+
| Claude (Claude Code) | CLAUDE.md + .claude/ agents + feature docs |
|
|
210
|
+
|
|
211
|
+
### 6. Linter / Formatter
|
|
212
|
+
|
|
213
|
+
| Option | Version | Notes |
|
|
214
|
+
|---|---|---|
|
|
215
|
+
| Not Using | — | — |
|
|
216
|
+
| Biome | v1.9.4 | All-in-one lint + format |
|
|
217
|
+
| ESLint | v9.39.4 | Flat config + typescript-eslint |
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Generated Project — Copilot Instructions
|
|
222
|
+
|
|
223
|
+
Every scaffolded project includes a set of GitHub Copilot custom instructions so that AI-assisted coding inside the project follows the conventions of the chosen stack. The files are layout-aware — the `applyTo` glob patterns and placement rules change between FSD and BPR.
|
|
224
|
+
|
|
225
|
+
Files emitted in the generated project:
|
|
226
|
+
|
|
227
|
+
| File | Scope | Emitted when |
|
|
228
|
+
|---|---|---|
|
|
229
|
+
| `.github/copilot-instructions.md` | Repo-wide overview — stack, naming, architecture | Always |
|
|
230
|
+
| `.github/instructions/components.instructions.md` | Component file paths per layout | Always |
|
|
231
|
+
| `.github/instructions/hooks.instructions.md` | Hook file paths per layout | Always |
|
|
232
|
+
| `.github/instructions/tanstack-router.instructions.md` | `src/routes/**/*.tsx` | Router = TanStack Router |
|
|
233
|
+
| `.github/instructions/zustand.instructions.md` | Store file paths per layout | State = Zustand |
|
|
234
|
+
| `.github/instructions/tanstack-query.instructions.md` | API/query file paths per layout | Query = TanStack Query |
|
|
235
|
+
| `.github/instructions/biome.instructions.md` or `eslint.instructions.md` | `**` | Linter ≠ none |
|
|
236
|
+
|
|
237
|
+
The format follows GitHub's [path-specific custom instructions](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions#creating-path-specific-custom-instructions) spec (`applyTo` frontmatter).
|
|
238
|
+
|
|
239
|
+
**Rule for contributors:** every new option added to the CLI (new router, new state library, new UI framework, etc.) must ship with its own instruction template in `src/scaffold/react-vite/templates/copilot-instructions.ts`. See [Adding a New Option to React + Vite](#adding-a-new-option-to-react--vite) below.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Generated Project — Pinned Dependencies
|
|
244
|
+
|
|
245
|
+
| Package | Version |
|
|
246
|
+
|---|---|
|
|
247
|
+
| react | 19.1.0 |
|
|
248
|
+
| react-dom | 19.1.0 |
|
|
249
|
+
| vite | 6.4.3 |
|
|
250
|
+
| @vitejs/plugin-react | 4.4.1 |
|
|
251
|
+
| typescript | 5.8.3 |
|
|
252
|
+
| @types/react | 19.1.1 |
|
|
253
|
+
| @types/react-dom | 19.1.1 |
|
|
254
|
+
| @tanstack/react-router | 1.144.0 |
|
|
255
|
+
| @tanstack/router-devtools | 1.144.0 |
|
|
256
|
+
| @tanstack/router-vite-plugin | 1.144.0 |
|
|
257
|
+
| zustand | 5.0.5 |
|
|
258
|
+
| @tanstack/react-query | 5.74.4 |
|
|
259
|
+
| @tanstack/react-query-devtools | 5.74.4 |
|
|
260
|
+
| @biomejs/biome | 1.9.4 |
|
|
261
|
+
| eslint | 9.39.4 |
|
|
262
|
+
| @eslint/js | 9.39.4 |
|
|
263
|
+
| typescript-eslint | 8.26.0 |
|
|
264
|
+
| eslint-plugin-react-hooks | 5.2.0 |
|
|
265
|
+
| eslint-plugin-react-refresh | 0.4.19 |
|
|
266
|
+
| globals | 15.15.0 |
|
|
267
|
+
| vitest | Latest (when testing enabled) |
|
|
268
|
+
| @testing-library/react | Latest (when testing enabled) |
|
|
269
|
+
| @testing-library/jest-dom | Latest (when testing enabled) |
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Project Structure
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
src/
|
|
277
|
+
index.ts Entry point — greeting, menu, error handling
|
|
278
|
+
types/index.ts Cart, ProjectType, ReactViteCore, ChromeExtensionCore, NextJSCore
|
|
279
|
+
constants/index.ts Top-level menu options (React+Vite, Chrome Extension, Next.js, Nuxt)
|
|
280
|
+
commands/
|
|
281
|
+
update.ts runUpdate() — check and install latest version from npm
|
|
282
|
+
options/
|
|
283
|
+
index.ts Top-level project type selection
|
|
284
|
+
react-vite/
|
|
285
|
+
index.ts React + Vite menu flow
|
|
286
|
+
constants/index.ts Menu option definitions (layout, router, state, query, CSS, AI, testing, linter)
|
|
287
|
+
types/index.ts MenuOptions type
|
|
288
|
+
chrome-extension/
|
|
289
|
+
index.ts Chrome Extension menu flow
|
|
290
|
+
constants/index.ts Menu option definitions (state, query, CSS, AI, linter)
|
|
291
|
+
scaffold/
|
|
292
|
+
errors.ts ScaffoldError, isNodeError
|
|
293
|
+
utils.ts FileMap, dirExists(), writeProjectFile()
|
|
294
|
+
shared/
|
|
295
|
+
claude-setup.ts Shared Claude Code setup templates
|
|
296
|
+
react-vite/
|
|
297
|
+
index.ts Scaffold orchestrator
|
|
298
|
+
templates/
|
|
299
|
+
package-json.ts packageJsonTemplate(cart)
|
|
300
|
+
vite-config.ts viteConfigTemplate(cart)
|
|
301
|
+
tsconfig.ts tsconfigTemplate(), tsconfigNodeTemplate()
|
|
302
|
+
index-html.ts indexHtmlTemplate(projectName)
|
|
303
|
+
main-tsx.ts mainTsxTemplate(layout)
|
|
304
|
+
app-tsx.ts appTsxFsdTemplate(), appTsxBprTemplate()
|
|
305
|
+
router.ts rootRouteTemplate(), indexRouteTemplate()
|
|
306
|
+
zustand.ts zustandStoreTemplate()
|
|
307
|
+
query.ts queryProviderBprTemplate()
|
|
308
|
+
linter.ts biomeConfigTemplate(), eslintConfigTemplate()
|
|
309
|
+
testing-setup.ts vitestConfigTemplate(), testingSetupTemplate()
|
|
310
|
+
styles.ts stylesCssTemplate()
|
|
311
|
+
gitignore.ts gitignoreTemplate()
|
|
312
|
+
claude-setup.ts claudeSetupTemplate()
|
|
313
|
+
home-page.ts homePageTemplate()
|
|
314
|
+
vite-env-d-ts.ts viteEnvDtsTemplate()
|
|
315
|
+
copilot-instructions.ts getCopilotInstructionFiles(cart)
|
|
316
|
+
fsd-layout.ts getFsdFileMap(cart)
|
|
317
|
+
bpr-layout.ts getBprFileMap(cart)
|
|
318
|
+
chrome-extension/
|
|
319
|
+
index.ts Scaffold orchestrator for Chrome extensions
|
|
320
|
+
templates/
|
|
321
|
+
package-json.ts packageJsonTemplate(cart)
|
|
322
|
+
vite-config.ts viteConfigTemplate(cart)
|
|
323
|
+
manifest-json.ts manifestJsonTemplate(cart)
|
|
324
|
+
tsconfig.ts tsconfigTemplate()
|
|
325
|
+
main-tsx.ts mainTsxTemplate()
|
|
326
|
+
app-tsx.ts appTsxTemplate()
|
|
327
|
+
layout.ts layoutTemplate()
|
|
328
|
+
linter.ts biomeConfigTemplate(), eslintConfigTemplate()
|
|
329
|
+
query.ts queryProviderTemplate()
|
|
330
|
+
gitignore.ts gitignoreTemplate()
|
|
331
|
+
claude-setup.ts claudeSetupTemplate()
|
|
332
|
+
build-extension-script.ts buildExtensionScriptTemplate()
|
|
333
|
+
utils/
|
|
334
|
+
animation.ts typeWriter effect
|
|
335
|
+
user.ts getUserName() from git config
|
|
336
|
+
check-node-version.ts checkNodeVersion() — verify Node.js >= 20.0.0
|
|
337
|
+
index.ts sleep()
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Adding a New Project Type
|
|
343
|
+
|
|
344
|
+
To enable a new project type (e.g., enable Next.js):
|
|
345
|
+
|
|
346
|
+
1. Set `disabled: false` in `src/constants/index.ts`
|
|
347
|
+
2. Create `src/options/<project-name>/` directory with:
|
|
348
|
+
- `index.ts` — menu flow function (e.g. `flowNextJS()`)
|
|
349
|
+
- `constants/index.ts` — menu option definitions
|
|
350
|
+
3. Handle the new type in `src/options/index.ts` — import and call the flow function
|
|
351
|
+
4. Add the interface to `src/types/index.ts` and include it in the `Cart` union (e.g. `NextJSCore`)
|
|
352
|
+
5. Create `src/scaffold/<project-name>/` with:
|
|
353
|
+
- `index.ts` — scaffold orchestrator (spinner, file writing, cleanup on error)
|
|
354
|
+
- `templates/` — all template functions (package.json, config files, source templates)
|
|
355
|
+
6. Register Copilot instruction templates if AI setup is available
|
|
356
|
+
|
|
357
|
+
## Adding a New Option to React + Vite
|
|
358
|
+
|
|
359
|
+
To add a new menu option (e.g., a new UI library):
|
|
360
|
+
|
|
361
|
+
1. Add the constant to `src/options/react-vite/constants/index.ts`
|
|
362
|
+
- Define `REACT_MENU_<OPTION_NAME>` with display, value, description, disabled fields
|
|
363
|
+
2. Export the value type from `src/types/index.ts` and add the field to `ReactViteCore`
|
|
364
|
+
3. Add a `menu<OptionName>` function in `src/options/react-vite/index.ts` using `selectFromMenu`
|
|
365
|
+
4. Call it in `flowReactVite` in the right order (before scaffold step)
|
|
366
|
+
5. Update `getFsdFileMap` and `getBprFileMap` in `src/scaffold/react-vite/templates/` to handle the new option
|
|
367
|
+
6. **Add a Copilot instruction template** in `src/scaffold/react-vite/templates/copilot-instructions.ts`:
|
|
368
|
+
- Write a new template function (e.g. `uiLibraryTemplate(cart)`) returning markdown with `applyTo` frontmatter scoped to both FSD and BPR paths
|
|
369
|
+
- Register it inside `getCopilotInstructionFiles` under a conditional block keyed by the new cart field
|
|
370
|
+
- If the new option introduces new file paths, extend `Paths` type and both `FSD_PATHS` / `BPR_PATHS` maps
|
|
371
|
+
|
|
372
|
+
**This step is mandatory** — every scaffolded project with the new option must receive its matching Copilot instruction file.
|
|
373
|
+
|
|
374
|
+
## Adding a New Option to Chrome Extension
|
|
375
|
+
|
|
376
|
+
Same process as React + Vite:
|
|
377
|
+
|
|
378
|
+
1. Add the constant to `src/options/chrome-extension/constants/index.ts`
|
|
379
|
+
2. Export the value type from `src/types/index.ts` and add the field to `ChromeExtensionCore`
|
|
380
|
+
3. Add a `menu<OptionName>` function in `src/options/chrome-extension/index.ts`
|
|
381
|
+
4. Call it in `flowChromeExtension`
|
|
382
|
+
5. Update templates in `src/scaffold/chrome-extension/templates/` to handle the new option
|
|
383
|
+
6. Add a Copilot instruction template if applicable (Chrome extensions also use AI setup)
|