version: 3

vars:
  RED: '\033[0;31m'
  GREEN: '\033[0;32m'
  COLOROFF: '\033[0m'
  PREFIX: "⏳"

silent: true

tasks:
  get:
    internal: true
    desc: Gets dependencies.
    cmds:
      - echo -e "{{.GREEN}}{{.PREFIX}} Getting the dependencies...{{.COLOROFF}}"
      - flutter pub get

  build:
    desc: Running build runner
    deps: [get]
    aliases: [b]
    cmds:
      - echo -e "{{.GREEN}}{{.PREFIX}} Running build runner...{{.COLOROFF}}"
      - flutter pub run build_runner build

  intl:
    desc: Generating internationalization file
    deps: [get]
    aliases: [i]
    cmds:
      - echo -e "{{.GREEN}}{{.PREFIX}} Running intl generation...{{.COLOROFF}}"
      - flutter gen-l10n

  build-delete:
    desc: Running build runner with deletion of conflicting outputs
    deps: [get]
    aliases: [d]
    cmds:
      - echo -e "{{.GREEN}}{{.PREFIX}} Running build runner with deletion of conflicting outputs...{{.COLOROFF}}"
      - flutter pub run build_runner build --delete-conflicting-outputs

  clean:
    desc: Cleaning build runner
    aliases: [c]
    cmds:
      - echo -e "{{.GREEN}}{{.PREFIX}} Cleaning build runner...{{.COLOROFF}}"
      - flutter pub run build_runner clean

  watch:
    desc: Running build runner in watch mode
    deps: [get]
    aliases: [w]
    cmds:
      - echo -e "{{.GREEN}}{{.PREFIX}} Running build runner in watch mode...{{.COLOROFF}}"
      - flutter pub run build_runner watch
  
  trapeze:
    desc: Running Trapeze config
    aliases: [t]
    cmds:
      - echo -e "{{.GREEN}}{{.PREFIX}} Running Trapeze config...{{.COLOROFF}}"
      - npx trapeze run trapeze.yaml --android-project android --ios-project ios
