Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"versions": ["v1.36", "v1.35", "v1.34", "v1.33", "v1.32", "v1.31", "v1.30"],
"versions": [
"v1.37",
"v1.36",
"v1.35",
"v1.34",
"v1.33",
"v1.32",
"v1.31",
"v1.30"
],
"routes": [
{
"path": "./index.md",
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
"*.md": [
"markdownlint --config .markdownlint.jsonc --rules .markdownlint-rules --fix",
"prettier --write"
],
"manifest.json": [
"./scripts/validate-manifest.sh"
]
},
"dependencies": {
Expand Down
49 changes: 49 additions & 0 deletions scripts/validate-manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
#
# validate-manifest.sh [path/to/manifest.json]
#
# Dependencies: bash>=4.x jq tr sort uniq
#
# Description: Ensures consistency of versions specified in manifest.json.

set -euo pipefail

if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
echo "This script requires at least bash version 4."
exit 1
fi

if ! command -v jq > /dev/null; then
echo "This script requires jq to be available."
exit 1
fi

GIT_ROOT=$(cd "$(dirname "$0")" && git rev-parse --show-toplevel)
MANIFEST_JSON_PATH=${1:-"${GIT_ROOT}/manifest.json"}

declare -a MANIFEST_VERSIONS
declare -a ROUTE_VERSIONS

# Read the versions array in manifest.json
readarray -t MANIFEST_VERSIONS < <(jq -r '
.versions[]
| capture("(?<v>[0-9]+\\.[0-9]+)")
| .v' < "${MANIFEST_JSON_PATH}")

# Read all the child paths of changelog/index.md and extract major.minor version
readarray -t ROUTE_VERSIONS < <(jq -r '
.routes[]
| select(.path == "./changelog/index.md")
| .children[]
| .path |
capture("(?<v>[0-9]+\\.[0-9]+)")
| .v' < "${MANIFEST_JSON_PATH}")

# Compare the two
DIFF=$(echo "${MANIFEST_VERSIONS[@]}" "${ROUTE_VERSIONS[@]}" | tr ' ' '\n' | sort | uniq -u)
if [[ -n $DIFF ]]; then
echo "manifest.json: missing version for changelog(s): ${DIFF}"
exit 1
fi

exit 0