Is there a way to generate a single dartdocs for multiple packages in a monorepo project?

Soo basically like the title says

Sup folks!!! I have a monorepo style project with multiple packages on it, is it possible to generate a single dartdoc style documentation for all of them ??

Repo
Sample
Packages
* package1
* package2
* package3

what i would like to happen is that when i do something like flutter dart pub global run dartdoc packages output public/api that api folder contains the documentation of all those packages. Currently dardocs expects a lib folder for it to work (at least thats what my google foo is telling me) any ideas ??

1 Like

This should generate dart doc for all packages in packages/core under /docs/combined dir. Change it to your values and it should work.

#!/bin/bash

# Base directory containing all the packages
base_dir="./packages/core"
# Output directory for combined documentation
output_base="$(pwd)/docs/combined"

# Create the output base directory if it doesn't exist
mkdir -p "$output_base"

# Iterate through each subdirectory in the base directory
for package in "$base_dir"/*; do
  if [ -d "$package" ]; then
    package_name=$(basename "$package")
    output_dir="$output_base/$package_name"
    
    echo "Generating documentation for $package_name..."
    (cd "$package" && dart doc --output "$output_dir")
    
    echo "Documentation for $package_name generated at $output_dir"
  fi
done


echo "Combined documentation created"

1 Like

I tried something similar but the issue is that that would create 4 different folders with their own dartdocs for each one, what im after is having a single dartdoc document for all packages