# Setup: install opam deps and yarn packages (run once)
setup:
    opam switch create . 4.14.2 --no-install --yes
    eval $(opam env --switch=.)
    opam install -y dune reason ocaml-migrate-parsetree yojson
    cd test/rescript && yarn install && cd ../..

# Build the PPX (produces _build/default/bin/Ppx.exe and Extract.exe)
build:
    eval $(opam env --switch=.)
    dune build

# Run the integration test
test:
    cd test/rescript && yarn build
    git diff test/rescript/src/Demo.bs.js

# Run the extract step
extract:
    cd test/rescript && yarn extract

# Dev loop: build then test
dev:
    eval $(opam env --switch=.)
    dune build && cd test/rescript && yarn build && git diff src/Demo.bs.js

# Tag and push a release (usage: just release vx.y.z)
release version:
    git checkout master
    git tag {{version}}
    git push origin {{version}}
