mirror of
https://github.com/holos-run/holos.git
synced 2026-03-19 16:54:58 +00:00
This patch strips down the v1alpha4 core and author schemas to only with is absolutely necessary for all holos users. Aspects of platform configuration applicable to some, even most, but not all users will be moved into documentation topics organized as a recipe book. The functionality removed from the v1alpha4 author schemas in v1alpha5 will move into self contained examples documented as topics on the docs site. The overall purpose is to have a focused, composeable, maintainable author schema to help people get started and ideally we can support for years with making breaking changes. With this patch the v1alpha5 helm guide test passes. We're not going to have this guide anymore but it demonstrates we're back to where we were with v1alpha4.
43 lines
1.2 KiB
Bash
Executable File
43 lines
1.2 KiB
Bash
Executable File
#! /bin/bash
|
|
#
|
|
|
|
tmpdir="$(mktemp -d)"
|
|
finish() {
|
|
rm -rf "$tmpdir"
|
|
}
|
|
trap finish EXIT
|
|
|
|
set -euo pipefail
|
|
|
|
# Generate the documentation for the package the calls go:generate
|
|
package="$(git rev-parse --show-prefix)"
|
|
# e.g. v1alpha4
|
|
version="$(basename "${package}")"
|
|
version="${version%/}"
|
|
# e.g. api/core or api/author
|
|
schema="$(dirname "${package}")"
|
|
|
|
# Move to the repo root
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
|
|
# Check if the version is released
|
|
if [[ -d "doc/website/versioned_docs/version-${version}" ]]; then
|
|
# released version
|
|
base="doc/website/versioned_docs/version-${version}/${schema}"
|
|
else
|
|
# next version
|
|
base="doc/md/${schema}"
|
|
fi
|
|
|
|
mkdir -p "$(dirname "${base}")"
|
|
|
|
gomarkdoc --output "${tmpdir}/doc.md" "./${package}"
|
|
|
|
# Fix heading anchors by making them explicit
|
|
# Refer to https://docusaurus.io/docs/markdown-features/toc#heading-ids
|
|
sed -E 's/## type ([A-Za-z0-9_]+)/## type \1 {#\1}/' "${tmpdir}/doc.md" > "${tmpdir}/with-header.md"
|
|
# Remove the annoying package h1 header, docusaurus will use the title front
|
|
# matter for the page h1 header.
|
|
grep -v "^# $(basename "${schema}")" "${tmpdir}/with-header.md" > "${tmpdir}/fixed.md"
|
|
cat "./${package%%/}/header.yaml" "${tmpdir}/fixed.md" > "${base}.md"
|