File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,14 @@ DEST_DIR=src/vendor/pdfjs
17
17
PREFIX=pdf.js-gh-pages
18
18
COMPONENTS=" $PREFIX /build $PREFIX /web $PREFIX /LICENSE"
19
19
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
+
20
28
# Download the latest version of the PDF.js library and viewer.
21
29
rm -rf $DEST_DIR
22
30
mkdir -p $DEST_DIR
@@ -45,3 +53,11 @@ cat <<END > src/vendor/pdfjs/HYPOTHESIS-README.md
45
53
46
54
This is a build of the PDF.js viewer auto-generated by tools/update-pdfjs.
47
55
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
+
You can’t perform that action at this time.
0 commit comments