From 1973a65635098341aa5f057063be7d5c317fa69b Mon Sep 17 00:00:00 2001 From: Adam Shiervani Date: Mon, 17 Feb 2025 16:29:42 +0100 Subject: [PATCH] feat(dev): change default npm dev script to device mode and add wrapper script to set environment variable and proxy signal api (#157) --- ui/dev_device.sh | 21 +++++++++++++++++++++ ui/package.json | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 ui/dev_device.sh diff --git a/ui/dev_device.sh b/ui/dev_device.sh new file mode 100755 index 0000000..2fa8e4e --- /dev/null +++ b/ui/dev_device.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Print header +echo "┌──────────────────────────────────────┐" +echo "│ JetKVM Development Setup │" +echo "└──────────────────────────────────────┘" + +# Prompt for IP address +printf "Please enter the IP address of your JetKVM device: " +read ip_address + +# Validate input is not empty +if [ -z "$ip_address" ]; then + echo "Error: IP address cannot be empty" + exit 1 +fi + +# Set the environment variable and run Vite +echo "Starting development server with JetKVM device at: $ip_address" +sleep 1 +JETKVM_PROXY_URL="http://$ip_address" vite dev --mode=device diff --git a/ui/package.json b/ui/package.json index 9a7fae5..7d569e3 100644 --- a/ui/package.json +++ b/ui/package.json @@ -7,10 +7,10 @@ "node": "21.1.0" }, "scripts": { - "dev": "vite dev --mode=development", + "dev": "./dev_device.sh", + "dev:cloud": "vite dev --mode=development", "build": "npm run build:prod", "build:device": "tsc && vite build --mode=device --emptyOutDir", - "dev:device": "vite dev --mode=device", "build:prod": "tsc && vite build --mode=production", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0" },