docs: rename docs/components to docs/crates
The generated landing page's own H1 already said "Crate reference" — the directory name should match. Rename docs/components/ -> docs/crates/ and update the generating derivation (nix/packages/reference-docs.nix), its default.nix caller comment, and docs/README.md's link. Fixes #3193
This commit is contained in:
parent
b12be26f20
commit
3c262b6c1b
4 changed files with 15 additions and 15 deletions
|
|
@ -89,7 +89,7 @@ declarations.
|
||||||
## Crate reference
|
## Crate reference
|
||||||
|
|
||||||
- **What does a specific Rust crate do, on its own terms?** →
|
- **What does a specific Rust crate do, on its own terms?** →
|
||||||
[`components/`](components/README.md) — every workspace crate's own
|
[`crates/`](crates/README.md) — every workspace crate's own
|
||||||
`README.md`, one level up from source (hyperhive#3051); the crate
|
`README.md`, one level up from source (hyperhive#3051); the crate
|
||||||
itself is still the source of truth, this is just a walkable mirror.
|
itself is still the source of truth, this is just a walkable mirror.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ in
|
||||||
# ./reference-docs.nix. (`docs` below is the auto-generated
|
# ./reference-docs.nix. (`docs` below is the auto-generated
|
||||||
# nix-options reference, a different artifact.) `self` is needed to
|
# nix-options reference, a different artifact.) `self` is needed to
|
||||||
# read each workspace crate's own README.md into the virtual
|
# read each workspace crate's own README.md into the virtual
|
||||||
# `components/` subdir.
|
# `crates/` subdir.
|
||||||
reference-docs = pkgs.callPackage ./reference-docs.nix { inherit self; };
|
reference-docs = pkgs.callPackage ./reference-docs.nix { inherit self; };
|
||||||
# XDG icon set + .desktop entries for hyperhive processes.
|
# XDG icon set + .desktop entries for hyperhive processes.
|
||||||
# Narrow input: only the branding SVG, so unrelated source changes
|
# Narrow input: only the branding SVG, so unrelated source changes
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@
|
||||||
# reuse the exact same tree as a flake input.
|
# reuse the exact same tree as a flake input.
|
||||||
#
|
#
|
||||||
# The docs/ tree is copied verbatim (never transformed). On top of that,
|
# The docs/ tree is copied verbatim (never transformed). On top of that,
|
||||||
# `$out/components/<crate>.md` is synthesized — one per workspace crate
|
# `$out/crates/<crate>.md` is synthesized — one per workspace crate
|
||||||
# with a README.md, virtualized under docs/ (mara's ask: "behaves as if
|
# with a README.md, virtualized under docs/ (mara's ask: "behaves as if
|
||||||
# hive-core/README.md lives at docs/components/hive-core.md"). The
|
# hive-core/README.md lives at docs/crates/hive-core.md"). The
|
||||||
# crate's own README stays the single source of truth; this derivation
|
# crate's own README stays the single source of truth; this derivation
|
||||||
# only projects it into the docs tree, so there is no second copy to keep
|
# only projects it into the docs tree, so there is no second copy to keep
|
||||||
# in sync by hand. `docs.nix` (website repo) needs no changes to pick these
|
# in sync by hand. `docs.nix` (website repo) needs no changes to pick these
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
#
|
#
|
||||||
# Output layout:
|
# Output layout:
|
||||||
# $out/ — the repo docs/ tree verbatim (e.g. $out/setup.md)
|
# $out/ — the repo docs/ tree verbatim (e.g. $out/setup.md)
|
||||||
# $out/components/<crate>.md — one per workspace crate README, plus the
|
# $out/crates/<crate>.md — one per workspace crate README, plus the
|
||||||
# hand-written docs/components/README.md
|
# hand-written docs/crates/README.md
|
||||||
# landing page (copied verbatim like any
|
# landing page (copied verbatim like any
|
||||||
# other docs/ file, not generated here)
|
# other docs/ file, not generated here)
|
||||||
|
|
||||||
let
|
let
|
||||||
cargoToml = builtins.fromTOML (builtins.readFile ../../Cargo.toml);
|
cargoToml = builtins.fromTOML (builtins.readFile ../../Cargo.toml);
|
||||||
|
|
@ -32,7 +32,7 @@ let
|
||||||
|
|
||||||
# A member-name relative link (`../<other-crate>`, no specific file —
|
# A member-name relative link (`../<other-crate>`, no specific file —
|
||||||
# forge's browser renders that as a directory listing today) becomes a
|
# forge's browser renders that as a directory listing today) becomes a
|
||||||
# sibling components/<other-crate>.md link once every crate README
|
# sibling crates/<other-crate>.md link once every crate README
|
||||||
# lives flat in the same directory. Built once, applied per file below,
|
# lives flat in the same directory. Built once, applied per file below,
|
||||||
# rather than a fresh `lib.concatMapStrings` per crate's own transform —
|
# rather than a fresh `lib.concatMapStrings` per crate's own transform —
|
||||||
# every crate needs the exact same substitution list (every *other*
|
# every crate needs the exact same substitution list (every *other*
|
||||||
|
|
@ -51,7 +51,7 @@ stdenv.mkDerivation {
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
# Narrow src (just docs/) keeps the *base tree*'s input hash decoupled
|
# Narrow src (just docs/) keeps the *base tree*'s input hash decoupled
|
||||||
# from the rest of the workspace — a doc edit only re-hashes this half.
|
# from the rest of the workspace — a doc edit only re-hashes this half.
|
||||||
# The components/ generation below necessarily widens that: it reads
|
# The crates/ generation below necessarily widens that: it reads
|
||||||
# each crate's own README.md via `self`, so this derivation's hash now
|
# each crate's own README.md via `self`, so this derivation's hash now
|
||||||
# also tracks the whole repo tree (Nix has no cheaper way to depend on
|
# also tracks the whole repo tree (Nix has no cheaper way to depend on
|
||||||
# "just these few files" out of a flake `self`). Accepted trade-off —
|
# "just these few files" out of a flake `self`). Accepted trade-off —
|
||||||
|
|
@ -67,7 +67,7 @@ stdenv.mkDerivation {
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -r ./* $out/
|
cp -r ./* $out/
|
||||||
mkdir -p "$out/components"
|
mkdir -p "$out/crates"
|
||||||
|
|
||||||
${lib.concatMapStrings (member: ''
|
${lib.concatMapStrings (member: ''
|
||||||
if [ -f "$self/${member}/README.md" ]; then
|
if [ -f "$self/${member}/README.md" ]; then
|
||||||
|
|
@ -75,16 +75,16 @@ stdenv.mkDerivation {
|
||||||
# position in the repo tree but aren't once the file is
|
# position in the repo tree but aren't once the file is
|
||||||
# virtually one level under docs/ instead:
|
# virtually one level under docs/ instead:
|
||||||
# ../docs/x.md (crate root -> repo docs/) -> ../x.md
|
# ../docs/x.md (crate root -> repo docs/) -> ../x.md
|
||||||
# (components/ -> docs/ is one directory shallower than
|
# (crates/ -> docs/ is one directory shallower than
|
||||||
# <crate>/ -> docs/ was, so the leading docs/ segment drops)
|
# <crate>/ -> docs/ was, so the leading docs/ segment drops)
|
||||||
# ../<sibling-crate> (that crate's own directory, no file)
|
# ../<sibling-crate> (that crate's own directory, no file)
|
||||||
# -> ./<sibling-crate>.md, once that sibling also has a
|
# -> ./<sibling-crate>.md, once that sibling also has a
|
||||||
# components page every crate README lives flat beside it.
|
# crates page every crate README lives flat beside it.
|
||||||
sed -E \
|
sed -E \
|
||||||
-e 's,\]\(\.\./docs/,](../,g' \
|
-e 's,\]\(\.\./docs/,](../,g' \
|
||||||
${siblingLinkFixups member} \
|
${siblingLinkFixups member} \
|
||||||
"$self/${member}/README.md" \
|
"$self/${member}/README.md" \
|
||||||
> "$out/components/${member}.md"
|
> "$out/crates/${member}.md"
|
||||||
fi
|
fi
|
||||||
'') members}
|
'') members}
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ stdenv.mkDerivation {
|
||||||
dontFixup = true;
|
dontFixup = true;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "hyperhive reference docs (the repo docs/ tree, plus a virtual components/<crate>.md per workspace crate README)";
|
description = "hyperhive reference docs (the repo docs/ tree, plus a virtual crates/<crate>.md per workspace crate README)";
|
||||||
homepage = "https://forge.darkest.space/hyperhive/hyperhive";
|
homepage = "https://forge.darkest.space/hyperhive/hyperhive";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue