Skip to content

Commit dee5f13

Browse files
committed
build: Build accepts version argument
`npm run build` continues to build all versions `npm run build 3.0.0` builds a specific version `npm run build latest` builds from the latest spec
1 parent 031d633 commit dee5f13

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

scripts/md2html/build.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,24 @@ cp -p ../../node_modules/respec/builds/respec-w3c.* ../../deploy/js/
1515
latest=`git describe --abbrev=0 --tags`
1616
latestCopied=none
1717
lastMinor="-"
18-
for filename in $(ls -1 ../../versions/[23456789].*.md | sort -r) ; do
18+
19+
# If $1 is undefined, process all versions
20+
# If $1 is "latest", determine the highest version and process that one
21+
# If $1 is a number, check whether that version exists; report error if no file, otherwise process
22+
if [ -z "$1" ]; then
23+
files=$(ls -1 ../../versions/[23456789].*.md | sort -r)
24+
elif [ "$1" = "latest" ]; then
25+
latest=$(ls -1 ../../versions/[23456789].*.md | sort -r | head -n 1)
26+
files="$latest"
27+
elif [ -f "../../versions/$1.md" ]; then
28+
files="../../versions/$1.md"
29+
else
30+
echo "Error: version $1.md not found"
31+
exit 1
32+
fi
33+
34+
for filename in $files ; do
35+
1936
if [[ ${filename} == *-editors.md ]];then
2037
continue
2138
fi

0 commit comments

Comments
 (0)