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.
- package/README.md +3 -3
- package/bin/create-aziz-app.js +9 -9
- package/package.json +10 -11
- package/template/README.md +5 -5
- package/template/_framework/boot.js +3 -3
- package/template/_framework/hooks.js +1 -1
- package/template/{modules → _framework}/next-response.js +5 -13
- package/template/_framework/router.js +1 -1
- package/template/_framework/runtime.js +1 -1
- package/template/api/createUser.js +1 -1
- package/template/api/hello.js +1 -1
- package/template/api/loginUser.js +1 -1
- package/template/api/users.js +1 -1
- package/template/app/about/page.js +1 -1
- package/template/app/layout.js +1 -1
- package/template/components/Footer.js +1 -1
- package/template/components/Navbar.js +1 -1
- package/template/package.json +4 -7
- package/template/scripts/dev-server.js +1 -1
- package/template/.vscode/settings.json +0 -15
- package/template/api/getUser.js +0 -60
- package/template/api/getUserWithDB.js +0 -65
- package/template/app.config.js +0 -41
- package/template/app.html +0 -55
- package/template/components/Counter.jsx +0 -36
- package/template/components/Footer.jsx +0 -9
- package/template/components/Navbar.jsx +0 -17
- package/template/docs/API-GUIDE.md +0 -196
- package/template/docs/API-ROUTES.md +0 -538
- package/template/docs/AUTO-IMPORT.md +0 -99
- package/template/docs/AUTO-REGISTRATION.md +0 -248
- package/template/docs/CSS-FRAMEWORKS.md +0 -221
- package/template/docs/DEV-SERVER.md +0 -184
- package/template/docs/GETTING-STARTED.md +0 -205
- package/template/docs/HOW-IT-WORKS.md +0 -362
- package/template/docs/NEXTJS-APP-ROUTER.md +0 -536
- package/template/docs/NEXTJS-COMPARISON.md +0 -473
- package/template/docs/QUICK-START.md +0 -111
- package/template/docs/STYLING.md +0 -269
- package/template/docs/TROUBLESHOOTING.md +0 -282
- package/template/modules/README.md +0 -129
- package/template/modules/api.js +0 -44
- package/template/modules/auto-import.js +0 -130
- package/template/modules/router.js +0 -218
- package/template/modules/state.js +0 -248
- package/template/package-lock.json +0 -13
- package/template/pages/About.jsx +0 -48
- package/template/pages/ApiDemo.jsx +0 -209
- package/template/pages/Contact.jsx +0 -25
- package/template/pages/Example.jsx +0 -59
- package/template/pages/Home.jsx +0 -39
- package/template/pages/HooksDemo.jsx +0 -194
- package/template/pages/test.jsx +0 -72
- package/template/scripts/build.js +0 -81
- package/template/scripts/generate-imports.js +0 -88
- package/template/tailwind.config.js +0 -17
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ⚡
|
|
1
|
+
# ⚡ Aziz.js
|
|
2
2
|
|
|
3
3
|
> A lightweight Next.js clone — file-based routing, React hooks, server-side API routes, ES module imports. **Zero dependencies. Instant startup.**
|
|
4
4
|
|
|
@@ -10,9 +10,9 @@ npx create-aziz-app my-app
|
|
|
10
10
|
|
|
11
11
|
## What is this?
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Aziz.js gives you the Next.js developer experience without the weight:
|
|
14
14
|
|
|
15
|
-
| |
|
|
15
|
+
| | Aziz.js | Next.js |
|
|
16
16
|
|--|---------|---------|
|
|
17
17
|
| Bundle size | **~50KB** | ~400KB+ |
|
|
18
18
|
| Dependencies | **0** | 20+ |
|
package/bin/create-aziz-app.js
CHANGED
|
@@ -17,14 +17,14 @@ function question(query) {
|
|
|
17
17
|
|
|
18
18
|
// Main function
|
|
19
19
|
async function main() {
|
|
20
|
-
console.log(`\n⚡ Welcome to Aziz
|
|
21
|
-
console.log(`🎨 A
|
|
20
|
+
console.log(`\n⚡ Welcome to Aziz.js!\n`);
|
|
21
|
+
console.log(`🎨 A lightweight Next.js clone — file-based routing, React hooks, API routes\n`);
|
|
22
22
|
|
|
23
23
|
// Get project name
|
|
24
24
|
let projectName = process.argv[2];
|
|
25
25
|
if (!projectName) {
|
|
26
|
-
projectName = await question('📁 Project name (my-aziz-app): ');
|
|
27
|
-
projectName = projectName.trim() || 'my-aziz-app';
|
|
26
|
+
projectName = await question('📁 Project name (my-aziz-js-app): ');
|
|
27
|
+
projectName = projectName.trim() || 'my-aziz-js-app';
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// Validate project name
|
|
@@ -97,7 +97,7 @@ async function main() {
|
|
|
97
97
|
setupCSSFramework(targetDir, features.cssFramework);
|
|
98
98
|
|
|
99
99
|
console.log(`✅ Done! Your project is ready.\n`);
|
|
100
|
-
console.log(`🎉 Welcome to Aziz
|
|
100
|
+
console.log(`🎉 Welcome to Aziz.js\n`);
|
|
101
101
|
console.log(`📁 Created project: ${projectName}\n`);
|
|
102
102
|
console.log(`👉 Get started:\n`);
|
|
103
103
|
console.log(` cd ${projectName}`);
|
|
@@ -307,7 +307,7 @@ function Navbar() {
|
|
|
307
307
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
|
308
308
|
<div class="container-fluid">
|
|
309
309
|
<span class="navbar-brand" onClick={() => navigate("home")} style={{ cursor: 'pointer' }}>
|
|
310
|
-
⚡
|
|
310
|
+
⚡ Aziz.js
|
|
311
311
|
</span>
|
|
312
312
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
|
313
313
|
<span class="navbar-toggler-icon"></span>
|
|
@@ -348,7 +348,7 @@ function Footer() {
|
|
|
348
348
|
return (
|
|
349
349
|
<footer class="bg-dark text-light text-center py-3 mt-auto">
|
|
350
350
|
<div class="container">
|
|
351
|
-
<p class="mb-0">Made with ⚡
|
|
351
|
+
<p class="mb-0">Made with ⚡ Aziz.js</p>
|
|
352
352
|
</div>
|
|
353
353
|
</footer>
|
|
354
354
|
);
|
|
@@ -382,7 +382,7 @@ function Navbar() {
|
|
|
382
382
|
class="text-primary text-xl font-bold cursor-pointer hover:text-blue-300 transition"
|
|
383
383
|
onClick={() => navigate("home")}
|
|
384
384
|
>
|
|
385
|
-
⚡
|
|
385
|
+
⚡ Aziz.js
|
|
386
386
|
</span>
|
|
387
387
|
<div class="flex space-x-4">
|
|
388
388
|
<a href="#/home" class={\`px-3 py-2 rounded-md text-sm font-medium transition \${path === "home" ? "bg-primary text-dark" : "text-gray-300 hover:bg-gray-700 hover:text-white"}\`}>
|
|
@@ -419,7 +419,7 @@ function Footer() {
|
|
|
419
419
|
return (
|
|
420
420
|
<footer class="bg-dark text-gray-400 text-center py-4 mt-auto">
|
|
421
421
|
<div class="container mx-auto">
|
|
422
|
-
<p>Made with ⚡
|
|
422
|
+
<p>Made with ⚡ Aziz.js</p>
|
|
423
423
|
</div>
|
|
424
424
|
</footer>
|
|
425
425
|
);
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-aziz-app",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
|
+
"description": "Create Aziz.js apps — lightweight Next.js clone with file-based routing, React hooks, and API routes",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"aziz.js",
|
|
7
|
+
"nextjs",
|
|
8
8
|
"framework",
|
|
9
9
|
"cli",
|
|
10
10
|
"create-app",
|
|
11
|
-
"routing",
|
|
12
|
-
"
|
|
11
|
+
"file-based-routing",
|
|
12
|
+
"react-hooks",
|
|
13
13
|
"api-routes",
|
|
14
|
-
"live-reload"
|
|
14
|
+
"live-reload",
|
|
15
|
+
"lightweight"
|
|
15
16
|
],
|
|
16
|
-
"license": "
|
|
17
|
+
"license": "MIT",
|
|
17
18
|
"author": "Syed Muhammad Aziz Ahmed",
|
|
18
19
|
"type": "commonjs",
|
|
19
20
|
"files": [
|
|
@@ -24,8 +25,6 @@
|
|
|
24
25
|
"create-aziz-app": "bin/create-aziz-app.js"
|
|
25
26
|
},
|
|
26
27
|
"scripts": {
|
|
27
|
-
"dev": "cd template && node scripts/dev-server.js"
|
|
28
|
-
"build": "cd template && node scripts/generate-imports.js",
|
|
29
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
28
|
+
"dev": "cd template && node scripts/dev-server.js"
|
|
30
29
|
}
|
|
31
30
|
}
|
package/template/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# ⚡
|
|
1
|
+
# ⚡ Aziz.js
|
|
2
2
|
|
|
3
3
|
A lightweight Next.js clone with file-based routing, React hooks, server-side API routes, and ES module imports — **zero dependencies, instant startup**.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
-
Next.js:
|
|
7
|
-
|
|
6
|
+
Next.js: ~400KB + 20 dependencies + 10s startup
|
|
7
|
+
Aziz.js: ~50KB + 0 dependencies + <1s startup
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
---
|
|
@@ -861,7 +861,7 @@ Click it to manually reload.
|
|
|
861
861
|
|
|
862
862
|
## Comparison with Next.js
|
|
863
863
|
|
|
864
|
-
| Feature |
|
|
864
|
+
| Feature | Aziz.js | Next.js |
|
|
865
865
|
|---------|---------|---------|
|
|
866
866
|
| File-based routing | ✅ | ✅ |
|
|
867
867
|
| `page.js` convention | ✅ | ✅ |
|
|
@@ -911,7 +911,7 @@ const AuthContext = createContext(null);
|
|
|
911
911
|
```
|
|
912
912
|
|
|
913
913
|
**Can I use this in production?**
|
|
914
|
-
|
|
914
|
+
Aziz.js is designed for development and learning. For production apps with SEO requirements, consider Next.js. For simple SPAs and internal tools, Aziz.js works great.
|
|
915
915
|
|
|
916
916
|
**How do I add authentication?**
|
|
917
917
|
```js
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// ============================================================
|
|
2
|
-
//
|
|
2
|
+
// Aziz.js Framework Boot
|
|
3
3
|
// Loads layout.js + page.js for the current route
|
|
4
4
|
// Handles client-side navigation like Next.js App Router
|
|
5
5
|
// ============================================================
|
|
@@ -14,7 +14,7 @@ window.Fragment = Fragment;
|
|
|
14
14
|
|
|
15
15
|
// Boot the app
|
|
16
16
|
async function boot() {
|
|
17
|
-
console.log('⚡
|
|
17
|
+
console.log('⚡ Aziz.js booting...');
|
|
18
18
|
|
|
19
19
|
// Initialize hooks system
|
|
20
20
|
initHooks();
|
|
@@ -22,7 +22,7 @@ async function boot() {
|
|
|
22
22
|
// Start the router
|
|
23
23
|
await router.init();
|
|
24
24
|
|
|
25
|
-
console.log('✅
|
|
25
|
+
console.log('✅ Aziz.js ready');
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
boot().catch(err => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// ============================================================
|
|
2
|
-
//
|
|
2
|
+
// Aziz.js Hooks
|
|
3
3
|
// React-identical hooks: useState, useEffect, useMemo,
|
|
4
4
|
// useCallback, useRef, useReducer, useContext
|
|
5
5
|
// ============================================================
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
// NextResponse
|
|
1
|
+
// NextResponse — identical to Next.js App Router API
|
|
2
|
+
// Used in api/ route handlers
|
|
3
|
+
|
|
2
4
|
class NextResponse {
|
|
3
5
|
constructor(body, init = {}) {
|
|
4
6
|
this.body = body;
|
|
@@ -40,19 +42,9 @@ class NextResponse {
|
|
|
40
42
|
static error() {
|
|
41
43
|
return new NextResponse(JSON.stringify({ error: 'Internal Server Error' }), {
|
|
42
44
|
status: 500,
|
|
43
|
-
headers: {
|
|
44
|
-
'Content-Type': 'application/json'
|
|
45
|
-
}
|
|
45
|
+
headers: { 'Content-Type': 'application/json' }
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
if (typeof module !== 'undefined' && module.exports) {
|
|
52
|
-
module.exports = { NextResponse };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Export for browser (if needed)
|
|
56
|
-
if (typeof window !== 'undefined') {
|
|
57
|
-
window.NextResponse = NextResponse;
|
|
58
|
-
}
|
|
50
|
+
module.exports = { NextResponse };
|
package/template/api/hello.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// API Route: /api/hello
|
|
2
2
|
// Next.js App Router style
|
|
3
3
|
|
|
4
|
-
const { NextResponse } = require('../
|
|
4
|
+
const { NextResponse } = require('../_framework/next-response');
|
|
5
5
|
|
|
6
6
|
async function GET(request) {
|
|
7
7
|
const { searchParams } = new URL(request.url);
|
package/template/api/users.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// API Route: /api/users
|
|
2
2
|
// Next.js App Router style
|
|
3
3
|
|
|
4
|
-
const { NextResponse } = require('../
|
|
4
|
+
const { NextResponse } = require('../_framework/next-response');
|
|
5
5
|
|
|
6
6
|
let users = [
|
|
7
7
|
{ id: 1, name: 'Aziz Ahmed', email: 'aziz@example.com', createdAt: new Date().toISOString() },
|
|
@@ -9,7 +9,7 @@ export default function Page() {
|
|
|
9
9
|
<h1>About 📖</h1>
|
|
10
10
|
|
|
11
11
|
<div class="card">
|
|
12
|
-
<h2>What is
|
|
12
|
+
<h2>What is Aziz.js?</h2>
|
|
13
13
|
<p>
|
|
14
14
|
A lightweight Next.js clone — file-based routing, React hooks,
|
|
15
15
|
server-side API routes, and ES module imports. Zero dependencies.
|
package/template/app/layout.js
CHANGED
package/template/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "aziz-app",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "index.html",
|
|
2
|
+
"name": "my-aziz-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Built with Aziz.js",
|
|
6
5
|
"scripts": {
|
|
7
6
|
"dev": "node scripts/dev-server.js"
|
|
8
7
|
},
|
|
9
|
-
"
|
|
10
|
-
"author": "",
|
|
11
|
-
"license": "ISC"
|
|
8
|
+
"license": "MIT"
|
|
12
9
|
}
|
|
@@ -10,7 +10,7 @@ const ROOT = process.cwd();
|
|
|
10
10
|
const clients = new Set();
|
|
11
11
|
const apiHandlers = {};
|
|
12
12
|
|
|
13
|
-
console.log('🚀
|
|
13
|
+
console.log('🚀 Aziz.js dev server starting...\n');
|
|
14
14
|
|
|
15
15
|
// ─── Route Manifest ──────────────────────────────────────────
|
|
16
16
|
// Scans app/ folder and builds a list of pages and layouts
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tailwindCSS.experimental.classRegex": [
|
|
3
|
-
["class\\s*=\\s*['\"`]([^'\"`]*)['\"`]", "([^\\s]+)"]
|
|
4
|
-
],
|
|
5
|
-
"tailwindCSS.includeLanguages": {
|
|
6
|
-
"javascript": "javascript",
|
|
7
|
-
"javascriptreact": "javascript"
|
|
8
|
-
},
|
|
9
|
-
"files.associations": {
|
|
10
|
-
"*.jsx": "javascriptreact"
|
|
11
|
-
},
|
|
12
|
-
"editor.quickSuggestions": {
|
|
13
|
-
"strings": true
|
|
14
|
-
}
|
|
15
|
-
}
|
package/template/api/getUser.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// API Route: /api/getUser
|
|
2
|
-
// Next.js App Router style with NextResponse
|
|
3
|
-
|
|
4
|
-
const { NextResponse } = require('../modules/next-response');
|
|
5
|
-
|
|
6
|
-
// Mock database
|
|
7
|
-
const users = [
|
|
8
|
-
{ _id: '1', name: 'Aziz Ahmed', email: 'aziz@example.com', role: 'admin', phone: '123-456-7890' },
|
|
9
|
-
{ _id: '2', name: 'John Doe', email: 'john@example.com', role: 'user', phone: '098-765-4321' },
|
|
10
|
-
{ _id: '3', name: 'Jane Smith', email: 'jane@example.com', role: 'user', phone: '555-123-4567' }
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
// GET handler - Next.js App Router style
|
|
14
|
-
async function GET(request) {
|
|
15
|
-
try {
|
|
16
|
-
// Parse URL and get search params
|
|
17
|
-
const { searchParams } = new URL(request.url);
|
|
18
|
-
const email = searchParams.get('email');
|
|
19
|
-
const id = searchParams.get('id');
|
|
20
|
-
|
|
21
|
-
// Find by email
|
|
22
|
-
if (email) {
|
|
23
|
-
const user = users.find(u => u.email === email);
|
|
24
|
-
if (!user) {
|
|
25
|
-
return NextResponse.json(
|
|
26
|
-
{ error: 'User not found' },
|
|
27
|
-
{ status: 404 }
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
return NextResponse.json(user);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Find by ID
|
|
34
|
-
if (id) {
|
|
35
|
-
const user = users.find(u => u._id === id);
|
|
36
|
-
if (!user) {
|
|
37
|
-
return NextResponse.json(
|
|
38
|
-
{ error: 'User not found' },
|
|
39
|
-
{ status: 404 }
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
return NextResponse.json(user);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// No params provided
|
|
46
|
-
return NextResponse.json(
|
|
47
|
-
{ error: 'Email or ID required' },
|
|
48
|
-
{ status: 400 }
|
|
49
|
-
);
|
|
50
|
-
} catch (error) {
|
|
51
|
-
console.error('Error fetching user:', error);
|
|
52
|
-
return NextResponse.json(
|
|
53
|
-
{ error: 'Failed to fetch user' },
|
|
54
|
-
{ status: 500 }
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Export the handler
|
|
60
|
-
module.exports = { GET };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// API Route: /api/getUserWithDB
|
|
2
|
-
// Complete Next.js App Router style with DB and Model
|
|
3
|
-
|
|
4
|
-
const { NextResponse } = require('../modules/next-response');
|
|
5
|
-
const connectDB = require('../lib/db');
|
|
6
|
-
const User = require('../models/User');
|
|
7
|
-
|
|
8
|
-
// GET handler - Exactly like Next.js!
|
|
9
|
-
async function GET(request) {
|
|
10
|
-
try {
|
|
11
|
-
// Connect to database
|
|
12
|
-
await connectDB();
|
|
13
|
-
|
|
14
|
-
// Parse URL and get search params
|
|
15
|
-
const { searchParams } = new URL(request.url);
|
|
16
|
-
const email = searchParams.get('email');
|
|
17
|
-
const id = searchParams.get('id');
|
|
18
|
-
|
|
19
|
-
// Find by email
|
|
20
|
-
if (email) {
|
|
21
|
-
const user = await User.findOne({ email });
|
|
22
|
-
|
|
23
|
-
if (!user) {
|
|
24
|
-
return NextResponse.json(
|
|
25
|
-
{ error: 'User not found' },
|
|
26
|
-
{ status: 404 }
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Return user without sensitive fields
|
|
31
|
-
const { password, ...userData } = user;
|
|
32
|
-
return NextResponse.json(userData);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Find by ID
|
|
36
|
-
if (id) {
|
|
37
|
-
const user = await User.findById(id);
|
|
38
|
-
|
|
39
|
-
if (!user) {
|
|
40
|
-
return NextResponse.json(
|
|
41
|
-
{ error: 'User not found' },
|
|
42
|
-
{ status: 404 }
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Return user without sensitive fields
|
|
47
|
-
const { password, ...userData } = user;
|
|
48
|
-
return NextResponse.json(userData);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// No params - return error
|
|
52
|
-
return NextResponse.json(
|
|
53
|
-
{ error: 'Email or ID required' },
|
|
54
|
-
{ status: 400 }
|
|
55
|
-
);
|
|
56
|
-
} catch (error) {
|
|
57
|
-
console.error('Error fetching user:', error);
|
|
58
|
-
return NextResponse.json(
|
|
59
|
-
{ error: 'Failed to fetch user' },
|
|
60
|
-
{ status: 500 }
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
module.exports = { GET };
|
package/template/app.config.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// APP CONFIGURATION
|
|
3
|
-
// Configure what files to auto-import
|
|
4
|
-
// ============================================================
|
|
5
|
-
|
|
6
|
-
// Define all files to be automatically loaded
|
|
7
|
-
window.APP_CONFIG = {
|
|
8
|
-
// API routes to load
|
|
9
|
-
apiRoutes: [
|
|
10
|
-
'api/hello.js',
|
|
11
|
-
'api/users.js'
|
|
12
|
-
],
|
|
13
|
-
|
|
14
|
-
// Components to load
|
|
15
|
-
components: [
|
|
16
|
-
'components/Navbar.jsx',
|
|
17
|
-
'components/Footer.jsx',
|
|
18
|
-
'components/Counter.jsx'
|
|
19
|
-
],
|
|
20
|
-
|
|
21
|
-
// Pages to load
|
|
22
|
-
pages: [
|
|
23
|
-
'pages/Home.jsx',
|
|
24
|
-
'pages/About.jsx',
|
|
25
|
-
'pages/Contact.jsx',
|
|
26
|
-
'pages/test.jsx',
|
|
27
|
-
'pages/ApiDemo.jsx',
|
|
28
|
-
'pages/NewPage.jsx'
|
|
29
|
-
]
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// HOW TO ADD NEW FILES:
|
|
33
|
-
//
|
|
34
|
-
// 1. Create your new file in the appropriate folder
|
|
35
|
-
// 2. Add the path to the array above
|
|
36
|
-
// 3. Refresh the page - it will auto-load!
|
|
37
|
-
//
|
|
38
|
-
// Example:
|
|
39
|
-
// - New page: Add 'pages/MyNewPage.jsx' to pages array
|
|
40
|
-
// - New component: Add 'components/MyComponent.jsx' to components array
|
|
41
|
-
// - New API route: Add 'api/myroute.js' to apiRoutes array
|
package/template/app.html
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
|
7
|
-
<meta http-equiv="Pragma" content="no-cache">
|
|
8
|
-
<meta http-equiv="Expires" content="0">
|
|
9
|
-
<title>My Aziz App</title>
|
|
10
|
-
|
|
11
|
-
<!-- Global Styles -->
|
|
12
|
-
<link rel="stylesheet" href="styles/globals.css">
|
|
13
|
-
|
|
14
|
-
<!-- Live Reload (only active in development) -->
|
|
15
|
-
<script src="scripts/live-reload-client.js"></script>
|
|
16
|
-
|
|
17
|
-
<!-- Babel compiles JSX in the browser -->
|
|
18
|
-
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
|
|
22
|
-
<!-- Navbar is always visible -->
|
|
23
|
-
<div id="navbar"></div>
|
|
24
|
-
|
|
25
|
-
<!-- Page content goes here -->
|
|
26
|
-
<div id="root"></div>
|
|
27
|
-
|
|
28
|
-
<!-- Footer is always visible -->
|
|
29
|
-
<div id="footer"></div>
|
|
30
|
-
|
|
31
|
-
<!-- Load core modules -->
|
|
32
|
-
<script type="text/babel" src="modules/router.js"></script>
|
|
33
|
-
<script type="text/babel" src="modules/state.js"></script>
|
|
34
|
-
<script type="text/babel" src="modules/api.js"></script>
|
|
35
|
-
|
|
36
|
-
<!-- Load shared components -->
|
|
37
|
-
<script type="text/babel" src="components/Counter.jsx"></script>
|
|
38
|
-
<script type="text/babel" src="components/Footer.jsx"></script>
|
|
39
|
-
<script type="text/babel" src="components/Navbar.jsx"></script>
|
|
40
|
-
|
|
41
|
-
<!-- Load pages -->
|
|
42
|
-
<script type="text/babel" src="pages/About.jsx"></script>
|
|
43
|
-
<script type="text/babel" src="pages/ApiDemo.jsx"></script>
|
|
44
|
-
<script type="text/babel" src="pages/Contact.jsx"></script>
|
|
45
|
-
<script type="text/babel" src="pages/Example.jsx"></script>
|
|
46
|
-
<script type="text/babel" src="pages/Home.jsx"></script>
|
|
47
|
-
<script type="text/babel" src="pages/test.jsx"></script>
|
|
48
|
-
|
|
49
|
-
<!-- Start the app -->
|
|
50
|
-
<script type="text/babel">
|
|
51
|
-
startApp();
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
</body>
|
|
55
|
-
</html>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/** @jsx h */
|
|
2
|
-
|
|
3
|
-
// Register this component
|
|
4
|
-
if (window.AutoImport && window.AutoImport.registerComponent) {
|
|
5
|
-
window.AutoImport.registerComponent('Counter', Counter);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function Counter({ initialValue = 0 }) {
|
|
9
|
-
// Use the state management system
|
|
10
|
-
const [count, setCount] = window.StateManager ?
|
|
11
|
-
window.StateManager.useState(initialValue) : [initialValue, () => {}];
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div class="card">
|
|
15
|
-
<h3>Counter Component</h3>
|
|
16
|
-
<p>This is a reusable counter component using the new state system.</p>
|
|
17
|
-
|
|
18
|
-
<div class="count-display">{count}</div>
|
|
19
|
-
<div class="counter-actions">
|
|
20
|
-
<button class="btn btn-primary" onClick={() => setCount(count + 1)}>
|
|
21
|
-
+
|
|
22
|
-
</button>
|
|
23
|
-
<button class="btn btn-danger" onClick={() => setCount(count - 1)}>
|
|
24
|
-
-
|
|
25
|
-
</button>
|
|
26
|
-
<button class="btn btn-grey" onClick={() => setCount(initialValue)}>
|
|
27
|
-
Reset
|
|
28
|
-
</button>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<p style={{ marginTop: '16px', fontSize: '14px', color: '#666' }}>
|
|
32
|
-
Component state is isolated and reactive.
|
|
33
|
-
</p>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** @jsx h */
|
|
2
|
-
|
|
3
|
-
function Navbar() {
|
|
4
|
-
const path = getCurrentPath();
|
|
5
|
-
|
|
6
|
-
return (
|
|
7
|
-
<nav>
|
|
8
|
-
<span class="brand" onClick={() => navigate("home")}>⚡ AzizApp</span>
|
|
9
|
-
<a href="#/home" class={path === "home" ? "active" : ""}>Home</a>
|
|
10
|
-
<a href="#/about" class={path === "about" ? "active" : ""}>About</a>
|
|
11
|
-
<a href="#/test" class={path === "test" ? "active" : ""}>Test</a>
|
|
12
|
-
<a href="#/hooks-demo" class={path === "hooks-demo" ? "active" : ""}>Hooks</a>
|
|
13
|
-
<a href="#/api-demo" class={path === "api-demo" ? "active" : ""}>API Demo</a>
|
|
14
|
-
<a href="#/contact" class={path === "contact" ? "active" : ""}>Contact</a>
|
|
15
|
-
</nav>
|
|
16
|
-
);
|
|
17
|
-
}
|