Skip to content

Commit 7c09f25

Browse files
author
Hakan Kaya
committed
chore(dev): add one-command workspace launcher
1 parent 5eaffad commit 7c09f25

3 files changed

Lines changed: 71 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ The example device implements `READ_ID` (`0x9F`) and returns `EF 40 18`.
2525

2626
## Quick start
2727

28+
Start the simulator server and hot-reloading Web UI together from the repository
29+
root:
30+
31+
```shell
32+
./dev.sh
33+
```
34+
35+
Open `http://127.0.0.1:4174`. Keep the terminal open while developing and press
36+
`Ctrl+C` to stop both processes. On the first run, the script installs Web
37+
dependencies when `apps/vds-web/node_modules` is missing. Override the UI port
38+
when needed with `VDS_WEB_PORT=4200 ./dev.sh`.
39+
40+
The individual commands remain available for focused server or client work.
41+
2842
Validate the example configuration:
2943

3044
```shell

‎apps/vds-web/src/features/flows/components/ValidationPanel.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function ValidationPanel({ issues }: { issues: ValidationIssue[] }) {
1313
{issues.length === 0 && <div className="flow-panel-empty flow-valid"><CheckCircle2 size={21} /><strong>Flow is valid</strong><span>No generic validation issues.</span></div>}
1414
<div className="flow-issue-list">
1515
{issues.map((issue, index) => (
16-
<button key={`${issue.ruleId}-${issue.nodeId ?? issue.edgeId ?? index}`} onClick={() => select(issue.nodeId ? [issue.nodeId] : [], issue.edgeId ? [issue.edgeId] : [])} type="button">
16+
<button key={`${issue.ruleId}-${issue.nodeId ?? ''}-${issue.edgeId ?? ''}-${index}`} onClick={() => select(issue.nodeId ? [issue.nodeId] : [], issue.edgeId ? [issue.edgeId] : [])} type="button">
1717
{issue.severity === 'error' ? <AlertCircle size={15} /> : <AlertTriangle size={15} />}
1818
<div><strong>{issue.message}</strong><small>{issue.ruleId}</small></div>
1919
</button>

‎dev.sh‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
set -Eeuo pipefail
4+
5+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
WEB_DIR="$ROOT_DIR/apps/vds-web"
7+
WEB_PORT="${VDS_WEB_PORT:-4174}"
8+
SERVER_PID=""
9+
WEB_PID=""
10+
11+
cleanup() {
12+
trap - EXIT
13+
if [[ -n "$WEB_PID" ]]; then
14+
kill "$WEB_PID" 2>/dev/null || true
15+
fi
16+
if [[ -n "$SERVER_PID" ]]; then
17+
kill "$SERVER_PID" 2>/dev/null || true
18+
fi
19+
wait "$WEB_PID" "$SERVER_PID" 2>/dev/null || true
20+
}
21+
22+
trap cleanup EXIT
23+
trap 'exit 130' INT TERM
24+
25+
if [[ ! -d "$WEB_DIR/node_modules" ]]; then
26+
echo "Web dependencies are missing; installing them once..."
27+
npm --prefix "$WEB_DIR" install
28+
fi
29+
30+
cd "$ROOT_DIR"
31+
32+
cargo run -p vds-server -- --config config/vds-server.yaml &
33+
SERVER_PID=$!
34+
35+
npm --prefix "$WEB_DIR" run dev -- --host 127.0.0.1 --port "$WEB_PORT" --strictPort &
36+
WEB_PID=$!
37+
38+
echo
39+
echo "VDS4E development workspace is starting:"
40+
echo " Web UI: http://127.0.0.1:$WEB_PORT"
41+
echo " Control API: http://127.0.0.1:8080/api/v1/health"
42+
echo " Data plane: /tmp/vds4e.sock"
43+
echo
44+
echo "Keep this terminal open. Press Ctrl+C to stop both processes."
45+
echo
46+
47+
set +e
48+
wait -n "$SERVER_PID" "$WEB_PID"
49+
STATUS=$?
50+
set -e
51+
52+
if [[ $STATUS -ne 130 ]]; then
53+
echo "A development process stopped (status $STATUS); shutting down the workspace."
54+
fi
55+
56+
exit "$STATUS"

0 commit comments

Comments
 (0)