mirror of
https://github.com/penpot/penpot.git
synced 2026-09-28 09:32:57 +08:00
Protect shared setup, compilation, artifact copy, and target cleanup with one flock lock per checkout. Route watch builds and frontend cleanup through the protected scripts. Document the lock contract and normalize the frontend and exporter build:wasm commands. Closes #11901 AI-assisted-by: Space Bunny Free
28 lines
682 B
Bash
Executable File
28 lines
682 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Usage: ./watch [frontend|export]
|
|
|
|
set -e
|
|
|
|
_SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
|
pushd "$_SCRIPT_DIR" > /dev/null
|
|
|
|
_RENDER_TARGET=${1:-${RENDER_TARGET:-frontend}}
|
|
export RENDER_TARGET="$_RENDER_TARGET"
|
|
. ./_build_env "$_RENDER_TARGET" "${@:2}"
|
|
|
|
# The initial build uses the protected build entry point. Its lock is released
|
|
# before cargo watch starts waiting for source changes.
|
|
"$_SCRIPT_DIR/build" "$RENDER_TARGET" $CARGO_PARAMS
|
|
|
|
set -x
|
|
|
|
cargo watch \
|
|
--why \
|
|
-i "_tmp*" \
|
|
-x "build $CARGO_PARAMS" \
|
|
-s "\"$_SCRIPT_DIR/build\" \"$RENDER_TARGET\" $CARGO_PARAMS" \
|
|
-s "echo 'DONE\n'";
|
|
|
|
popd > /dev/null
|