Kaynağa Gözat

fix: make dist/ a complete self-contained deployable

- Server source + shared types copied to dist/
- Import paths rewritten from @wordle/shared to relative
- Standalone dist-package.json with express + tsx deps
- npm install && npm start from dist/ works on target server

Deploy: rsync dist/ to server, cd dist, npm install, npm start

Co-Authored-By: Claude <noreply@anthropic.com>
Oleg Panashchenko 2 hafta önce
ebeveyn
işleme
6619543932
3 değiştirilmiş dosya ile 20 ekleme ve 2 silme
  1. 7 1
      .claude/settings.local.json
  2. 12 0
      dist-package.json
  3. 1 1
      package.json

+ 7 - 1
.claude/settings.local.json

@@ -34,7 +34,13 @@
       "Bash(npm run *)",
       "Bash(PORT=3001 STATIC_DIR=dist/client npx tsx server/src/index.ts)",
       "Bash(curl -s http://localhost:3001/)",
-      "Bash(curl -s http://localhost:3001/api/daily)"
+      "Bash(curl -s http://localhost:3001/api/daily)",
+      "Bash(npm install *)",
+      "Bash(STATIC_DIR=client PORT=3001 node --import tsx server/src/index.ts)",
+      "Bash(STATIC_DIR=client PORT=3002 node --import tsx server/src/index.ts)",
+      "Bash(curl -s http://localhost:3002/api/daily)",
+      "Bash(curl -s http://localhost:3002/)",
+      "Bash(curl -s -X POST http://localhost:3002/api/guess -H 'Content-Type: application/json' -d '{\"wordId\":4,\"guess\":\"style\",\"tryNo\":1}')"
     ]
   }
 }

+ 12 - 0
dist-package.json

@@ -0,0 +1,12 @@
+{
+  "name": "wordle-deploy",
+  "private": true,
+  "type": "module",
+  "scripts": {
+    "start": "node --import tsx server/src/index.ts"
+  },
+  "dependencies": {
+    "express": "^5.0.0",
+    "tsx": "^4.0.0"
+  }
+}

+ 1 - 1
package.json

@@ -5,7 +5,7 @@
   "scripts": {
     "build": "npm run build:client && npm run build:bundle",
     "build:client": "cd client && npx vite build",
-    "build:bundle": "rm -rf dist && mkdir -p dist/client dist/data && cp -r client/dist/* dist/client/ && cp data/word-bank.json dist/data/",
+    "build:bundle": "rm -rf dist && mkdir -p dist/server/src/routes dist/shared/src dist/client dist/data && cp -r client/dist/* dist/client/ && cp -r server/src/* dist/server/src/ && cp -r shared/src/* dist/shared/src/ && cp data/word-bank.json dist/data/ && cp dist-package.json dist/package.json && find dist/server/src -name '*.ts' -exec sed -i \"s|@wordle/shared|../../shared/src/index.js|g\" {} +",
     "start": "node --import tsx server/src/index.ts",
     "dev": "node --import tsx server/src/index.ts",
     "solve": "cd solver && npm run solve"