version: "3"

tasks:
  build:
    cmds:
      - rye build

  check:
    ignore_error: true
    cmds:
      - isort . --check-only --diff
      - black . --check
      - ruff check mkdocs_jupyter
      - flake8

  fmt:
    ignore_error: true
    cmds:
      - isort .
      - black .
      - ruff check --fix mkdocs_jupyter

  test:
    cmds:
      - rye run pytest -k "{{.name}}"

  test:all:
    cmds:
      - rye run pytest .

  report:
    cmds:
      - coverage xml
      - coverage html

  publish:
    cmds:
      - rye publish

  py:clean:
    cmds:
      - rm -rf .pytest_cache dist htmlcov test-results .ruff_cache
      - rm -f .coverage coverage.xml
      - find . -type f -name '*.py[co]' -delete
      - find . -type d -name __pycache__ -exec rm -rf {} +
      - find . -type d -name .ipynb_checkpoints -exec rm -rf {} +

  docs:build:
    dir: demo
    cmds:
      - mkdocs build

  # ------------------------------------------------------------------------------
  # Javascript

  js:install:
    dir: js
    cmds:
      - pnpm install

  js:build:
    dir: js
    cmds:
      - pnpm run build

  js:dev:
    dir: js
    cmds:
      - pnpm run dev

  js:clean:
    dir: js
    cmds:
      - pnpm run clean
