Skip to main content

wowlab_docgen_cli/context/
deps.rs

1use serde::Serialize;
2
3use crate::{RenderCtx, display_name, infra::metadata};
4
5/// A workspace dependency entry for the deps section.
6#[derive(Debug, Serialize)]
7pub(super) struct Dep {
8    pub display: String,
9    pub path: String,
10    pub description: String,
11}
12
13/// Gather workspace dependencies with display names and descriptions.
14pub(super) fn gather(ctx: &RenderCtx<'_>) -> Vec<Dep> {
15    ctx.metadata
16        .workspace_deps
17        .iter()
18        .map(|(name, dependency)| {
19            let abs_path = ctx.dir.join(&dependency.path);
20            let meta = metadata::load(&ctx.workspace, &abs_path);
21
22            Dep {
23                display: display_name(name),
24                path: dependency.path.clone(),
25                description: meta.description.clone().unwrap_or_default(),
26            }
27        })
28        .collect()
29}