@donotdev/cli 0.0.4 → 0.0.6

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.
Files changed (54) hide show
  1. package/dependencies-matrix.json +234 -114
  2. package/dist/bin/commands/build.js +9 -3
  3. package/dist/bin/commands/bump.js +119 -100
  4. package/dist/bin/commands/cacheout.js +9 -3
  5. package/dist/bin/commands/create-app.js +60 -34
  6. package/dist/bin/commands/create-project.js +61 -34
  7. package/dist/bin/commands/deploy.js +22 -14
  8. package/dist/bin/commands/dev.js +9 -3
  9. package/dist/bin/commands/emu.js +9 -3
  10. package/dist/bin/commands/format.js +9 -3
  11. package/dist/bin/commands/lint.js +9 -3
  12. package/dist/bin/commands/make-admin.d.ts +11 -0
  13. package/dist/bin/commands/make-admin.d.ts.map +1 -0
  14. package/dist/bin/commands/make-admin.js +12 -0
  15. package/dist/bin/commands/make-admin.js.map +1 -0
  16. package/dist/bin/commands/preview.js +9 -3
  17. package/dist/bin/commands/sync-secrets.js +9 -3
  18. package/dist/index.js +72 -44
  19. package/package.json +1 -1
  20. package/templates/app-demo/index.html.example +4 -0
  21. package/templates/app-demo/src/App.tsx.example +28 -10
  22. package/templates/app-demo/src/config/app.ts.example +56 -0
  23. package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +5 -5
  24. package/templates/app-next/src/app/ClientLayout.tsx.example +5 -4
  25. package/templates/app-next/src/app/layout.tsx.example +17 -25
  26. package/templates/app-next/src/globals.css.example +10 -7
  27. package/templates/app-next/src/locales/dndev_en.json.example +68 -0
  28. package/templates/app-next/src/pages/locales/example_en.json.example +5 -0
  29. package/templates/app-vite/index.html.example +3 -0
  30. package/templates/app-vite/src/App.tsx.example +1 -1
  31. package/templates/app-vite/src/globals.css.example +14 -6
  32. package/templates/app-vite/src/locales/dndev_en.json.example +68 -0
  33. package/templates/functions-firebase/README.md.example +25 -0
  34. package/templates/functions-firebase/tsconfig.json.example +3 -13
  35. package/templates/functions-vercel/tsconfig.json.example +1 -13
  36. package/templates/root-consumer/firebase.json.example +1 -1
  37. package/templates/root-consumer/guides/AGENT_START_HERE.md.example +229 -7
  38. package/templates/root-consumer/guides/COMPONENTS_ADV.md.example +456 -0
  39. package/templates/root-consumer/guides/COMPONENTS_ATOMIC.md.example +43 -1
  40. package/templates/root-consumer/guides/COMPONENTS_UI.md.example +6 -0
  41. package/templates/root-consumer/guides/INDEX.md.example +3 -0
  42. package/templates/root-consumer/guides/SETUP_APP_CONFIG.md.example +5 -2
  43. package/templates/root-consumer/guides/SETUP_BILLING.md.example +44 -4
  44. package/templates/root-consumer/guides/SETUP_CRUD.md.example +1244 -0
  45. package/templates/root-consumer/guides/SETUP_FUNCTIONS.md.example +52 -0
  46. package/templates/root-consumer/guides/SETUP_I18N.md.example +145 -6
  47. package/templates/root-consumer/guides/SETUP_LAYOUTS.md.example +18 -0
  48. package/templates/root-consumer/guides/SETUP_PAGES.md.example +25 -0
  49. package/templates/root-consumer/guides/SETUP_PWA.md.example +213 -0
  50. package/templates/root-consumer/guides/USE_ROUTING.md.example +503 -0
  51. package/templates/root-consumer/vercel.json.example +315 -20
  52. package/templates/app-demo/src/Routes.tsx.example +0 -20
  53. package/templates/app-vite/src/Routes.tsx.example +0 -16
  54. package/templates/app-vite/src/pages/locales/README.md.example +0 -1
@@ -10,15 +10,44 @@
10
10
 
11
11
  **Never guess. Always verify.**
12
12
 
13
+ ---
14
+
15
+ ## ✅ Success Path: Follow These Steps
16
+
17
+ **Step 1: Install dependencies**
18
+ - Run `bun install` in project root
19
+ - Wait for completion - framework components will load correctly
20
+ - TypeScript imports will resolve properly
21
+
22
+ **Step 2: Create pages correctly**
23
+ - Name files ending in `Page.tsx` (e.g., `HomePage.tsx`)
24
+ - Place them in `src/pages/` folder
25
+ - Framework will auto-discover and route them
26
+ - Navigation will show them automatically
27
+
28
+ **Step 3: Configure app**
29
+ - Edit `src/config/app.ts` with your preset and app name
30
+ - Framework will use your configuration
31
+ - Footer and legal links will be included automatically
32
+
33
+ **Step 4: Customize via config files**
34
+ - Override defaults in `src/config/app.ts`
35
+ - Override themes in `src/themes.css`
36
+ - Framework preserves your changes on updates
37
+
13
38
 
14
39
  ** dndev ** is our custom CLI, dndev --help for info.
15
40
 
16
41
 
17
42
  **🧠 PHILOSOPHY & MINDSET (READ THIS):**
43
+
44
+ **CRITICAL: ALL YOU NEED TO DO IS FOLLOW OUR NAMING CONVENTIONS + FILE STRUCTURE CONVENTIONS AND FOCUS ON THE INSIDE OF YOUR PAGES, WITH OUR COMPONENTS. EVERYTHING ELSE IS HANDLED. JUST TRUST THE FRAMEWORK AND CODE AS FEW AS POSSIBLE.**
45
+
18
46
  * **Speed > Polish:** Your goal is to reach UAT (User Acceptance Testing) fast. The app should look "good enough" (80%) using standard components.
19
47
  * **Composition > Customization:** Do not waste time writing CSS to make it "perfect" pixel-wise. Drop components, use props, move on.
20
48
  * **Standardize:** If it looks like a standard DoNotDev app, you succeeded. If you are writing custom CSS to fight the framework, you failed.
21
49
  * **Polishing:** Deep styling is for *after* the core functionality is approved and the User asks you to polish, with their preferred method.
50
+ * **Trust the Framework:** Navigation, routing, layouts, auth, themes, i18n - all handled automatically. Focus on page content only.
22
51
 
23
52
  ---
24
53
 
@@ -49,19 +78,135 @@ import type { PageMeta } from '@donotdev/core';
49
78
 
50
79
  ## New App Setup
51
80
 
81
+ **CRITICAL: Follow these steps IN ORDER. Complete each step before moving to the next.**
82
+
83
+ **✅ SCAFFOLDING PHILOSOPHY:**
84
+ The `dndev init` or `dndev create-app` commands create files with working defaults. Your job is to UPDATE these scaffolded files with your specific needs - update values, add content, customize configuration. The scaffolded files are correctly structured and framework-ready. Preserve the structure and imports, update the values and content.
85
+
86
+ ### Step 1: Create Project (if starting from scratch)
87
+ ```bash
88
+ dndev init my-project-name
89
+ # OR if adding to existing project:
90
+ cd existing-project
91
+ dndev create-app my-app-name
92
+ ```
93
+
94
+ ### Step 2: Install Dependencies (REQUIRED - FIRST STEP)
95
+ ```bash
96
+ cd my-project-name # or cd apps/my-app-name
97
+ bun install
98
+ ```
99
+ **✅ CRITICAL:** Run `bun install` as the first step. This installs all framework dependencies and enables framework components to work correctly.
100
+
101
+ ### Step 3: Configure App (REQUIRED)
102
+ **CRITICAL:** The scaffolding process creates these files with working defaults. UPDATE them with your specific needs - do not replace them entirely.
103
+
104
+ **File: `src/config/app.ts`** (scaffolded - update with your values):
105
+ ```typescript
106
+ import type { AppConfig } from '@donotdev/core';
107
+
108
+ export const appConfig: AppConfig = {
109
+ preset: 'landing', // Update: Choose your preset (landing | admin | moolti | docs | blog | game | plain)
110
+ app: {
111
+ name: 'My App', // Update: Your app name
112
+ url: 'https://myapp.com', // Update: Your app URL
113
+ },
114
+ };
115
+ ```
116
+
117
+ **File: `src/config/legal.ts`** (scaffolded - update with your legal pages):
118
+ ```typescript
119
+ export const legalConfig = {
120
+ // Update: Add your legal pages (privacy, terms, etc.)
121
+ };
122
+ ```
123
+
124
+ **File: `vite.config.ts`** (scaffolded - already configured correctly):
125
+ ```typescript
126
+ import { defineViteConfig } from '@donotdev/core/vite';
127
+ import { appConfig } from './src/config/app';
128
+
129
+ export default defineViteConfig({
130
+ appConfig, // Already configured - framework imports your appConfig
131
+ });
132
+ ```
133
+
134
+ **✅ UPDATE STRATEGY:**
135
+ - Scaffolded files are already correctly structured
136
+ - Update values (app name, preset, URLs) to match your needs
137
+ - Keep the file structure and imports as-is
138
+ - Framework expects these exact file paths and exports
139
+
140
+ **✅ CORRECT FILE PATHS:**
141
+ - `src/config/app.ts` - Place in `src/config/` folder
142
+ - `src/config/legal.ts` - Place in `src/config/` folder
143
+ - `vite.config.ts` - Place at project root (same level as `package.json`)
144
+ - `src/pages/*Page.tsx` - Place in `src/pages/` folder
145
+
146
+ ### Step 4: Add Logo (Optional but recommended)
147
+ Drop `logo.svg` in `public/` folder. Framework auto-generates favicon, icons, PWA assets.
148
+
149
+ ### Step 5: Create or Update Pages
150
+ **Scaffolding creates `src/pages/HomePage.tsx` with a working example. UPDATE it with your content:**
151
+
152
+ ```tsx
153
+ import { PageContainer } from '@donotdev/ui';
154
+
155
+ export default function HomePage() {
156
+ return <PageContainer><h1>Hello</h1></PageContainer>;
157
+ }
158
+ ```
159
+
160
+ **✅ UPDATE STRATEGY:**
161
+ - Scaffolded `HomePage.tsx` is already correctly structured
162
+ - Update the content inside `PageContainer` with your components
163
+ - Keep the imports and export structure as-is
164
+ - Add more pages by creating new `*Page.tsx` files in `src/pages/`
165
+
166
+ ### Step 6: Verify Setup (BEFORE running dev)
167
+ **Check these files exist:**
168
+ - ✅ `src/config/app.ts` exists
169
+ - ✅ `vite.config.ts` exists and imports `appConfig` from `src/config/app.ts`
170
+ - ✅ `src/pages/HomePage.tsx` exists (or at least one `*Page.tsx` file)
171
+ - ✅ `package.json` exists with `@donotdev/*` dependencies
172
+ - ✅ `bun install` completed successfully
52
173
 
53
- **If not scaffolded:** `dndev create-app`
174
+ ### Step 7: Run Development Server
175
+ ```bash
176
+ bun run dev
177
+ ```
178
+
179
+ **Expected output:**
180
+ - Server starts on `http://localhost:5173` (or configured port)
181
+ - No "Cannot find module" errors
182
+ - Browser shows your app (may show watermark if no license key)
54
183
 
55
- **Configure:**
56
- 1. `config/app.ts` - Choose layout preset + footer links + auth behavior (if needed)
57
- 2. `config/legal.ts` - Set legal pages data
58
- 3. `public/logo.svg` - Drop logo (framework generates rest - optional)
184
+ **If you see errors:**
185
+ 1. **"Cannot find module '@donotdev/...'"** Run `bun install` again
186
+ 2. **"Cannot find module './src/config/app'"** → Check `vite.config.ts` path is correct
187
+ 3. **"No routes found"** Check you have `*Page.tsx` files in `src/pages/`
188
+ 4. **TypeScript errors** → Run `bun run type-check` to see details
189
+
190
+ **✅ ALWAYS DO:**
191
+ - Run `bun install` first - required for dependencies
192
+ - Create pages in `src/pages/` folder - framework discovers them automatically
193
+ - Name files ending in `Page.tsx` - framework routes them automatically
194
+ - Trust framework defaults - routing, navigation, layouts are automatic
195
+ - Use preset components - LanguageSelector, ThemeToggle, AuthMenu are included automatically
59
196
 
60
197
  ---
61
198
 
62
199
  ## Generic Conventions
63
200
 
64
- **Routing:** Drop `*Page.tsx` files in `pages/**` → auto-discovered. Use `PageMeta` for routes, auth, icons.
201
+ **File Routing Rule: Only files ending in `Page.tsx` inside `src/pages` become routes.**
202
+
203
+ **✅ ROUTING RULES:**
204
+ - Name files with `Page.tsx` suffix (e.g., `HomePage.tsx`, `AboutPage.tsx`)
205
+ - Place files inside `src/pages/` directory (or subdirectories)
206
+ - Framework auto-discovers routes from `src/pages/*Page.tsx` files
207
+ - Framework automatically generates navigation from discovered routes
208
+
209
+ **Routing:** Drop `*Page.tsx` files in `src/pages/**` → auto-discovered. Use `PageMeta` for routes, auth, icons.
65
210
 
66
211
  **i18n:** Drop `<namespace>_<lng>.json` in `/locales` (eager) or `/pages/locales` (lazy). Framework auto-discovers languages.
67
212
 
@@ -69,6 +214,21 @@ import type { PageMeta } from '@donotdev/core';
69
214
 
70
215
  ---
71
216
 
217
+ ## Success Checklist
218
+
219
+ **✅ Follow these to ensure success:**
220
+
221
+ 1. **✅ Always name pages with `Page.tsx` suffix** - Example: `HomePage.tsx`, `AboutPage.tsx`
222
+ 2. **✅ Always run `bun install` first** - Required before any other commands
223
+ 3. **✅ Trust framework routing** - Framework auto-discovers routes from `src/pages/*Page.tsx`
224
+ 4. **✅ Use preset components** - LanguageSelector, ThemeToggle, AuthMenu are included automatically
225
+ 5. **✅ Configure via config files** - Edit `src/config/app.ts`, never modify `node_modules`
226
+ 6. **✅ Create pages in `src/pages/` folder** - Framework discovers them automatically
227
+ 7. **✅ Configure `src/config/app.ts`** - Set your preset and app name
228
+ 8. **✅ Run `bun install` before `bun run dev`** - Dependencies must be installed first
229
+
230
+ ---
231
+
72
232
  ## Landing Page Example
73
233
 
74
234
  ```tsx
@@ -91,7 +251,7 @@ export default function HomePage() {
91
251
  </Section>
92
252
 
93
253
  <Section title="Layout Examples">
94
- <Grid cols={2} gap="medium">
254
+ <Grid cols={[1, 1, 2, 2]} gap="medium">
95
255
  <Card title="Left Column" />
96
256
  <Card title="Right Column" />
97
257
  </Grid>
@@ -115,6 +275,68 @@ export default function HomePage() {
115
275
 
116
276
  ---
117
277
 
278
+ ---
279
+
280
+ ## Required File Structure
281
+
282
+ **CRITICAL:** Your project MUST have this exact structure:
283
+
284
+ ```
285
+ my-project/
286
+ ├── package.json # At root - contains dependencies
287
+ ├── vite.config.ts # At root - imports appConfig
288
+ ├── src/
289
+ │ ├── config/
290
+ │ │ ├── app.ts # REQUIRED - app configuration
291
+ │ │ └── legal.ts # REQUIRED - legal pages config
292
+ │ ├── pages/
293
+ │ │ └── HomePage.tsx # Your pages (must end in Page.tsx)
294
+ │ ├── App.tsx # App entry point
295
+ │ └── main.tsx # Vite entry point
296
+ └── public/
297
+ └── logo.svg # Optional - framework generates assets
298
+ ```
299
+
300
+ **✅ CORRECT FILE PATHS EXAMPLES:**
301
+ - ✅ `src/config/app.ts` (correct location)
302
+ - ✅ `src/pages/HomePage.tsx` (correct location)
303
+ - ✅ `src/pages/AboutPage.tsx` (correct - in pages subfolder)
304
+ - ✅ `src/pages/blog/BlogPostPage.tsx` (correct - nested pages work)
305
+
306
+ ---
307
+
308
+ ## Troubleshooting
309
+
310
+ ### "Cannot find module '@donotdev/...'"
311
+ **Solution:** Run `bun install` in the project root. Dependencies must be installed before running the app.
312
+
313
+ ### "No routes found"
314
+ **Solution:**
315
+ 1. Check files are in `src/pages/` folder
316
+ 2. Check files end in `Page.tsx` (not `.tsx` or `.ts`)
317
+ 3. Check files are exported as default: `export default function HomePage()`
318
+
319
+ ### "Cannot find module './src/config/app'"
320
+ **Solution:**
321
+ 1. Check `vite.config.ts` is at project root (same level as `package.json`)
322
+ 2. Check `src/config/app.ts` exists
323
+ 3. Check import path in `vite.config.ts`: `import { appConfig } from './src/config/app';`
324
+
325
+ ### App shows blank page
326
+ **Solution:**
327
+ 1. Check browser console for errors
328
+ 2. Verify at least one `*Page.tsx` file exists in `src/pages/`
329
+ 3. Verify `vite.config.ts` imports `appConfig` correctly
330
+ 4. Check `src/App.tsx` uses `ViteAppProviders` with `config={appConfig}`
331
+
332
+ ### TypeScript errors
333
+ **Solution:**
334
+ 1. Run `bun run type-check` to see all errors
335
+ 2. Ensure all `@donotdev/*` packages are installed
336
+ 3. Check imports use root package names: `@donotdev/components`, not deep paths
337
+
338
+ ---
339
+
118
340
  **Component references:** [COMPONENTS_ATOMIC.md](./COMPONENTS_ATOMIC.md) | [COMPONENTS_UI.md](./COMPONENTS_UI.md) | [COMPONENTS_CRUD.md](./COMPONENTS_CRUD.md)
119
341
 
120
342
  **Full guides:** [INDEX.md](./INDEX.md) - 50-100 LOC per topic (SETUP_*.md, advanced/*.md)