feat: add cross-platform dev script (Windows/macOS/Linux support)

Replace Unix-only init.sh with cross-platform init.mjs Node.js script.

Changes:
- Add init.mjs: Cross-platform Node.js implementation of init.sh
- Update package.json: Change dev script from ./init.sh to node init.mjs
- Add tree-kill dependency for reliable cross-platform process termination

Key features of init.mjs:
- Cross-platform port detection (netstat on Windows, lsof on Unix)
- Cross-platform process killing using tree-kill package
- Uses cross-spawn for reliable npm/npx command execution on Windows
- Interactive prompts via Node.js readline module
- Colored terminal output (works on modern Windows terminals)
- Proper cleanup handlers for Ctrl+C/SIGTERM

Bug fix:
- Fixed Playwright browser check to run from apps/app directory where
  @playwright/test is actually installed (was silently failing before)

The original init.sh is preserved for backward compatibility.
This commit is contained in:
Auto
2025-12-18 09:33:35 +02:00
parent bacafd129f
commit 9fcdd899b2
3 changed files with 428 additions and 11 deletions

View File

@@ -8,7 +8,7 @@
],
"scripts": {
"postinstall": "node -e \"const fs=require('fs');if(process.platform==='darwin'){['darwin-arm64','darwin-x64'].forEach(a=>{const p='node_modules/node-pty/prebuilds/'+a+'/spawn-helper';if(fs.existsSync(p))fs.chmodSync(p,0o755)})}\"",
"dev": "./init.sh",
"dev": "node init.mjs",
"dev:web": "npm run dev:web --workspace=apps/app",
"dev:electron": "npm run dev:electron --workspace=apps/app",
"dev:electron:debug": "npm run dev:electron:debug --workspace=apps/app",
@@ -32,6 +32,7 @@
"lint:lockfile": "! grep -q 'git+ssh://' package-lock.json || (echo 'Error: package-lock.json contains git+ssh:// URLs. Run: git config --global url.\"https://github.com/\".insteadOf \"git@github.com:\"' && exit 1)"
},
"dependencies": {
"cross-spawn": "^7.0.6"
"cross-spawn": "^7.0.6",
"tree-kill": "^1.2.2"
}
}