Add a script to update the version list.

pull/27/head
Jonatan Antoni 4 years ago
parent 45463f4fe2
commit 25bf2204b7

@ -0,0 +1,25 @@
#!/bin/bash
LINES=($(grep -n 'list of versions' version.js | cut -d: -f1))
LINES[0]=$(expr ${LINES[0]} - 1)
LINES[1]=$(expr ${LINES[1]} + 1)
VERSIONS=($(find -maxdepth 1 -mindepth 1 -type l) $(find -maxdepth 1 -mindepth 1 -type d))
fields=()
for version in ${VERSIONS[*]#./}; do
label=$(grep "Version" $version/footer.js | sed -r "s/.*'Version ([^']+)'.*/\1/")
fields+=("\"${version}\": \"${label}\"")
done
mv version.js version.js.bak
head -n ${LINES[0]} version.js.bak > version.js
echo "//--- list of versions ---" >> version.js
echo "const versions = {" >> version.js
echo -n " " >> version.js
echo $(IFS=,; echo "${fields[*]}") | sed 's/,/,\n /' >> version.js
echo "}" >> version.js
echo "//--- list of versions ---" >> version.js
tail -n +${LINES[1]} version.js.bak >> version.js
exit 0

@ -1,7 +1,9 @@
//--- list of versions ---
const versions = {
"main": "v1.10.2-dev1",
"latest": "v1.10.1"
};
"main": "1.10.2-dev1",
"latest": "1.10.1"
}
//--- list of versions ---
var scripts = document.getElementsByTagName("script"),
scriptUrl = new URL(scripts[scripts.length-1].src);

Loading…
Cancel
Save