diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..4428621 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,67 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "types: openapi-ts", + "type": "shell", + "command": "yarn openapi-ts", + "options": { + "cwd": "${workspaceFolder}/types" + }, + "presentation": { + "reveal": "silent", + "panel": "dedicated" + }, + "problemMatcher": [] + }, + { + "label": "server: startReload", + "type": "shell", + "command": "yarn startReload", + "options": { + "cwd": "${workspaceFolder}/server", + "env": { + "NODE_ENV": "development" + } + }, + "isBackground": true, + "presentation": { + "reveal": "always", + "panel": "dedicated", + "group": "dev" + }, + "problemMatcher": [] + }, + { + "label": "client: vite", + "type": "shell", + "command": "yarn start", + "options": { + "cwd": "${workspaceFolder}/client" + }, + "isBackground": true, + "presentation": { + "reveal": "always", + "panel": "dedicated", + "group": "dev" + }, + "problemMatcher": [] + }, + { + "label": "dev: server+client", + "dependsOn": [ + "server: startReload", + "client: vite" + ] + }, + { + "label": "dev: all", + "dependsOrder": "sequence", + "dependsOn": [ + "types: openapi-ts", + "dev: server+client" + ], + "problemMatcher": [] + } + ] +} diff --git a/run_dev.ps1 b/run_dev.ps1 new file mode 100644 index 0000000..9c8bef3 --- /dev/null +++ b/run_dev.ps1 @@ -0,0 +1,23 @@ +# Spustí server a klienta v samostatných panelech jednoho okna Windows Terminalu. +# Vyžaduje Windows Terminal (wt.exe) — výchozí součást Windows 11. + +$ErrorActionPreference = 'Stop' +$ScriptDir = $PSScriptRoot + +Push-Location (Join-Path $ScriptDir 'types') +try { yarn openapi-ts } finally { Pop-Location } + +if (-not (Get-Command wt.exe -ErrorAction SilentlyContinue)) { + Write-Error "wt.exe (Windows Terminal) nebyl nalezen. Nainstalujte z Microsoft Store nebo použijte run_dev.sh v WSL." + exit 1 +} + +$serverDir = Join-Path $ScriptDir 'server' +$clientDir = Join-Path $ScriptDir 'client' + +# wt splits on ';' before respecting quoting, so encode the compound server command to avoid it +$serverCmd = '$env:NODE_ENV = ''development''; yarn startReload' +$serverCmdB64 = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($serverCmd)) + +wt -w 0 new-tab --title 'luncher-server' -d $serverDir pwsh -NoExit -EncodedCommand $serverCmdB64 `; ` + split-pane -H --title 'luncher-client' -d $clientDir pwsh -NoExit -Command "yarn start"