Skip to content

Commit f365cfd

Browse files
feat: add deployment configuration files and npm settings; optimize build process and add optional dependencies
1 parent 99a7ae8 commit f365cfd

7 files changed

Lines changed: 154 additions & 5 deletions

File tree

client/.npmrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
legacy-peer-deps=false
2+
fund=false
3+
audit=false
4+
save-exact=false
5+
package-lock=true
6+
engine-strict=true
7+
optional=true

client/DEPLOYMENT.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Deployment Configuration
2+
3+
## Platform Compatibility
4+
5+
This project is configured to work with multiple deployment platforms:
6+
7+
- **Netlify**: Uses `netlify.toml` configuration
8+
- **Vercel**: Uses `vercel.json` configuration
9+
- **Other platforms**: Standard Vite build output in `dist/`
10+
11+
## Key Configuration Files
12+
13+
- `.nvmrc`: Node.js version (18)
14+
- `.npmrc`: npm configuration for dependency resolution
15+
- `package.json`: Includes optional dependencies for all Rollup native binaries
16+
- `vite.config.ts`: Optimized build configuration with manual chunks
17+
18+
## Troubleshooting
19+
20+
### Rollup Native Binary Issues
21+
22+
If you encounter `Cannot find module @rollup/rollup-*` errors:
23+
24+
1. The project includes optional dependencies for all platforms
25+
2. npm should automatically install the correct binary for the deployment platform
26+
3. If issues persist, check that Node.js version is 18+ and npm is 9+
27+
28+
### Build Performance
29+
30+
- Build includes manual chunking for better performance
31+
- Large chunk warnings are normal for this application size
32+
- Consider implementing dynamic imports for further optimization
33+
34+
## Deployment Commands
35+
36+
### Netlify
37+
38+
```bash
39+
npm ci && npm run build
40+
```
41+
42+
### Vercel
43+
44+
```bash
45+
npm ci && npm run build
46+
```
47+
48+
### Manual Deployment
49+
50+
```bash
51+
npm install
52+
npm run build
53+
# Deploy contents of dist/ folder
54+
```

client/netlify.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[build]
2+
base = "client/"
3+
publish = "dist/"
4+
command = "npm ci && npm run build"
5+
6+
[build.environment]
7+
NODE_VERSION = "18"
8+
NPM_FLAGS = "--legacy-peer-deps"
9+
10+
[[redirects]]
11+
from = "/*"
12+
to = "/index.html"
13+
status = 200
14+
15+
[[headers]]
16+
for = "/assets/*"
17+
[headers.values]
18+
Cache-Control = "public, max-age=31536000, immutable"

client/package.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
"private": true,
44
"version": "0.0.0",
55
"type": "module",
6+
"engines": {
7+
"node": ">=18.0.0",
8+
"npm": ">=9.0.0"
9+
},
610
"scripts": {
711
"dev": "vite",
812
"build": "vite build",
@@ -95,14 +99,25 @@
9599
"typescript-eslint": "^8.30.1",
96100
"vite": "^5.4.10"
97101
},
102+
"optionalDependencies": {
103+
"@rollup/rollup-linux-x64-gnu": "^4.21.3",
104+
"@rollup/rollup-win32-x64-msvc": "^4.21.3",
105+
"@rollup/rollup-darwin-x64": "^4.21.3"
106+
},
98107
"resolutions": {
99108
"rollup": "^4.21.3",
100109
"vite": "^5.4.10",
101-
"lightningcss": false
110+
"lightningcss": false,
111+
"@rollup/rollup-linux-x64-gnu": "^4.21.3",
112+
"@rollup/rollup-win32-x64-msvc": "^4.21.3",
113+
"@rollup/rollup-darwin-x64": "^4.21.3"
102114
},
103115
"overrides": {
104116
"rollup": "^4.21.3",
105117
"vite": "^5.4.10",
106-
"lightningcss": false
118+
"lightningcss": false,
119+
"@rollup/rollup-linux-x64-gnu": "^4.21.3",
120+
"@rollup/rollup-win32-x64-msvc": "^4.21.3",
121+
"@rollup/rollup-darwin-x64": "^4.21.3"
107122
}
108123
}

client/vercel.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
{
22
"version": 2,
33
"framework": "vite",
4-
"buildCommand": "npm run build",
4+
"buildCommand": "npm ci && npm run build",
55
"outputDirectory": "dist",
6-
"installCommand": "npm install",
6+
"installCommand": "npm ci",
77
"devCommand": "npm run dev",
88
"cleanUrls": true,
99
"trailingSlash": false,
10+
"functions": {
11+
"src/pages/api/**/*.js": {
12+
"runtime": "nodejs18.x"
13+
}
14+
},
15+
"env": {
16+
"NODE_VERSION": "18"
17+
},
1018
"rewrites": [
1119
{
1220
"source": "/(.*)",

client/vite.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,21 @@ export default defineConfig({
1818
},
1919
},
2020
},
21+
build: {
22+
rollupOptions: {
23+
output: {
24+
manualChunks: {
25+
vendor: ["react", "react-dom"],
26+
ui: [
27+
"@radix-ui/react-alert-dialog",
28+
"@radix-ui/react-dialog",
29+
"@radix-ui/react-dropdown-menu",
30+
],
31+
utils: ["axios", "date-fns", "clsx"],
32+
},
33+
},
34+
},
35+
target: "esnext",
36+
minify: "esbuild",
37+
},
2138
});

package-lock.json

Lines changed: 31 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)