Skip to content

Commit aa7fe91

Browse files
authored
fix: manifest.json: add v1.37 to versions array (#1181)
* fix: manifest.json: add v1.37 to versions array * chore: add script to validate manifest versions
1 parent dd05e62 commit aa7fe91

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

manifest.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
{
2-
"versions": ["v1.36", "v1.35", "v1.34", "v1.33", "v1.32", "v1.31", "v1.30"],
2+
"versions": [
3+
"v1.37",
4+
"v1.36",
5+
"v1.35",
6+
"v1.34",
7+
"v1.33",
8+
"v1.32",
9+
"v1.31",
10+
"v1.30"
11+
],
312
"routes": [
413
{
514
"path": "./index.md",

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
"*.md": [
4040
"markdownlint --config .markdownlint.jsonc --rules .markdownlint-rules --fix",
4141
"prettier --write"
42+
],
43+
"manifest.json": [
44+
"./scripts/validate-manifest.sh"
4245
]
4346
},
4447
"dependencies": {

scripts/validate-manifest.sh

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
#
3+
# validate-manifest.sh [path/to/manifest.json]
4+
#
5+
# Dependencies: bash>=4.x jq tr sort uniq
6+
#
7+
# Description: Ensures consistency of versions specified in manifest.json.
8+
9+
set -euo pipefail
10+
11+
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
12+
echo "This script requires at least bash version 4."
13+
exit 1
14+
fi
15+
16+
if ! command -v jq > /dev/null; then
17+
echo "This script requires jq to be available."
18+
exit 1
19+
fi
20+
21+
GIT_ROOT=$(cd "$(dirname "$0")" && git rev-parse --show-toplevel)
22+
MANIFEST_JSON_PATH=${1:-"${GIT_ROOT}/manifest.json"}
23+
24+
declare -a MANIFEST_VERSIONS
25+
declare -a ROUTE_VERSIONS
26+
27+
# Read the versions array in manifest.json
28+
readarray -t MANIFEST_VERSIONS < <(jq -r '
29+
.versions[]
30+
| capture("(?<v>[0-9]+\\.[0-9]+)")
31+
| .v' < "${MANIFEST_JSON_PATH}")
32+
33+
# Read all the child paths of changelog/index.md and extract major.minor version
34+
readarray -t ROUTE_VERSIONS < <(jq -r '
35+
.routes[]
36+
| select(.path == "./changelog/index.md")
37+
| .children[]
38+
| .path |
39+
capture("(?<v>[0-9]+\\.[0-9]+)")
40+
| .v' < "${MANIFEST_JSON_PATH}")
41+
42+
# Compare the two
43+
DIFF=$(echo "${MANIFEST_VERSIONS[@]}" "${ROUTE_VERSIONS[@]}" | tr ' ' '\n' | sort | uniq -u)
44+
if [[ -n $DIFF ]]; then
45+
echo "manifest.json: missing version for changelog(s): ${DIFF}"
46+
exit 1
47+
fi
48+
49+
exit 0

0 commit comments

Comments
 (0)