Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Automates bumping js file versions. Experimental, please revert Makefile if it causes problems.

Boris Grozeve5fa02a1d41e
diff --git a/.gitignore b/.gitignore
index 93747a1d0a..92772c563d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
node_modules
*.swp
.idea/
-*.iml
\ No newline at end of file
+*.iml
+.*.tmp
diff --git a/Makefile b/Makefile
index 6dfb69f726..e37134814f 100644
--- a/Makefile
+++ b/Makefile
@@ -21,4 +21,4 @@ clean:
@rm -f $(OUTPUT_DIR)/*.bundle.js
deploy:
- @mkdir -p $(DEPLOY_DIR) && cp $(OUTPUT_DIR)/*.bundle.js $(DEPLOY_DIR)
+ @mkdir -p $(DEPLOY_DIR) && cp $(OUTPUT_DIR)/*.bundle.js $(DEPLOY_DIR) && ./bump-js-versions.sh
diff --git a/bump-js-versions.sh b/bump-js-versions.sh
new file mode 100755
index 0000000000..798b9a7b36
--- /dev/null
+++ b/bump-js-versions.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# This script finds all js files included from index.html which have been
+# modified and bumps their version (the value of the "v" parameter used
+# in index.html)
+
+# contents of index.html at HEAD (excluding not-committed changes)
+index=`git show HEAD:index.html`
+
+# js files included from index.html. The sort needed for comm
+jsfiles=.bump-js-versions-jsfiles.tmp
+echo "$index" | grep '<script src=".*"' -o | sed -e 's/<script src="//' | sed -e 's/\?.*//' | tr -d \" | sort > $jsfiles
+
+# modified files since the last commit
+gitmodified=.bump-js-versions-gitmodified.tmp
+git ls-files -m | sort > $gitmodified
+
+for file in `comm -12 $jsfiles $gitmodified` ;do
+ old_version=`echo "$index" | grep "<script src=\"${file}?v=[0-9]*" -o | sed -e 's/.*v=//'| tr -d \"`
+ new_version=$((1+$old_version))
+ echo Bumping version of $file from $old_version to $new_version
+ sed -i.tmp -e "s%script src=\"${file}\?v=.*\"%script src=\"$file?v=$new_version\"%" index.html
+done
+
+rm -f $jsfiles $gitmodified index.html.tmp