create-aziz-app 2.0.15 → 3.0.1

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 (56) hide show
  1. package/README.md +3 -3
  2. package/bin/create-aziz-app.js +9 -9
  3. package/package.json +10 -11
  4. package/template/README.md +5 -5
  5. package/template/_framework/boot.js +3 -3
  6. package/template/_framework/hooks.js +1 -1
  7. package/template/{modules → _framework}/next-response.js +5 -13
  8. package/template/_framework/router.js +1 -1
  9. package/template/_framework/runtime.js +1 -1
  10. package/template/api/createUser.js +1 -1
  11. package/template/api/hello.js +1 -1
  12. package/template/api/loginUser.js +1 -1
  13. package/template/api/users.js +1 -1
  14. package/template/app/about/page.js +1 -1
  15. package/template/app/layout.js +1 -1
  16. package/template/components/Footer.js +1 -1
  17. package/template/components/Navbar.js +1 -1
  18. package/template/package.json +4 -7
  19. package/template/scripts/dev-server.js +1 -1
  20. package/template/.vscode/settings.json +0 -15
  21. package/template/api/getUser.js +0 -60
  22. package/template/api/getUserWithDB.js +0 -65
  23. package/template/app.config.js +0 -41
  24. package/template/app.html +0 -55
  25. package/template/components/Counter.jsx +0 -36
  26. package/template/components/Footer.jsx +0 -9
  27. package/template/components/Navbar.jsx +0 -17
  28. package/template/docs/API-GUIDE.md +0 -196
  29. package/template/docs/API-ROUTES.md +0 -538
  30. package/template/docs/AUTO-IMPORT.md +0 -99
  31. package/template/docs/AUTO-REGISTRATION.md +0 -248
  32. package/template/docs/CSS-FRAMEWORKS.md +0 -221
  33. package/template/docs/DEV-SERVER.md +0 -184
  34. package/template/docs/GETTING-STARTED.md +0 -205
  35. package/template/docs/HOW-IT-WORKS.md +0 -362
  36. package/template/docs/NEXTJS-APP-ROUTER.md +0 -536
  37. package/template/docs/NEXTJS-COMPARISON.md +0 -473
  38. package/template/docs/QUICK-START.md +0 -111
  39. package/template/docs/STYLING.md +0 -269
  40. package/template/docs/TROUBLESHOOTING.md +0 -282
  41. package/template/modules/README.md +0 -129
  42. package/template/modules/api.js +0 -44
  43. package/template/modules/auto-import.js +0 -130
  44. package/template/modules/router.js +0 -218
  45. package/template/modules/state.js +0 -248
  46. package/template/package-lock.json +0 -13
  47. package/template/pages/About.jsx +0 -48
  48. package/template/pages/ApiDemo.jsx +0 -209
  49. package/template/pages/Contact.jsx +0 -25
  50. package/template/pages/Example.jsx +0 -59
  51. package/template/pages/Home.jsx +0 -39
  52. package/template/pages/HooksDemo.jsx +0 -194
  53. package/template/pages/test.jsx +0 -72
  54. package/template/scripts/build.js +0 -81
  55. package/template/scripts/generate-imports.js +0 -88
  56. package/template/tailwind.config.js +0 -17
@@ -1,99 +0,0 @@
1
- # 🚀 Auto-Import System
2
-
3
- ## How It Works
4
-
5
- Instead of manually adding `<script>` tags, just run one command and all your files are automatically imported!
6
-
7
- ## Usage
8
-
9
- ### 1. Create Your Files
10
-
11
- Just create files in the appropriate folders:
12
-
13
- ```
14
- pages/MyNewPage.jsx ← Automatically becomes a route
15
- components/Button.jsx ← Automatically available
16
- api/todos.js ← Automatically registered
17
- ```
18
-
19
- ### 2. Run the Build Command
20
-
21
- ```bash
22
- cd template
23
- node generate-imports.js
24
- ```
25
-
26
- Or from the root:
27
- ```bash
28
- npm run build
29
- ```
30
-
31
- ### 3. Refresh Your Browser
32
-
33
- That's it! Your new files are now loaded.
34
-
35
- ## What Gets Auto-Imported
36
-
37
- - **`api/*.js`** - All API route files
38
- - **`components/*.jsx`** and **`components/*.js`** - All component files
39
- - **`pages/*.jsx`** and **`pages/*.js`** - All page files
40
-
41
- ## Example Workflow
42
-
43
- ```bash
44
- # 1. Create a new page
45
- echo '/** @jsx h */
46
- registerPage("profile", ProfilePage);
47
- function ProfilePage() {
48
- return <div><h1>Profile</h1></div>;
49
- }' > pages/Profile.jsx
50
-
51
- # 2. Run the generator
52
- node generate-imports.js
53
-
54
- # 3. Refresh browser and navigate to #/profile
55
- ```
56
-
57
- ## How It Works
58
-
59
- The `generate-imports.js` script:
60
- 1. Scans the `api/`, `components/`, and `pages/` folders
61
- 2. Finds all `.js` and `.jsx` files
62
- 3. Automatically updates `app.html` with the correct `<script>` tags
63
- 4. Maintains the correct loading order
64
-
65
- ## Benefits
66
-
67
- ✅ **No manual script tags** - Just create files and run the command
68
- ✅ **Automatic discovery** - Scans folders for you
69
- ✅ **Correct order** - Loads modules → API → components → pages
70
- ✅ **Simple** - One command does everything
71
-
72
- ## Tips
73
-
74
- - Run `node generate-imports.js` after creating/deleting files
75
- - The script is safe to run multiple times
76
- - It preserves your HTML structure
77
- - Works with both `.js` and `.jsx` files
78
-
79
- ## Troubleshooting
80
-
81
- **Script not found?**
82
- ```bash
83
- cd template
84
- node generate-imports.js
85
- ```
86
-
87
- **New page not showing?**
88
- 1. Make sure you ran `node generate-imports.js`
89
- 2. Check that your file is in the `pages/` folder
90
- 3. Refresh your browser (hard refresh: Ctrl+Shift+R)
91
-
92
- **Want to watch for changes automatically?**
93
- Install nodemon:
94
- ```bash
95
- npm install -g nodemon
96
- nodemon --watch pages --watch components --watch api --exec "node generate-imports.js"
97
- ```
98
-
99
- Now every time you create/modify a file, it auto-regenerates!
@@ -1,248 +0,0 @@
1
- # Auto-Registration Guide
2
-
3
- ## Overview
4
-
5
- Pages automatically register themselves based on their function name. No need to call `registerPage()` manually!
6
-
7
- ## How It Works
8
-
9
- ### ✨ Automatic Registration
10
-
11
- Just name your page function with "Page" at the end:
12
-
13
- ```jsx
14
- /** @jsx h */
15
-
16
- // That's it! Automatically becomes route "#/example"
17
- function ExamplePage() {
18
- return (
19
- <div>
20
- <h1>Example Page</h1>
21
- <p>This page auto-registered!</p>
22
- </div>
23
- );
24
- }
25
- ```
26
-
27
- ### Function Name → Route Mapping
28
-
29
- The system converts your function name to a route:
30
-
31
- | Function Name | Auto Route | URL |
32
- |--------------|------------|-----|
33
- | `HomePage()` | `home` | `#/home` |
34
- | `AboutPage()` | `about` | `#/about` |
35
- | `ContactPage()` | `contact` | `#/contact` |
36
- | `UserProfilePage()` | `userprofile` | `#/userprofile` |
37
- | `MyAwesomePage()` | `myawesome` | `#/myawesome` |
38
-
39
- **Rule:** Remove "Page" suffix and convert to lowercase.
40
-
41
- ## Manual Registration (Optional)
42
-
43
- You can still manually register for custom route names:
44
-
45
- ```jsx
46
- /** @jsx h */
47
-
48
- // Custom route name with dashes or different naming
49
- registerPage("user-profile", UserProfilePage);
50
-
51
- function UserProfilePage() {
52
- return <div><h1>User Profile</h1></div>;
53
- }
54
- ```
55
-
56
- ### When to Use Manual Registration
57
-
58
- - **Custom route names** with dashes: `"api-demo"`, `"user-settings"`
59
- - **Multiple routes** pointing to same component
60
- - **Override auto-registration** with different name
61
-
62
- ## Examples
63
-
64
- ### Example 1: Simple Auto Page
65
-
66
- ```jsx
67
- /** @jsx h */
68
-
69
- function ProductsPage() {
70
- return (
71
- <div>
72
- <h1>Products</h1>
73
- <p>Browse our products</p>
74
- </div>
75
- );
76
- }
77
- ```
78
-
79
- Access at: `#/products`
80
-
81
- ### Example 2: With State
82
-
83
- ```jsx
84
- /** @jsx h */
85
-
86
- function DashboardPage() {
87
- const [count, setCount] = useState(0);
88
-
89
- return (
90
- <div>
91
- <h1>Dashboard</h1>
92
- <p>Count: {count}</p>
93
- <button onClick={() => setCount(count + 1)}>
94
- Increment
95
- </button>
96
- </div>
97
- );
98
- }
99
- ```
100
-
101
- Access at: `#/dashboard`
102
-
103
- ### Example 3: Manual Registration
104
-
105
- ```jsx
106
- /** @jsx h */
107
-
108
- // Want route "#/user-settings" instead of "#/usersettings"
109
- registerPage("user-settings", UserSettingsPage);
110
-
111
- function UserSettingsPage() {
112
- return (
113
- <div>
114
- <h1>User Settings</h1>
115
- </div>
116
- );
117
- }
118
- ```
119
-
120
- Access at: `#/user-settings`
121
-
122
- ## Creating a New Page
123
-
124
- ### Step 1: Create the file
125
-
126
- Create `pages/MyNewPage.jsx`:
127
-
128
- ```jsx
129
- /** @jsx h */
130
-
131
- function MyNewPage() {
132
- return (
133
- <div>
134
- <h1>My New Page</h1>
135
- <div class="card">
136
- <p>This is my new page!</p>
137
- </div>
138
- </div>
139
- );
140
- }
141
- ```
142
-
143
- ### Step 2: That's it!
144
-
145
- The dev server will:
146
- 1. Detect the new file
147
- 2. Auto-generate the import in `app.html`
148
- 3. Auto-register the route as `#/mynew`
149
- 4. Reload the browser
150
-
151
- Navigate to `#/mynew` and your page appears!
152
-
153
- ## Debugging
154
-
155
- ### Check Auto-Registration
156
-
157
- Open browser console when the app starts. You'll see:
158
-
159
- ```
160
- 📄 Auto-registered: home → HomePage()
161
- 📄 Auto-registered: about → AboutPage()
162
- 📄 Auto-registered: contact → ContactPage()
163
- 📄 Auto-registered: mynew → MyNewPage()
164
- ```
165
-
166
- ### Page Not Found?
167
-
168
- 1. **Check function name** - Must end with "Page"
169
- 2. **Check file is loaded** - Look in `app.html` for the script tag
170
- 3. **Check console** - Look for auto-registration message
171
- 4. **Try manual registration** - Use `registerPage("route", ComponentPage)`
172
-
173
- ## Best Practices
174
-
175
- ### ✅ Do This
176
-
177
- ```jsx
178
- // Clear, descriptive names
179
- function HomePage() { }
180
- function AboutPage() { }
181
- function ContactPage() { }
182
- function UserProfilePage() { }
183
- ```
184
-
185
- ### ❌ Avoid This
186
-
187
- ```jsx
188
- // Won't auto-register (missing "Page" suffix)
189
- function Home() { }
190
- function About() { }
191
-
192
- // Will create weird routes
193
- function Page() { } // route: "" (empty)
194
- function MyPage() { } // route: "my" (too generic)
195
- ```
196
-
197
- ## Migration Guide
198
-
199
- ### Old Way (Still Works)
200
-
201
- ```jsx
202
- /** @jsx h */
203
-
204
- registerPage("about", AboutPage);
205
-
206
- function AboutPage() {
207
- return <div><h1>About</h1></div>;
208
- }
209
- ```
210
-
211
- ### New Way (Simpler)
212
-
213
- ```jsx
214
- /** @jsx h */
215
-
216
- function AboutPage() {
217
- return <div><h1>About</h1></div>;
218
- }
219
- ```
220
-
221
- Both work! The new way is just less code.
222
-
223
- ## Advanced: Multiple Routes
224
-
225
- Point multiple routes to the same component:
226
-
227
- ```jsx
228
- /** @jsx h */
229
-
230
- // Auto-registers as "dashboard"
231
- function DashboardPage() {
232
- return <div><h1>Dashboard</h1></div>;
233
- }
234
-
235
- // Also register as "home" and "index"
236
- registerPage("home", DashboardPage);
237
- registerPage("index", DashboardPage);
238
- ```
239
-
240
- Now `#/dashboard`, `#/home`, and `#/index` all show the same page!
241
-
242
- ## Summary
243
-
244
- - **Function name ends with "Page"** → Auto-registers
245
- - **Route name** = function name without "Page", lowercase
246
- - **Manual registration** still available for custom names
247
- - **Dev server** handles everything automatically
248
- - **Zero configuration** needed for basic pages
@@ -1,221 +0,0 @@
1
- # CSS Frameworks Guide
2
-
3
- ## Overview
4
-
5
- Aziz App supports three CSS options:
6
- 1. **Custom CSS** - Built-in custom styles
7
- 2. **Bootstrap 5** - Popular component framework
8
- 3. **Tailwind CSS** - Utility-first framework
9
-
10
- ## Bootstrap 5
11
-
12
- ### What's Included
13
-
14
- When you choose Bootstrap, the CLI automatically adds:
15
- - Bootstrap 5.3.2 CSS (CDN)
16
- - Bootstrap Icons
17
- - Bootstrap 5 JS Bundle
18
- - Updated Navbar with Bootstrap classes
19
- - Updated Footer with Bootstrap classes
20
-
21
- ### Using Bootstrap
22
-
23
- ```javascript
24
- // Example: Bootstrap Button
25
- <button class="btn btn-primary">Click Me</button>
26
-
27
- // Example: Bootstrap Card
28
- <div class="card">
29
- <div class="card-body">
30
- <h5 class="card-title">Card Title</h5>
31
- <p class="card-text">Some content</p>
32
- </div>
33
- </div>
34
-
35
- // Example: Bootstrap Grid
36
- <div class="container">
37
- <div class="row">
38
- <div class="col-md-6">Column 1</div>
39
- <div class="col-md-6">Column 2</div>
40
- </div>
41
- </div>
42
- ```
43
-
44
- ### Bootstrap Components
45
-
46
- Available components:
47
- - Buttons, Cards, Modals
48
- - Forms, Inputs, Validation
49
- - Navbar, Dropdowns, Tabs
50
- - Alerts, Badges, Progress bars
51
- - Grid system, Flexbox utilities
52
-
53
- ### Resources
54
-
55
- - [Bootstrap Docs](https://getbootstrap.com/docs/5.3/)
56
- - [Bootstrap Icons](https://icons.getbootstrap.com/)
57
- - [Bootstrap Examples](https://getbootstrap.com/docs/5.3/examples/)
58
-
59
- ## Tailwind CSS
60
-
61
- ### What's Included
62
-
63
- When you choose Tailwind, the CLI automatically adds:
64
- - Tailwind CSS CDN (Play CDN)
65
- - Custom color configuration
66
- - Updated Navbar with Tailwind classes
67
- - Updated Footer with Tailwind classes
68
-
69
- ### Using Tailwind
70
-
71
- ```javascript
72
- // Example: Tailwind Button
73
- <button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
74
- Click Me
75
- </button>
76
-
77
- // Example: Tailwind Card
78
- <div class="bg-white shadow-lg rounded-lg p-6">
79
- <h2 class="text-2xl font-bold mb-4">Card Title</h2>
80
- <p class="text-gray-700">Some content</p>
81
- </div>
82
-
83
- // Example: Tailwind Grid
84
- <div class="container mx-auto">
85
- <div class="grid grid-cols-2 gap-4">
86
- <div>Column 1</div>
87
- <div>Column 2</div>
88
- </div>
89
- </div>
90
- ```
91
-
92
- ### Tailwind Utilities
93
-
94
- Common utilities:
95
- - Layout: `flex`, `grid`, `container`
96
- - Spacing: `p-4`, `m-2`, `space-x-4`
97
- - Colors: `bg-blue-500`, `text-red-600`
98
- - Typography: `text-xl`, `font-bold`
99
- - Effects: `shadow-lg`, `rounded-lg`
100
-
101
- ### Custom Colors
102
-
103
- Pre-configured colors:
104
- - `primary` - #61dafb (Aziz blue)
105
- - `dark` - #282c34 (Dark background)
106
-
107
- ```javascript
108
- <div class="bg-primary text-dark">Custom colors!</div>
109
- ```
110
-
111
- ### Resources
112
-
113
- - [Tailwind Docs](https://tailwindcss.com/docs)
114
- - [Tailwind Cheat Sheet](https://nerdcave.com/tailwind-cheat-sheet)
115
- - [Tailwind Components](https://tailwindui.com/components)
116
-
117
- ## Custom CSS
118
-
119
- ### What's Included
120
-
121
- The default custom CSS includes:
122
- - Reset styles
123
- - Navbar and Footer styles
124
- - Card, Button, Form styles
125
- - Utility classes
126
- - Responsive design
127
-
128
- ### Using Custom CSS
129
-
130
- ```javascript
131
- // Example: Custom Button
132
- <button class="btn btn-primary">Click Me</button>
133
-
134
- // Example: Custom Card
135
- <div class="card">
136
- <h2>Card Title</h2>
137
- <p>Some content</p>
138
- </div>
139
-
140
- // Example: Custom Form
141
- <form>
142
- <input type="text" placeholder="Enter text" />
143
- <button class="btn btn-primary">Submit</button>
144
- </form>
145
- ```
146
-
147
- ### Available Classes
148
-
149
- **Buttons:**
150
- - `.btn` - Base button
151
- - `.btn-primary` - Primary button (blue)
152
- - `.btn-danger` - Danger button (red)
153
- - `.btn-grey` - Grey button
154
-
155
- **Layout:**
156
- - `.card` - Card container
157
- - `.count-display` - Large number display
158
- - `.counter-actions` - Button group
159
-
160
- **Forms:**
161
- - `input`, `textarea` - Styled inputs
162
- - `form` - Styled form
163
-
164
- ## Switching Frameworks
165
-
166
- ### After Project Creation
167
-
168
- If you want to switch frameworks after creating your project:
169
-
170
- **To Bootstrap:**
171
- 1. Add Bootstrap CDN to `app.html`:
172
- ```html
173
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
174
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
175
- ```
176
-
177
- 2. Update your components with Bootstrap classes
178
-
179
- **To Tailwind:**
180
- 1. Add Tailwind CDN to `app.html`:
181
- ```html
182
- <script src="https://cdn.tailwindcss.com"></script>
183
- ```
184
-
185
- 2. Update your components with Tailwind classes
186
-
187
- **To Custom CSS:**
188
- 1. Remove framework CDN links from `app.html`
189
- 2. Update your components with custom classes
190
-
191
- ## Best Practices
192
-
193
- ### Bootstrap
194
- - Use semantic HTML with Bootstrap classes
195
- - Leverage Bootstrap's grid system
196
- - Use Bootstrap components for consistency
197
- - Customize with Bootstrap variables
198
-
199
- ### Tailwind
200
- - Use utility classes directly in JSX
201
- - Combine utilities for complex designs
202
- - Use responsive prefixes (`md:`, `lg:`)
203
- - Extract common patterns into components
204
-
205
- ### Custom CSS
206
- - Keep styles in `<style>` tag in `app.html`
207
- - Use BEM naming convention
208
- - Create reusable utility classes
209
- - Keep specificity low
210
-
211
- ## Tips
212
-
213
- 1. **Consistency** - Stick to one framework per project
214
- 2. **Performance** - CDN links are cached by browsers
215
- 3. **Customization** - All frameworks can be customized
216
- 4. **Learning** - Start with one framework and master it
217
- 5. **Components** - Build reusable components regardless of framework
218
-
219
- ## Examples
220
-
221
- Check the example pages in your project to see the chosen framework in action!