Compare commits

...

4 Commits

2 changed files with 17 additions and 23 deletions

View File

@@ -201,7 +201,7 @@ jobs:
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2
- uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532 # v2
with:
tool: cargo-rdme
tool: cargo-hack,cargo-rdme
- run: cargo xtask readme --check
# Run cargo rustdoc with the same options that would be used by docs.rs, taking into account the

View File

@@ -10,31 +10,25 @@ pub struct Readme {
check: bool,
}
/// The projects that should have their README.md generated from the source code.
///
/// Notably, we removed `ratatui` from this list as we have a more specifically crafted README for
/// the main crate.
const PROJECTS: &[&str] = &[
"ratatui-core",
"ratatui-crossterm",
"ratatui-macros",
"ratatui-termion",
"ratatui-termwiz",
"ratatui-widgets",
];
impl Run for Readme {
fn run(self) -> Result<()> {
// This would be simpler perhaps with cargo-hack, however cargo-rdme does not support the
// `--manifest-path` option that is required for this to work, so it's easiest to hard code
// the package names here. See https://github.com/orium/cargo-rdme/issues/261
for package in PROJECTS {
let mut args = vec!["rdme", "--workspace-project", package];
if self.check {
args.push("--check");
}
run_cargo(args)?;
// Delegate workspace traversal to cargo-hack so we don't have to call cargo-rdme for each
// package manually. We still exclude the `ratatui` crate because its README is
// hand-crafted rather than generated from doc comments.
let mut args = vec![
"hack",
"--workspace",
"--ignore-private",
"--exclude",
"ratatui",
"rdme",
];
if self.check {
args.push("--check");
}
run_cargo(args)?;
Ok(())
}
}