summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-05-27 01:45:41 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-05-27 01:45:41 -0400
commit4396c912771f136f7d397a67f247c81532520b85 (patch)
tree9a8e2f7794e10078482df394e96c25183cd65c4f
parent79d3598282fd573931e7cb14e4d3e54aad7c943c (diff)
Call `vite` directly to build the frontend.
Calling through `npm` wasn't adding anything other than complexity, and it made it somewhat harder to follow what tools did what. I'm also pretty sure `tools/build-ui` was totally unused.
-rw-r--r--build.rs4
-rw-r--r--package.json3
-rwxr-xr-xtools/build-ui10
-rwxr-xr-xtools/run2
-rwxr-xr-xtools/run-frontend4
5 files changed, 5 insertions, 18 deletions
diff --git a/build.rs b/build.rs
index 3b7abda..6d4805f 100644
--- a/build.rs
+++ b/build.rs
@@ -20,7 +20,7 @@ fn main() -> Result<(), io::Error> {
)));
}
- // rerun `npm run build` whenever the UI changes.
+ // rerun `vite build` whenever the UI changes.
//
// `node_modules` is always touched if `npm install` runs, leading to spurious
// rebuilds. (This duplicate is purely organizational; it reflects that the ui
@@ -32,7 +32,7 @@ fn main() -> Result<(), io::Error> {
println!("cargo::rerun-if-changed=svelte.config.js");
println!("cargo::rerun-if-changed=vite.config.js");
println!("cargo::rerun-if-changed=ui");
- let status = Command::new("npm").args(["run", "build"]).status()?;
+ let status = Command::new("npx").args(["vite", "build"]).status()?;
if !status.success() {
return Err(io::Error::other(format!(
"'npm run build' exited with status {status:?}"
diff --git a/package.json b/package.json
index a43e01e..85099e8 100644
--- a/package.json
+++ b/package.json
@@ -7,9 +7,6 @@
"node": ">=22.0.0 <23.0.0"
},
"scripts": {
- "dev": "vite dev",
- "build": "vite build",
- "preview": "vite preview",
"lint": "prettier --check ui && eslint ui",
"format": "prettier --write ui",
"test": "vitest",
diff --git a/tools/build-ui b/tools/build-ui
deleted file mode 100755
index ba8d016..0000000
--- a/tools/build-ui
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash -e
-
-## tools/build-ui
-##
-## Builds the Svelte UI.
-
-cd "$(dirname "$0")/.."
-
-npm install
-npm run build
diff --git a/tools/run b/tools/run
index 88262c6..8560c31 100755
--- a/tools/run
+++ b/tools/run
@@ -11,7 +11,7 @@ trap 'kill "${PIDS[@]}"' EXIT
cargo run &
PIDS+=($!)
-npm run dev -- --host &
+npx vite dev --host &
PIDS+=($!)
wait "${PIDS[@]}"
diff --git a/tools/run-frontend b/tools/run-frontend
index 14ff49c..ccb9bd4 100755
--- a/tools/run-frontend
+++ b/tools/run-frontend
@@ -3,8 +3,8 @@
## tools/run-frontend [OPTIONS…]
##
## Runs a development server for the Pilcrow UI. Options are passed through to
-## the `npm run dev` command. This is best combined with the `API_SERVER`
+## the `npx vite dev` command. This is best combined with the `API_SERVER`
## environment variable, to configure the development server to connect to a
## running Pilcrow instance.
-exec npm run dev -- --host "$@"
+exec npx vite dev --host "$@"