Skip to content

Commit a63086b

Browse files
committed
Commit updated PDF.js build as part of tools/update-pdfjs
This serves to standardize how PDF.js updates are committed in the repository.
1 parent 3273dd2 commit a63086b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tools/update-pdfjs

+16
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ DEST_DIR=src/vendor/pdfjs
1717
PREFIX=pdf.js-gh-pages
1818
COMPONENTS="$PREFIX/build $PREFIX/web $PREFIX/LICENSE"
1919

20+
# Check for uncommitted git changes. See https://stackoverflow.com/a/3879077/434243
21+
git update-index --refresh
22+
git diff-index --quiet HEAD --
23+
if [[ $? -ne 0 ]]; then
24+
echo "Cannot update PDF.js when there are uncommitted changes in working tree."
25+
exit 1
26+
fi
27+
2028
# Download the latest version of the PDF.js library and viewer.
2129
rm -rf $DEST_DIR
2230
mkdir -p $DEST_DIR
@@ -45,3 +53,11 @@ cat <<END > src/vendor/pdfjs/HYPOTHESIS-README.md
4553
4654
This is a build of the PDF.js viewer auto-generated by tools/update-pdfjs.
4755
END
56+
57+
# Look for `const pdfjsVersion = '<VERSION>'` line in source and extract VERSION.
58+
PDFJS_VERSION=$(grep pdfjsVersion src/vendor/pdfjs/web/viewer.js | egrep -o '[0-9.]+')
59+
git add src/vendor/pdfjs
60+
git commit -m "Update PDF.js to v$PDFJS_VERSION
61+
62+
Update PDF.js using $0."
63+

0 commit comments

Comments
 (0)