version: '3'

tasks:
  install:
    desc: Setup VitePress locally
    cmds:
      - pnpm install
    sources:
      - package.json
      - pnpm-lock.yaml

  default:
    desc: Start website
    deps: [install]
    aliases: [s, start]
    vars:
      HOST: '{{default "0.0.0.0" .HOST}}'
      PORT: '{{default "3001" .PORT}}'
    cmds:
      - pnpm dev --host={{.HOST}} --port={{.PORT}}

  lint:
    desc: Lint website
    deps: [install]
    cmds:
      - pnpm lint

  build:
    desc: Build website
    deps: [install]
    cmds:
      - pnpm build

  preview:
    desc: Preview Website
    deps: [build]
    aliases: [serve]
    vars:
      HOST: '{{default "localhost" .HOST}}'
      PORT: '{{default "3001" .PORT}}'
    cmds:
      - pnpm preview --host={{.HOST}} --port={{.PORT}}

  clean:
    desc: Clean temp directories
    cmds:
      - rm -rf ./vitepress/dist

  deploy:next:
    desc: Build and deploy next.taskfile.dev
    cmds:
      - pnpm netlify deploy --prod --site=4e13dfcf-fc0d-4bec-ad60-b918a8dc3942

  deploy:prod:
    desc: Build and deploy taskfile.dev
    cmds:
      - pnpm netlify deploy --prod --site=e625bc6a-1cd3-465d-ad30-7bbddaeb4f31
