tasks:
  - name: demo
    init: |
      gp sync-await init-install && 
      bash .gitpod/setup-demo.bash
    command: |
      cd apps/demo && 
      cp .env.example .env &&
      sed -i -r "s#^(NEXT_PUBLIC_FORMBRICKS_API_HOST=).*#\1 $(gp url 3000)#" .env &&
      gp sync-await init && 
      turbo --filter "@formbricks/demo" go

  - name: website
    command: gp sync-await init && turbo --filter "@formbricks/formbricks-com" dev

  - name: Init Formbricks
    init: |
      cp .env.example .env &&
      bash .gitpod/init.bash && 
      turbo --filter "@formbricks/js" build && 
      gp sync-done init-install
    command: |
      gp sync-done init && 
      gp tasks list &&
      gp ports await 3002 && gp ports await 3000 && gp open apps/demo/.env && gp preview $(gp url 3002) --external

  - name: web
    init: |
      gp sync-await init-install && 
      bash .gitpod/setup-web.bash &&
      turbo --filter "@formbricks/database" db:down
    command: |
      gp sync-await init &&
      cp .env.example .env &&
      sed -i -r "s#^(WEBAPP_URL=).*#\1 $(gp url 3000)#" .env &&
      RANDOM_ENCRYPTION_KEY=$(openssl rand -hex 32)
      sed -i 's/^ENCRYPTION_KEY=.*/ENCRYPTION_KEY='"$RANDOM_ENCRYPTION_KEY"'/' .env
      turbo --filter "@formbricks/web" go

image:
  file: .gitpod.Dockerfile

ports:
  - port: 3000
    visibility: public
    onOpen: open-browser
  - port: 3001
    visibility: public
    onOpen: ignore
  - port: 3002
    visibility: public
    onOpen: ignore
  - port: 5432
    visibility: public
    onOpen: ignore
  - port: 1025
    visibility: public
    onOpen: ignore
  - port: 8025
    visibility: public
    onOpen: open-browser

github:
  prebuilds:
    master: true
    pullRequests: true
    addComment: true

vscode:
  extensions:
    - "ban.spellright"
    - "bradlc.vscode-tailwindcss"
    - "DavidAnson.vscode-markdownlint"
    - "dbaeumer.vscode-eslint"
    - "esbenp.prettier-vscode"
    - "Prisma.prisma"
    - "yzhang.markdown-all-in-one"
