frontend-hamroun 1.2.26 → 1.2.28
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 +7 -0
- package/dist/index.client.d.ts +1 -0
- package/dist/index.d.ts +0 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +26 -1
- package/templates/fullstack-app/README.md +37 -0
- package/templates/fullstack-app/build/main.css +664 -0
- package/templates/fullstack-app/build/main.css.map +7 -0
- package/templates/fullstack-app/build/main.js +682 -0
- package/templates/fullstack-app/build/main.js.map +7 -0
- package/templates/fullstack-app/build.ts +211 -0
- package/templates/fullstack-app/index.html +26 -3
- package/templates/fullstack-app/package-lock.json +2402 -438
- package/templates/fullstack-app/package.json +24 -9
- package/templates/fullstack-app/postcss.config.js +6 -0
- package/templates/fullstack-app/process-tailwind.js +45 -0
- package/templates/fullstack-app/public/_redirects +1 -0
- package/templates/fullstack-app/public/route-handler.js +47 -0
- package/templates/fullstack-app/public/spa-fix.html +17 -0
- package/templates/fullstack-app/public/styles.css +768 -0
- package/templates/fullstack-app/public/tailwind.css +15 -0
- package/templates/fullstack-app/server.js +101 -44
- package/templates/fullstack-app/server.ts +402 -39
- package/templates/fullstack-app/src/README.md +55 -0
- package/templates/fullstack-app/src/client.js +83 -16
- package/templates/fullstack-app/src/components/Layout.tsx +45 -0
- package/templates/fullstack-app/src/components/UserList.tsx +27 -0
- package/templates/fullstack-app/src/config.ts +42 -0
- package/templates/fullstack-app/src/data/api.ts +71 -0
- package/templates/fullstack-app/src/main.tsx +219 -7
- package/templates/fullstack-app/src/pages/about/index.tsx +67 -0
- package/templates/fullstack-app/src/pages/index.tsx +30 -60
- package/templates/fullstack-app/src/pages/users.tsx +60 -0
- package/templates/fullstack-app/src/router.ts +255 -0
- package/templates/fullstack-app/src/styles.css +5 -0
- package/templates/fullstack-app/tailwind.config.js +11 -0
- package/templates/fullstack-app/tsconfig.json +18 -0
- package/templates/fullstack-app/vite.config.js +53 -6
- package/templates/ssr-template/readme.md +50 -0
- package/templates/ssr-template/src/client.ts +46 -14
- package/templates/ssr-template/src/server.ts +190 -18
@@ -1,20 +1,35 @@
|
|
1
1
|
{
|
2
2
|
"name": "fullstack-app",
|
3
|
-
"version": "
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "Frontend Hamroun Fullstack App with esbuild",
|
4
5
|
"type": "module",
|
5
6
|
"scripts": {
|
6
|
-
"
|
7
|
-
"dev
|
8
|
-
"
|
9
|
-
"
|
10
|
-
"
|
7
|
+
"start": "node server.js",
|
8
|
+
"dev": "node process-tailwind.js && cross-env NODE_ENV=development tsx server.ts",
|
9
|
+
"build": "node process-tailwind.js && cross-env NODE_ENV=production tsx build.ts",
|
10
|
+
"serve": "cross-env NODE_ENV=production node dist/server.js",
|
11
|
+
"tailwind": "node process-tailwind.js"
|
11
12
|
},
|
12
13
|
"dependencies": {
|
14
|
+
"compression": "^1.7.4",
|
15
|
+
"cors": "^2.8.5",
|
16
|
+
"dotenv": "^16.3.1",
|
13
17
|
"express": "^4.18.2",
|
14
|
-
"frontend-hamroun": "latest"
|
18
|
+
"frontend-hamroun": "latest",
|
19
|
+
"socket.io": "^4.7.2"
|
15
20
|
},
|
16
21
|
"devDependencies": {
|
17
|
-
"
|
18
|
-
"
|
22
|
+
"@types/compression": "^1.7.3",
|
23
|
+
"@types/cors": "^2.8.14",
|
24
|
+
"@types/express": "^4.17.18",
|
25
|
+
"@types/node": "^20.8.2",
|
26
|
+
"autoprefixer": "^10.4.14",
|
27
|
+
"chokidar": "^3.5.3",
|
28
|
+
"cross-env": "^7.0.3",
|
29
|
+
"esbuild": "^0.19.5",
|
30
|
+
"postcss": "^8.4.27",
|
31
|
+
"tailwindcss": "^3.3.3",
|
32
|
+
"tsx": "^3.13.0",
|
33
|
+
"typescript": "^5.2.2"
|
19
34
|
}
|
20
35
|
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// Process Tailwind CSS (ESM version)
|
2
|
+
import { fileURLToPath } from 'url';
|
3
|
+
import { dirname, resolve } from 'path';
|
4
|
+
import fs from 'fs';
|
5
|
+
import postcss from 'postcss';
|
6
|
+
import tailwindcss from 'tailwindcss';
|
7
|
+
import autoprefixer from 'autoprefixer';
|
8
|
+
|
9
|
+
// Get __dirname equivalent in ESM
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
11
|
+
const __dirname = dirname(__filename);
|
12
|
+
|
13
|
+
// Process function
|
14
|
+
async function processTailwind() {
|
15
|
+
console.log('Processing Tailwind CSS...');
|
16
|
+
|
17
|
+
try {
|
18
|
+
// Paths
|
19
|
+
const inputPath = resolve(__dirname, 'public/tailwind.css');
|
20
|
+
const outputPath = resolve(__dirname, 'public/styles.css');
|
21
|
+
|
22
|
+
// Read the input file
|
23
|
+
const css = fs.readFileSync(inputPath, 'utf8');
|
24
|
+
|
25
|
+
// Process with PostCSS
|
26
|
+
const result = await postcss([
|
27
|
+
tailwindcss,
|
28
|
+
autoprefixer
|
29
|
+
]).process(css, {
|
30
|
+
from: inputPath,
|
31
|
+
to: outputPath
|
32
|
+
});
|
33
|
+
|
34
|
+
// Write the output
|
35
|
+
fs.writeFileSync(outputPath, result.css);
|
36
|
+
|
37
|
+
console.log('Tailwind CSS processed successfully!');
|
38
|
+
} catch (error) {
|
39
|
+
console.error('Error processing Tailwind CSS:', error);
|
40
|
+
process.exit(1);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
// Run the processor
|
45
|
+
processTailwind();
|
@@ -0,0 +1 @@
|
|
1
|
+
/* /index.html 200
|
@@ -0,0 +1,47 @@
|
|
1
|
+
// This file handles client-side routing in development and production
|
2
|
+
|
3
|
+
// Ensures our SPA routes work with direct URL access
|
4
|
+
(function() {
|
5
|
+
// Function to get the current route
|
6
|
+
function getCurrentRoute() {
|
7
|
+
// Check if we have a route from the server
|
8
|
+
if (window.__INITIAL_STATE__ && window.__INITIAL_STATE__.route) {
|
9
|
+
return window.__INITIAL_STATE__.route;
|
10
|
+
}
|
11
|
+
|
12
|
+
// Check if we have a route from Vite dev server
|
13
|
+
if (window.__INITIAL_ROUTE__) {
|
14
|
+
return window.__INITIAL_ROUTE__;
|
15
|
+
}
|
16
|
+
|
17
|
+
// Use the current pathname
|
18
|
+
return window.location.pathname;
|
19
|
+
}
|
20
|
+
|
21
|
+
// Function to normalize the route for import paths
|
22
|
+
function normalizeRoute(route) {
|
23
|
+
// Default to index for root path
|
24
|
+
if (route === '/') return '/index';
|
25
|
+
return route;
|
26
|
+
}
|
27
|
+
|
28
|
+
// Store the route information globally
|
29
|
+
window.__ROUTE_INFO__ = {
|
30
|
+
current: getCurrentRoute(),
|
31
|
+
normalized: normalizeRoute(getCurrentRoute())
|
32
|
+
};
|
33
|
+
|
34
|
+
// Clean up URL if needed (remove any _path parameter)
|
35
|
+
const url = new URL(window.location.href);
|
36
|
+
if (url.searchParams.has('_path')) {
|
37
|
+
const path = url.searchParams.get('_path');
|
38
|
+
url.searchParams.delete('_path');
|
39
|
+
|
40
|
+
// Only replace state if we're not already at the correct path
|
41
|
+
if (window.location.pathname !== path) {
|
42
|
+
window.history.replaceState(null, '', path + url.search + url.hash);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
console.log('Route handler initialized:', window.__ROUTE_INFO__);
|
47
|
+
})();
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta http-equiv="refresh" content="0;url=/">
|
6
|
+
<title>Redirecting...</title>
|
7
|
+
<script>
|
8
|
+
// Record the original path the user was trying to access
|
9
|
+
localStorage.setItem('originalPath', window.location.pathname);
|
10
|
+
// Redirect to the root
|
11
|
+
window.location.href = '/';
|
12
|
+
</script>
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<p>Redirecting to home page...</p>
|
16
|
+
</body>
|
17
|
+
</html>
|