Repository navigation
v0.13.0
·
166 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Added
- A reusable workflow,
.github/workflows/site.yml, builds a library's documentation site from the library's content folder and publishes it to that library's GitHub Pages from its default branch. A library calls it at one pinned commit and holds no npm manifest or lockfile. Its inputs arecontent-path,deployandtoolchain-ref, and its output ispage-url. A pull request builds the site and keeps it as an artifact for a week (ADR-1001). - Sites are built with Astro Starlight and NCode's design system, Instrument, from NCode Brand 0.10.1: its tokens, fonts, mapping of Starlight's properties, code-block syntax theme and marks, vendored from the release, the toolchain's rules for Starlight's markup, the shared components
Status,ReadoutandBraces, a search, and a 404 page. A library's own component styles itself with the brand's public tokens, prefixed--nc-. The toolchain's rules set each text in the brand's type role that names its use, running text in thereadingrole on the brand's measure, and read none of the brand's private primitives. The 404 page is the library's own404.mdxor404.md, or else the toolchain's, with the header's search box and a link to the site's start, and the build prints no warning about it (ADR-1000, ADR-1006, #6, #2, #27, #35, ADR-1008). vendor/brand/holds the filesvendor/brand/brand.lock.jsonnames from one release of NCodeGroup/brand, each pinned by its SHA-256, the release's own vendoring script,vendor/brand/vendoring/vendor-brand.mjs, among them:npm run update:brand -- <version>takes another release, script included, andnpm run check:vendor, which the tests run, fails with no network when a vendored file differs from the lock. Every day, the brand-watch workflow keeps one open issue labeledbrand-updateanddependencieswhile NCodeGroup/brand has a release newer than the one the lock pins, with the release's links and the command that takes it, and closes it once the lock pins the newest release;npm run watch:brand -- --dry-runshows what it would do. The tests also fail when the theme, the code blocks or a component reads a custom property that neither the brand's stylesheets nor the theme define, or a step of the brand's colour ramps or type scale (#2, #26, #27, ADR-1008, ADR-1009).- In a window narrower than 40rem (640 px), such as a phone's, a table written in Markdown is a stack of rows, each cell under its column's name, which the build copies from the table's head; a code listing wider than its screen lights each edge it has more code past, and its keyboard focus ring is drawn in the screen's lit colour just inside its edge, so no page scrolls sideways (#3, ADR-1007).
- A library configures its site in
site.config.json: title, description, repository, URL, navigation, mark, version label, links and sample globs. The file is checked againstschema/site.config.schema.jsonbefore anything is built, and a wrong one stops the build with a message that names the key. A sample glob names files under the repository root: each file it matches is checked by its real path, with every symbolic link on its path followed, and one that a pattern or a symbolic link puts outside the repository stops the build too, as does a symbolic link that leads nowhere or around in a loop. - A site can require headings on the pages a glob names, in order, with
requiredHeadingsinsite.config.json, such as## Checkliston every guide. A page without one, or with them out of order, stops the build, and so does a rule whose glob matches no page or whose exception is not a page it covers; a site without the key has no rule (#33, ADR-1011). - The build reads every
.astroand.cssfile of a library's_components/folder before it starts, and stops on a--nc-token the brand does not define or on a step of its colour ramps or type scale, naming the file and the token (ADR-1012). - A page includes a compiled sample by its key,
cs snippet=Key, from a region of the library's tests marked// begin-snippet: Keyand// end-snippet. An unknown key, a key defined twice, a region that is never closed, a malformed marker and a block with code of its own each stop the build (ADR-1002). - A page shows a file of the library's repository, whole or from the line that holds one text to the line that holds another, with an empty block such as
```xml file=Directory.Build.props from="<ItemGroup" to="</ItemGroup>": the build fills it, titles it with the path, and links it to those lines at the commit the site was built from. A path outside the repository or inside.git, a missing, binary or oversized file, a text on no line or on several, a selection of blank lines, alines=range and a language the code blocks do not highlight each stop the build (#32, ADR-1010). - An author writes links from the site's root, and the build adds the base path, so one page works under
/<repository>/and at the root of a custom domain. A broken link, a relative link, a link written with the base path and a built page that links outside the base path each stop the build (ADR-1003). - C# 14 extension blocks are highlighted as declarations (ADR-1004).
- Each page links to its source in the library's repository and shows the date of the last commit that changed it. Where the library is in a repository whose history git cannot read, the pages show no date and the build warns, with git's message, as an annotation in GitHub Actions.
scripts/site.mjsbuilds, serves or previews a library's site from a clone beside it:npm run dev -- <library folder>follows edits to pages, sample files and the files pages include, and writes nothing to the library.CONTRACT.mdstates what a library holds for its site and what the build does with it, andfixture/is a complete small library that the tests build.docs/architecture.mddescribes the toolchain's components and the rules its design keeps, anddocs/assurance-case.mdstates its security requirements, its threat model and trust boundary, the check each input gets, the secure design principles it applies and the weaknesses it counters (#13).GOVERNANCE.mdnames the maintainer and owner, @polewskm, and says continuity stays incomplete until a second owner can administer the repository;ROADMAP.mdstates the plans for the next twelve months: keeping external inputs pinned and current, and reaching the OpenSSF Best Practices silver level (#14).- CI checks the toolchain's code with Biome before it builds:
npm run lintfails on a formatting difference in the JavaScript and TypeScript files and on a lint error or warning in them and in the Astro components, andnpm run formatapplies Biome's formatting and safe fixes (#10, ADR-0201, ADR-1005). - Each source file of the toolchain and the fixture starts with a
Copyright © NCode Groupline and anSPDX-License-Identifier: Apache-2.0line: CI runs./.template/Test-FileHeaders.ps1, which fails a JavaScript, TypeScript or Astro file or a stylesheet without them, and-Fixadds them; an Astro component holds them in its frontmatter, so they never reach a built page, and the copies undervendor/keep their source's lines (#12, ADR-0027).
Security
- The workflow's job that runs the site's packages and a library's pages has a read-only token. A second job, which checks out nothing and runs no code of the library or the toolchain, deploys, and only from the library's default branch (ADR-1001).
- No job of the workflow restores or saves a cache, and every build is a full build.
- Packages are pinned to exact versions, each at least three days old when it is taken, and installed from the lockfile without install scripts. npm refuses a younger version with an
ETARGETerror, also with--force, and the README's development section says what that error means (#5). npm run update:brandwrites a brand release's files only oncegh attestation verifyproves that NCodeGroup/brand'spublish.ymlbuilt the release's archive for its tag on a GitHub-hosted runner, and the archive holds exactly the files its manifest lists, at their SHA-256 (#2, ADR-1008).- A built site loads its fonts, scripts and styles from its own origin.
- CI fails when the tests cover less than 90% of the statements or 80% of the branches of the toolchain's code, which
npm run testmeasures and./.template/Test-Coverage.ps1checks, so a release is tagged only once that check passes again on its commit (#11, ADR-0026). - A release is tagged only once CI passes again on its commit, and in this public repository its tag is signed with gitsign through Sigstore's keyless signing. Releases are immutable, and
SECURITY.mdsays how to verify a release and its tag (#7, ADR-0026, ADR-0028). - NCode Review approves a pull request whose review leaves no blocker or should-fix finding open, and a push dismisses that approval (#7, ADR-0022).