fs-starter 1.0.0
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 +318 -0
- package/index.js +531 -0
- package/package.json +32 -0
- package/templates/.prettierignore.template +3 -0
- package/templates/.prettierrc.template +7 -0
- package/templates/App-query-only.jsx.template +18 -0
- package/templates/App-query-only.tsx.template +18 -0
- package/templates/App-with-query.jsx.template +17 -0
- package/templates/App-with-query.tsx.template +17 -0
- package/templates/App.jsx.template +9 -0
- package/templates/App.tsx.template +9 -0
- package/templates/ErrorBoundary.jsx.template +23 -0
- package/templates/ErrorBoundary.tsx.template +23 -0
- package/templates/ErrorPage.jsx.template +40 -0
- package/templates/ErrorPage.tsx.template +40 -0
- package/templates/ExampleForm.jsx.template +48 -0
- package/templates/ExampleForm.tsx.template +48 -0
- package/templates/HomePage.jsx.template +10 -0
- package/templates/HomePage.tsx.template +10 -0
- package/templates/eslint.config.js.template +38 -0
- package/templates/eslint.config.ts.template +28 -0
- package/templates/index.css.template +1 -0
- package/templates/jsconfig.json.template +23 -0
- package/templates/main-with-error-boundary.jsx.template +19 -0
- package/templates/main-with-error-boundary.tsx.template +19 -0
- package/templates/queryClient.js.template +10 -0
- package/templates/queryClient.ts.template +10 -0
- package/templates/router.jsx.template +11 -0
- package/templates/router.tsx.template +11 -0
- package/templates/tsconfig.json.template +24 -0
- package/templates/vite.config-alias-no-tailwind.js.template +14 -0
- package/templates/vite.config-alias-no-tailwind.ts.template +14 -0
- package/templates/vite.config-with-alias.js.template +16 -0
- package/templates/vite.config-with-alias.ts.template +16 -0
- package/templates/vite.config.js.template +10 -0
- package/templates/vite.config.ts.template +10 -0
- package/templates/zustand-store.js.template +7 -0
- package/templates/zustand-store.ts.template +13 -0
package/README.md
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# Frontend Starter
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
______ _ _ _ _
|
|
5
|
+
| ___| | | | | | | | |
|
|
6
|
+
| |_ _ __ ___ _ __ | |_ ___ _ __ __| | ___| |_ __ _ _ __| |_ ___ _ __
|
|
7
|
+
| _| '__/ _ \| '_ \| __/ _ \ '_ \ / _` | / __| __/ _` | '__| __/ _ \ '__|
|
|
8
|
+
| | | | | (_) | | | | || __/ | | | (_| | \__ \ || (_| | | | || __/ |
|
|
9
|
+
\_| |_| \___/|_| |_|\__\___|_| |_|\__,_| |___/\__\__,_|_| \__\___|_|
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Interactive CLI tool to scaffold modern React projects with Vite**
|
|
13
|
+
|
|
14
|
+
Create production-ready React applications with your preferred stack in seconds, without the hassle of manual configuration.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- **Interactive CLI** - Choose exactly what you need
|
|
21
|
+
- **Vite** - Lightning fast HMR and build tool
|
|
22
|
+
- **React 18** - Latest React with modern features
|
|
23
|
+
- **TypeScript/JavaScript** - Your choice
|
|
24
|
+
- **Tailwind CSS v4** - Utility-first CSS (optional)
|
|
25
|
+
- **State Management** - Zustand (optional)
|
|
26
|
+
- **Data Fetching** - TanStack Query/React Query (optional)
|
|
27
|
+
- **React Router** - Client-side routing with error handling (optional)
|
|
28
|
+
- **Form Handling** - Formik + Yup validation (optional)
|
|
29
|
+
- **Error Boundaries** - React Router errorElement or react-error-boundary
|
|
30
|
+
- **ESLint** - Code linting (optional)
|
|
31
|
+
- **Prettier** - Code formatting (optional)
|
|
32
|
+
- **Atomic Design** - Organized folder structure (optional)
|
|
33
|
+
- **Path Aliases** - Clean imports with `@/` (always included)
|
|
34
|
+
- **Git** - Initialize repository with first commit (optional)
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Install globally
|
|
42
|
+
npm install -g .
|
|
43
|
+
|
|
44
|
+
# Or use directly with npx (once published)
|
|
45
|
+
npx frontend-starter
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
Simply run the command and follow the interactive prompts:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
frontend-starter
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Interactive Questions
|
|
59
|
+
|
|
60
|
+
1. **Project name** - Your app name (lowercase, hyphens allowed)
|
|
61
|
+
2. **Package manager** - Choose between yarn, npm, or pnpm
|
|
62
|
+
3. **Language** - TypeScript or JavaScript
|
|
63
|
+
4. **Tailwind CSS v4** - Modern utility-first CSS framework
|
|
64
|
+
5. **Zustand** - Lightweight state management
|
|
65
|
+
6. **TanStack Query** - Powerful data fetching and caching
|
|
66
|
+
7. **React Router** - Client-side routing (includes error handling)
|
|
67
|
+
8. **Atomic Design** - Component folder structure
|
|
68
|
+
9. **Git repository** - Initialize with first commit
|
|
69
|
+
10. **ESLint** - Code linting
|
|
70
|
+
11. **Prettier** - Code formatting
|
|
71
|
+
12. **Formik + Yup** - Form handling with validation
|
|
72
|
+
13. **Error Boundary** - Error catching (only if React Router not selected)
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Generated Project Structure
|
|
77
|
+
|
|
78
|
+
### With Atomic Design:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
my-app/
|
|
82
|
+
├── src/
|
|
83
|
+
│ ├── Atoms/ # Basic building blocks (buttons, inputs)
|
|
84
|
+
│ ├── Molecules/ # Simple components (form fields, cards)
|
|
85
|
+
│ ├── Organisms/ # Complex components (navbar, footer)
|
|
86
|
+
│ ├── Pages/ # Page components
|
|
87
|
+
│ ├── Stores/ # Zustand stores (if selected)
|
|
88
|
+
│ ├── Utils/ # Utility functions and helpers
|
|
89
|
+
│ ├── router.tsx # Router configuration (if selected)
|
|
90
|
+
│ ├── queryClient.ts # TanStack Query config (if selected)
|
|
91
|
+
│ ├── ErrorPage.tsx # Error page (if React Router selected)
|
|
92
|
+
│ ├── ErrorFallback.tsx # Error fallback (if Error Boundary selected)
|
|
93
|
+
│ ├── App.tsx
|
|
94
|
+
│ └── main.tsx
|
|
95
|
+
├── eslint.config.js # ESLint configuration
|
|
96
|
+
├── .prettierrc # Prettier configuration
|
|
97
|
+
├── vite.config.ts # Vite config with path aliases
|
|
98
|
+
├── tsconfig.json # TypeScript config with path aliases
|
|
99
|
+
└── package.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Without Atomic Design:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
my-app/
|
|
106
|
+
├── src/
|
|
107
|
+
│ ├── Pages/
|
|
108
|
+
│ ├── Stores/
|
|
109
|
+
│ ├── Utils/
|
|
110
|
+
│ └── ...
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Path Aliases
|
|
116
|
+
|
|
117
|
+
All projects include path aliases configured automatically:
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
// Instead of this:
|
|
121
|
+
import Button from "../../../Atoms/Button";
|
|
122
|
+
|
|
123
|
+
// You can do this:
|
|
124
|
+
import Button from "@/Atoms/Button";
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Configured in both `vite.config` and `tsconfig.json`/`jsconfig.json`.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Error Handling
|
|
132
|
+
|
|
133
|
+
### With React Router (Recommended)
|
|
134
|
+
|
|
135
|
+
Uses React Router's built-in `errorElement` system:
|
|
136
|
+
|
|
137
|
+
- Catches routing errors and component errors
|
|
138
|
+
- `useRouteError()` hook for error details
|
|
139
|
+
- No extra dependencies
|
|
140
|
+
- Functional component with modern hooks
|
|
141
|
+
|
|
142
|
+
### Without React Router
|
|
143
|
+
|
|
144
|
+
Option to use `react-error-boundary`:
|
|
145
|
+
|
|
146
|
+
- Wraps entire application
|
|
147
|
+
- Catches errors anywhere in the component tree
|
|
148
|
+
- Functional ErrorFallback component
|
|
149
|
+
- Reset button to recover from errors
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## TanStack Query Integration
|
|
154
|
+
|
|
155
|
+
When selected, includes:
|
|
156
|
+
|
|
157
|
+
- Pre-configured `QueryClient` with sensible defaults
|
|
158
|
+
- React Query DevTools (automatically included)
|
|
159
|
+
- Integrated with App component
|
|
160
|
+
- Works seamlessly with React Router
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Form Handling with Formik + Yup
|
|
165
|
+
|
|
166
|
+
When selected, includes:
|
|
167
|
+
|
|
168
|
+
- Example form component in `src/Utils/ExampleForm`
|
|
169
|
+
- Validation schema with Yup
|
|
170
|
+
- Form state management with Formik
|
|
171
|
+
- Error handling and messages
|
|
172
|
+
- Ready to customize and extend
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Tailwind CSS v4
|
|
177
|
+
|
|
178
|
+
When selected, configures:
|
|
179
|
+
|
|
180
|
+
- Latest Tailwind CSS v4
|
|
181
|
+
- Vite plugin integration
|
|
182
|
+
- Minimal `index.css` setup
|
|
183
|
+
- Ready to use utility classes
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Example Session
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
$ frontend-starter
|
|
191
|
+
|
|
192
|
+
______ _ _ _ _
|
|
193
|
+
| ___| | | | | | | | |
|
|
194
|
+
| |_ _ __ ___ _ __ | |_ ___ _ __ __| | ___| |_ __ _ _ __| |_ ___ _ __
|
|
195
|
+
| _| '__/ _ \| '_ \| __/ _ \ '_ \ / _` | / __| __/ _` | '__| __/ _ \ '__|
|
|
196
|
+
| | | | | (_) | | | | || __/ | | | (_| | \__ \ || (_| | | | || __/ |
|
|
197
|
+
\_| |_| \___/|_| |_|\__\___|_| |_|\__,_| |___/\__\__,_|_| \__\___|_|
|
|
198
|
+
|
|
199
|
+
? Project name: my-awesome-app
|
|
200
|
+
? Choose package manager: yarn
|
|
201
|
+
? Choose language: TypeScript
|
|
202
|
+
? Install Tailwind CSS v4? Yes
|
|
203
|
+
? Install Zustand? No
|
|
204
|
+
? Install TanStack Query? Yes
|
|
205
|
+
? Install React Router Dom? Yes
|
|
206
|
+
? Use Atomic Design folder structure? Yes
|
|
207
|
+
? Initialize Git repository? Yes
|
|
208
|
+
? Install ESLint? Yes
|
|
209
|
+
? Install Prettier? Yes
|
|
210
|
+
? Install Formik + Yup for form handling? Yes
|
|
211
|
+
|
|
212
|
+
✓ Base project created
|
|
213
|
+
✓ Folders created: Atoms, Molecules, Organisms, Pages, Stores, Utils
|
|
214
|
+
✓ Tailwind v4 configured
|
|
215
|
+
✓ TanStack Query installed and configured
|
|
216
|
+
✓ React Router configured with error handling
|
|
217
|
+
✓ Formik + Yup installed with example form
|
|
218
|
+
✓ ESLint configured
|
|
219
|
+
✓ Prettier configured
|
|
220
|
+
✓ Git repository initialized
|
|
221
|
+
✓ README.md generated
|
|
222
|
+
|
|
223
|
+
Project "my-awesome-app" successfully generated!
|
|
224
|
+
|
|
225
|
+
To get started:
|
|
226
|
+
1. cd my-awesome-app
|
|
227
|
+
2. yarn install
|
|
228
|
+
3. yarn dev
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Requirements
|
|
234
|
+
|
|
235
|
+
- Node.js 16.x or higher
|
|
236
|
+
- npm, yarn, or pnpm
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Tech Stack
|
|
241
|
+
|
|
242
|
+
- **Vite** - Next Generation Frontend Tooling
|
|
243
|
+
- **React 18** - A JavaScript library for building user interfaces
|
|
244
|
+
- **TypeScript** - JavaScript with syntax for types (optional)
|
|
245
|
+
- **Tailwind CSS v4** - Utility-first CSS framework (optional)
|
|
246
|
+
- **React Router** - Declarative routing for React (optional)
|
|
247
|
+
- **TanStack Query** - Powerful asynchronous state management (optional)
|
|
248
|
+
- **Zustand** - Bear necessities for state management (optional)
|
|
249
|
+
- **Formik** - Build forms in React (optional)
|
|
250
|
+
- **Yup** - Schema validation (optional)
|
|
251
|
+
- **ESLint** - Find and fix problems in JavaScript code (optional)
|
|
252
|
+
- **Prettier** - Opinionated code formatter (optional)
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Contributing
|
|
257
|
+
|
|
258
|
+
Contributions are welcome! Feel free to:
|
|
259
|
+
|
|
260
|
+
- Report bugs
|
|
261
|
+
- Suggest new features
|
|
262
|
+
- Submit pull requests
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## License
|
|
267
|
+
|
|
268
|
+
MIT
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Credits
|
|
273
|
+
|
|
274
|
+
Generated with love using frontend-starter
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Tips
|
|
279
|
+
|
|
280
|
+
### Customize Templates
|
|
281
|
+
|
|
282
|
+
All templates are located in the `templates/` folder. You can customize them to match your preferences:
|
|
283
|
+
|
|
284
|
+
- Component boilerplates
|
|
285
|
+
- Configuration files
|
|
286
|
+
- Router setup
|
|
287
|
+
- Error boundaries
|
|
288
|
+
|
|
289
|
+
### Add More Features
|
|
290
|
+
|
|
291
|
+
Want to add more options? Edit `index.js` and:
|
|
292
|
+
|
|
293
|
+
1. Add your prompt question
|
|
294
|
+
2. Create template files
|
|
295
|
+
3. Add installation logic
|
|
296
|
+
4. Update README generation
|
|
297
|
+
|
|
298
|
+
### Path Aliases Examples
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
// Components
|
|
302
|
+
import Button from "@/Atoms/Button";
|
|
303
|
+
import Card from "@/Molecules/Card";
|
|
304
|
+
import Navbar from "@/Organisms/Navbar";
|
|
305
|
+
|
|
306
|
+
// Pages
|
|
307
|
+
import HomePage from "@/Pages/HomePage";
|
|
308
|
+
|
|
309
|
+
// Utils
|
|
310
|
+
import { formatDate } from "@/Utils/helpers";
|
|
311
|
+
|
|
312
|
+
// Stores
|
|
313
|
+
import { useStore } from "@/Stores/useStore";
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
**Happy coding!**
|