create-aziz-app 2.0.6 → 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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-aziz-app",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "A React-like framework with state management, routing, and API routes - Create apps with auto-import, live reload, and Next.js-like features",
5
5
  "keywords": [
6
6
  "react",
@@ -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
+ }
@@ -35,59 +35,18 @@ function notifyClients() {
35
35
  // Live reload script to inject
36
36
  const liveReloadScript = `
37
37
  <script>
38
- // Hot Module Replacement (HMR) - Smart reload
38
+ // Live reload client
39
39
  const evtSource = new EventSource('/live-reload');
40
- let isReloading = false;
41
-
42
40
  evtSource.onmessage = (event) => {
43
- if (event.data === 'reload' && !isReloading) {
44
- isReloading = true;
45
- console.log('🔄 Changes detected, hot reloading...');
46
-
47
- // Save current state
48
- const currentPath = window.location.hash;
49
- const scrollPos = window.scrollY;
50
-
51
- // Reload only changed scripts
52
- const scripts = document.querySelectorAll('script[type="text/babel"]');
53
- let reloadCount = 0;
54
-
55
- scripts.forEach((script, index) => {
56
- if (script.src && !script.src.includes('babel.min.js')) {
57
- const newScript = document.createElement('script');
58
- newScript.type = 'text/babel';
59
- newScript.src = script.src + '?t=' + Date.now();
60
-
61
- newScript.onload = () => {
62
- reloadCount++;
63
- if (reloadCount === scripts.length - 1) {
64
- // All scripts reloaded, re-render
65
- setTimeout(() => {
66
- if (typeof renderShell === 'function') renderShell();
67
- if (typeof renderPage === 'function') renderPage();
68
- window.scrollTo(0, scrollPos);
69
- console.log('✅ Hot reload complete');
70
- isReloading = false;
71
- }, 100);
72
- }
73
- };
74
-
75
- script.parentNode.replaceChild(newScript, script);
76
- }
77
- });
78
-
79
- // Fallback: if no scripts to reload, just refresh
80
- if (scripts.length <= 1) {
81
- location.reload();
82
- }
41
+ if (event.data === 'reload') {
42
+ console.log('🔄 Changes detected, reloading...');
43
+ location.reload();
83
44
  }
84
45
  };
85
-
86
46
  evtSource.onerror = () => {
87
47
  console.log('⚠️ Live reload disconnected');
88
48
  };
89
-
90
- console.log('✅ Hot reload connected');
49
+ console.log('✅ Live reload connected');
91
50
  </script>
92
51
  `;
93
52
 
@@ -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
+ }