#!/usr/bin/env bash
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

cd "$ROOT_DIR"

echo "== Rust format =="
cargo fmt --all -- --check

echo "== Rust workspace check =="
cargo check --workspace

echo "== Desktopclient headless unit tests =="
cargo test -p companytool-desktop-client

echo "== Node script syntax =="
node --check scripts/api-onboarding-test.mjs
node --check scripts/communication-test.mjs
node --check scripts/dev-seed.mjs
node --check scripts/schema-migration-test.mjs

echo "== Webfrontend build and type check =="
npm --prefix web-frontend run build

echo "standard check ok"
