create-aziz-app 2.0.5 → 2.0.7
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/bin/create-aziz-app.js
CHANGED
|
@@ -312,6 +312,9 @@ function Footer() {
|
|
|
312
312
|
|
|
313
313
|
// Update all pages
|
|
314
314
|
updatePagesForBootstrap(targetDir);
|
|
315
|
+
|
|
316
|
+
// Update 404 page
|
|
317
|
+
update404ForBootstrap(targetDir);
|
|
315
318
|
}
|
|
316
319
|
|
|
317
320
|
// Update components for Tailwind
|
|
@@ -380,6 +383,9 @@ function Footer() {
|
|
|
380
383
|
|
|
381
384
|
// Update all pages
|
|
382
385
|
updatePagesForTailwind(targetDir);
|
|
386
|
+
|
|
387
|
+
// Update 404 page
|
|
388
|
+
update404ForTailwind(targetDir);
|
|
383
389
|
}
|
|
384
390
|
|
|
385
391
|
// Update all pages for Bootstrap
|
|
@@ -688,6 +694,79 @@ function TestPage() {
|
|
|
688
694
|
`;
|
|
689
695
|
}
|
|
690
696
|
|
|
697
|
+
// Update 404 page for Bootstrap
|
|
698
|
+
function update404ForBootstrap(targetDir) {
|
|
699
|
+
const routerPath = path.join(targetDir, 'modules', 'router.js');
|
|
700
|
+
if (!fs.existsSync(routerPath)) return;
|
|
701
|
+
|
|
702
|
+
let content = fs.readFileSync(routerPath, 'utf8');
|
|
703
|
+
|
|
704
|
+
const old404 = `// 404 page — shown when no route matches
|
|
705
|
+
function NotFoundPage() {
|
|
706
|
+
return (
|
|
707
|
+
<div class="not-found">
|
|
708
|
+
<h1>404</h1>
|
|
709
|
+
<p>Page not found.</p>
|
|
710
|
+
<button class="btn btn-primary" onClick={() => navigate("home")}>Go Home</button>
|
|
711
|
+
</div>
|
|
712
|
+
);
|
|
713
|
+
}`;
|
|
714
|
+
|
|
715
|
+
const new404 = `// 404 page — shown when no route matches
|
|
716
|
+
function NotFoundPage() {
|
|
717
|
+
return (
|
|
718
|
+
<div class="container text-center py-5">
|
|
719
|
+
<h1 class="display-1 fw-bold text-primary mb-4">404</h1>
|
|
720
|
+
<p class="lead mb-4">Oops! The page you're looking for doesn't exist.</p>
|
|
721
|
+
<button class="btn btn-primary btn-lg" onClick={() => navigate("home")}>
|
|
722
|
+
<i class="bi bi-house-door me-2"></i>Go Home
|
|
723
|
+
</button>
|
|
724
|
+
</div>
|
|
725
|
+
);
|
|
726
|
+
}`;
|
|
727
|
+
|
|
728
|
+
content = content.replace(old404, new404);
|
|
729
|
+
fs.writeFileSync(routerPath, content);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
// Update 404 page for Tailwind
|
|
733
|
+
function update404ForTailwind(targetDir) {
|
|
734
|
+
const routerPath = path.join(targetDir, 'modules', 'router.js');
|
|
735
|
+
if (!fs.existsSync(routerPath)) return;
|
|
736
|
+
|
|
737
|
+
let content = fs.readFileSync(routerPath, 'utf8');
|
|
738
|
+
|
|
739
|
+
const old404 = `// 404 page — shown when no route matches
|
|
740
|
+
function NotFoundPage() {
|
|
741
|
+
return (
|
|
742
|
+
<div class="not-found">
|
|
743
|
+
<h1>404</h1>
|
|
744
|
+
<p>Page not found.</p>
|
|
745
|
+
<button class="btn btn-primary" onClick={() => navigate("home")}>Go Home</button>
|
|
746
|
+
</div>
|
|
747
|
+
);
|
|
748
|
+
}`;
|
|
749
|
+
|
|
750
|
+
const new404 = `// 404 page — shown when no route matches
|
|
751
|
+
function NotFoundPage() {
|
|
752
|
+
return (
|
|
753
|
+
<div class="flex flex-col items-center justify-center min-h-[60vh] text-center px-4">
|
|
754
|
+
<h1 class="text-9xl font-bold text-primary mb-4">404</h1>
|
|
755
|
+
<p class="text-2xl text-gray-600 mb-8">Oops! The page you're looking for doesn't exist.</p>
|
|
756
|
+
<button
|
|
757
|
+
class="px-8 py-3 bg-primary text-dark font-bold rounded-lg hover:opacity-80 transition transform hover:scale-105"
|
|
758
|
+
onClick={() => navigate("home")}
|
|
759
|
+
>
|
|
760
|
+
← Go Home
|
|
761
|
+
</button>
|
|
762
|
+
</div>
|
|
763
|
+
);
|
|
764
|
+
}`;
|
|
765
|
+
|
|
766
|
+
content = content.replace(old404, new404);
|
|
767
|
+
fs.writeFileSync(routerPath, content);
|
|
768
|
+
}
|
|
769
|
+
|
|
691
770
|
// Run main function
|
|
692
771
|
main().catch(err => {
|
|
693
772
|
console.error('❌ Error:', err);
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|
|
@@ -150,6 +150,13 @@ function renderShell() {
|
|
|
150
150
|
footer.appendChild(Footer());
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
// Re-render shell when route changes (for navbar active state)
|
|
154
|
+
function updateShell() {
|
|
155
|
+
const navbar = document.getElementById("navbar");
|
|
156
|
+
navbar.innerHTML = "";
|
|
157
|
+
navbar.appendChild(Navbar());
|
|
158
|
+
}
|
|
159
|
+
|
|
153
160
|
// 404 page — shown when no route matches
|
|
154
161
|
function NotFoundPage() {
|
|
155
162
|
return (
|
|
@@ -170,8 +177,11 @@ function startApp() {
|
|
|
170
177
|
renderShell();
|
|
171
178
|
renderPage();
|
|
172
179
|
|
|
173
|
-
// Re-render the page whenever the hash changes (back/forward navigation)
|
|
174
|
-
window.addEventListener("hashchange",
|
|
180
|
+
// Re-render the page and navbar whenever the hash changes (back/forward navigation)
|
|
181
|
+
window.addEventListener("hashchange", () => {
|
|
182
|
+
updateShell(); // Update navbar active state
|
|
183
|
+
renderPage();
|
|
184
|
+
});
|
|
175
185
|
}
|
|
176
186
|
|
|
177
187
|
// Export to global scope
|
package/template/pages/Home.jsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** @jsx h */
|
|
2
2
|
|
|
3
|
-
// Register this page at route "home" → "#/"
|
|
4
3
|
registerPage("home", HomePage);
|
|
5
4
|
|
|
6
5
|
function HomePage() {
|
|
@@ -25,14 +24,16 @@ function HomePage() {
|
|
|
25
24
|
<h2>File-based Routing</h2>
|
|
26
25
|
<p>
|
|
27
26
|
Each file in <strong>pages/</strong> is a route — just like Next.js.
|
|
28
|
-
Add a new file,
|
|
27
|
+
Add a new file, run the build script, and it's a new page.
|
|
29
28
|
</p>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
<div style={{ display: 'flex', gap: '12px' }}>
|
|
30
|
+
<button class="btn btn-primary" onClick={() => navigate("test")}>
|
|
31
|
+
Go to Test Page →
|
|
32
|
+
</button>
|
|
33
|
+
<button class="btn btn-primary" onClick={() => navigate("about")}>
|
|
34
|
+
Go to About →
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
36
37
|
</div>
|
|
37
38
|
</div>
|
|
38
39
|
);
|
package/template/pages/test.jsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** @jsx h */
|
|
2
2
|
|
|
3
|
-
// Register this page at route "test" → "#/test"
|
|
4
3
|
registerPage("test", TestPage);
|
|
5
4
|
|
|
6
5
|
function TestPage() {
|
|
@@ -19,7 +18,7 @@ function TestPage() {
|
|
|
19
18
|
|
|
20
19
|
<div class="card">
|
|
21
20
|
<h2>Counter Example</h2>
|
|
22
|
-
<p>This demonstrates the
|
|
21
|
+
<p>This demonstrates the state management system.</p>
|
|
23
22
|
|
|
24
23
|
<div class="count-display">{count}</div>
|
|
25
24
|
<div class="counter-actions">
|
|
@@ -37,15 +36,6 @@ function TestPage() {
|
|
|
37
36
|
<p>Try the form with state management.</p>
|
|
38
37
|
|
|
39
38
|
<form onSubmit={handleSubmit}>
|
|
40
|
-
<div>
|
|
41
|
-
<label>Email:</label>
|
|
42
|
-
<input
|
|
43
|
-
type="email"
|
|
44
|
-
value={email}
|
|
45
|
-
onInput={(e) => setEmail(e.target.value)}
|
|
46
|
-
placeholder="Enter your email"
|
|
47
|
-
/>
|
|
48
|
-
</div>
|
|
49
39
|
<div>
|
|
50
40
|
<label>Name:</label>
|
|
51
41
|
<input
|
|
@@ -56,6 +46,15 @@ function TestPage() {
|
|
|
56
46
|
/>
|
|
57
47
|
</div>
|
|
58
48
|
|
|
49
|
+
<div>
|
|
50
|
+
<label>Email:</label>
|
|
51
|
+
<input
|
|
52
|
+
type="email"
|
|
53
|
+
value={email}
|
|
54
|
+
onInput={(e) => setEmail(e.target.value)}
|
|
55
|
+
placeholder="Enter your email"
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
59
58
|
|
|
60
59
|
<button type="submit" class="btn btn-primary">
|
|
61
60
|
Submit Form
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
content: [
|
|
4
|
+
"./pages/**/*.{js,jsx}",
|
|
5
|
+
"./components/**/*.{js,jsx}",
|
|
6
|
+
"./app.html",
|
|
7
|
+
],
|
|
8
|
+
theme: {
|
|
9
|
+
extend: {
|
|
10
|
+
colors: {
|
|
11
|
+
primary: '#61dafb',
|
|
12
|
+
dark: '#282c34',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
plugins: [],
|
|
17
|
+
}
|