version: '3'

tasks:
  
  default:
    aliases:
      - help
    cmds:
      - task --list
  
  build:
    desc: Build the app
    aliases:
      - b
    vars:
      DEVENV_ROOT:
        sh: echo "$DEVENV_ROOT"
    
    cmds:
      - nix build --no-link --out-link dist/app
    sources:
      - source/**/*.go
      - source/**/*.mod
      - dist/**
        
  preproduction:
    desc: preproduction tasks
    cmds:
      - cd preproduction; npx esbuild {{ .TASKFILE_DIR }}/preproduction/postcss.js --bundle --target=deno11 
           --outfile={{ .TASKFILE_DIR }}/source/embedded/scripts/postcss.js --platform=node
           --external:fsevents --external:fs --external:path --external:os --external:crypto --external:buffer
              --external:stream --external:util --external:assert --external:events --external:child_process
                --external:module --external:url 
  
  release:
    desc: Commit changes (update version, hashes, etc.)
    aliases:
      - cc
    cmds:
      - update-hashes || true
      - git-commit
      - update-version && git push

  update-code:
    desc: Update the code, calculate hashes and update version
    aliases:
      - uc
    cmds:
      - cd source; go mod download ; go mod tidy; go mod vendor; cd ..
      - update-hashes || true
      - update-version
    silent: true 
