Refactor entry points: split launcher into linux.sh and mac.sh, rename start.bat to windows.bat, isolate OS node_modules

This commit is contained in:
Tech Jarves committed 2026-06-11 10:14:14 +00:00
1 parent fa20dc7706
commit 84034531c4
9 files changed
+255 -42

No files matched your search

+13
View File
@@ -45,6 +45,19 @@ if (Test-Path $nodeModulesDir) {
Remove-Item $nodeModulesDir -Recurse -Force -ErrorAction SilentlyContinue
}
$nodeModulesMac = Join-Path $appDir "frontend\node_modules_mac"
if (Test-Path $nodeModulesMac) {
Write-Host " >> Removing frontend node_modules_mac..." -ForegroundColor Cyan
Remove-Item $nodeModulesMac -Recurse -Force -ErrorAction SilentlyContinue
}
$nodeModulesLinux = Join-Path $appDir "frontend\node_modules_linux"
if (Test-Path $nodeModulesLinux) {
Write-Host " >> Removing frontend node_modules_linux..." -ForegroundColor Cyan
Remove-Item $nodeModulesLinux -Recurse -Force -ErrorAction SilentlyContinue
}
# Delete package-lock.json in frontend
$lockFile = Join-Path $appDir "frontend\package-lock.json"
if (Test-Path $lockFile) {
+11 -1
View File
@@ -40,11 +40,21 @@ if [[ -d "$APP_DIR/models" ]]; then
fi
# Delete node_modules in frontend
if [[ -d "$APP_DIR/frontend/node_modules" ]]; then
if [[ -L "$APP_DIR/frontend/node_modules" || -d "$APP_DIR/frontend/node_modules" ]]; then
echo " >> Removing frontend node_modules..."
rm -rf "$APP_DIR/frontend/node_modules"
fi
if [[ -d "$APP_DIR/frontend/node_modules_mac" ]]; then
echo " >> Removing frontend node_modules_mac..."
rm -rf "$APP_DIR/frontend/node_modules_mac"
fi
if [[ -d "$APP_DIR/frontend/node_modules_linux" ]]; then
echo " >> Removing frontend node_modules_linux..."
rm -rf "$APP_DIR/frontend/node_modules_linux"
fi
# Delete package-lock.json in frontend
if [[ -f "$APP_DIR/frontend/package-lock.json" ]]; then
echo " >> Removing frontend package-lock.json..."
+11 -1
View File
@@ -388,6 +388,16 @@ if (-not (Test-Path $npmCmd)) {
Read-Host; exit 1
}
# If node_modules is a Unix symlink/junction, remove it so Windows can install natively into a real directory
$nodeModulesDir = Join-Path $frontendDir "node_modules"
if (Test-Path $nodeModulesDir) {
$item = Get-Item $nodeModulesDir
if ($item.Attributes -match "ReparsePoint") {
Print-Info "Removing Unix symlink for node_modules on Windows..."
Remove-Item $nodeModulesDir -Force -ErrorAction SilentlyContinue
}
}
Push-Location $frontendDir
$oldPath = $env:PATH
try {
@@ -419,7 +429,7 @@ try {
# ── Done ─────────────────────────────────────────────────────────────────────
Write-Host ""
Write-Host " ============================================================" -ForegroundColor Green
Write-Host " Setup complete! Just double-click start.bat to launch." -ForegroundColor Green
Write-Host " Setup complete! Just double-click windows.bat to launch." -ForegroundColor Green
Write-Host " ============================================================" -ForegroundColor Green
Write-Host ""
Read-Host " Press Enter to close..."
+24 -1
View File
@@ -361,6 +361,25 @@ if [[ ! -x "$NPM_BIN" ]]; then
exit 1
fi
# Ensure correct OS-specific node_modules folder is symlinked to avoid conflicts
FRONTEND_NODE_MODULES="$FRONTEND_DIR/node_modules"
if [[ "$PLATFORM" == "Darwin" ]]; then
OS_NODE_MODULES="$FRONTEND_DIR/node_modules_mac"
OS_LABEL="node_modules_mac"
else
OS_NODE_MODULES="$FRONTEND_DIR/node_modules_linux"
OS_LABEL="node_modules_linux"
fi
if [[ -d "$FRONTEND_NODE_MODULES" && ! -L "$FRONTEND_NODE_MODULES" ]]; then
print_info "Migrating existing node_modules to $OS_LABEL..."
mv "$FRONTEND_NODE_MODULES" "$OS_NODE_MODULES"
fi
rm -f "$FRONTEND_NODE_MODULES"
mkdir -p "$OS_NODE_MODULES"
ln -sf "$OS_LABEL" "$FRONTEND_NODE_MODULES"
cd "$FRONTEND_DIR"
export PATH="$NODE_DIR/bin:$PATH"
@@ -384,7 +403,11 @@ fi
# ── Done ────────────────────────────────────────────────────────────────────
echo ""
echo " ============================================================"
echo " Setup complete! Run ./start.sh to launch."
if [[ "$PLATFORM" == "Darwin" ]]; then
echo " Setup complete! Run ./mac.sh to launch."
else
echo " Setup complete! Run ./linux.sh to launch."
fi
echo " ============================================================"
echo ""