---
version: '3'

tasks:
  html:
    deps:
      - :npm:install:typedoc
    desc: Generate TypeDoc HTML documentation
    summary: |
      # Generate TypeDoc HTML Documentation

      [TypeDoc](https://typedoc.org/) is a CLI tool that generates documentation from specially crafted
      comments in TypeScript code. It also uses type information to generate
      the documentation.

      Running this command will scan the `src/` folder, extract the comments and
      type information and then generate HTML documentation.

      Be sure to read about how to decorate your comments by reading
      [TypeDoc's documentation on comment formatting](https://typedoc.org/guides/doccomments/).
    log:
      error: Encountered error generating HTML documentation with TypeDoc
      start: Generating HTML documentation with TypeDoc
      success: Successfully generated HTML technical documentation with TypeDoc
    cmds:
      - '{{.NPX_HANDLE}}typedoc src/ --exclude "**/*.spec.ts" --out build/docs'

  json:
    deps:
      - :npm:install:typedoc
    desc: Generate TypeDoc JSON documentation
    log:
      error: Encountered error generating JSON documentation with TypeDoc
      start: Generating JSON documentation with TypeDoc
      success: Successfully generated JSON technical documentation with TypeDoc
    cmds:
      - '{{.NPX_HANDLE}}typedoc src/ --exclude "**/*.spec.ts" --json build/docs/typedoc.json'

  open:
    deps:
      - html
      - :npm:install:open-cli
    log:
      start: Opening TypeDoc documentation (`build/docs/index.html`) in the default browser
    cmds:
      - '{{.NPX_HANDLE}}open-cli build/docs/index.html'
