diff --git a/.config/wt.toml b/.config/wt.toml new file mode 100644 index 00000000..ce94091e --- /dev/null +++ b/.config/wt.toml @@ -0,0 +1,3 @@ +# Worktrunk project configuration. See https://worktrunk.dev/config/. +# Install Node deps when a new worktree is created. +pre-start.yarn-install = "yarn install --immutable" diff --git a/package.json b/package.json index 5e2de898..e1757e62 100644 --- a/package.json +++ b/package.json @@ -180,6 +180,7 @@ }, "scripts": { "start": "rollup -c --watch", + "deployment-update": "./scripts/deployment-update-symlink.sh", "build": "yarn run lint && yarn run rollup", "docs": "docsify serve ./docs", "docs-check-links": "docker run --init --rm -v \"$(pwd):/input\" -w /input lycheeverse/lychee --config lychee.toml \"./docs/\"", diff --git a/scripts/deployment-update-symlink.sh b/scripts/deployment-update-symlink.sh new file mode 100755 index 00000000..76953636 --- /dev/null +++ b/scripts/deployment-update-symlink.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# +# `yarn deployment-update` — point the manual-test Home Assistant instance at +# this worktree. +# +# Repoints the `$ACC_LIVE_LINK` symlink (the dev static server's document root) +# at this worktree's `dist/`. HA loads the card from a fixed URL served off that +# static server, so switching worktrees is just this one symlink hop. +set -euo pipefail + +if [[ -z "${ACC_LIVE_LINK:-}" ]]; then + echo "ACC_LIVE_LINK is not set — point it at the symlink to update." >&2 + exit 1 +fi + +TARGET="$PWD/dist" +mkdir -p "$(dirname "$ACC_LIVE_LINK")" +ln -sfn "$TARGET" "$ACC_LIVE_LINK" + +echo "Advanced Camera Card → $TARGET" +[[ -d "$TARGET" ]] || echo "(no dist/ here yet — run \`yarn start\` to build it)"