mirror of
https://github.com/will-moss/isaiah.git
synced 2024-08-22 23:27:15 +03:00
build(general): added a version-suffixing step during build to prevent caching of the client files
This commit is contained in:
@@ -22,6 +22,11 @@ npx --yes babel ./client/assets/js/isaiah.js --out-file ./client/assets/js/isaia
|
||||
# Minify JS
|
||||
npx --yes terser ./client/assets/js/isaiah.js -o ./client/assets/js/isaiah.js
|
||||
|
||||
# Append a version parameter to the main JS & CSS linked files to prevent caching
|
||||
VERSION=$(git describe --tags --abbrev=0)
|
||||
sed -i.bak "s/isaiah.js/isaiah.js?v=$VERSION/" ./client/index.html
|
||||
sed -i.bak "s/style.css/style.css?v=$VERSION/" ./client/index.html
|
||||
|
||||
# Build the app
|
||||
go build -o isaiah main.go
|
||||
|
||||
@@ -30,6 +35,9 @@ rm -f ./client/assets/css/tmp.css
|
||||
rm -f ./client/assets/css/style.css
|
||||
mv ./client/assets/js/isaiah.backup.js ./client/assets/js/isaiah.js
|
||||
|
||||
# Remove backup files
|
||||
rm -f ./client/index.html.bak
|
||||
|
||||
DESTINATION="/usr/bin"
|
||||
if [ -d "/usr/local/bin" ]; then
|
||||
DESTINATION="/usr/local/bin"
|
||||
|
||||
@@ -8,5 +8,9 @@ rm -f ./client/assets/css/tmp.css
|
||||
rm -f ./client/assets/css/style.css
|
||||
mv ./client/assets/js/isaiah.backup.js ./client/assets/js/isaiah.js
|
||||
|
||||
# Remove the version parameter from the main JS & CSS linked files
|
||||
sed -i.bak -E 's/\?v=[0-9.]+//' ./client/index.html
|
||||
rm -f ./client/index.html.bak
|
||||
|
||||
# Remove dist folder generated by goreleaser
|
||||
rm -rf ./dist/
|
||||
|
||||
@@ -20,3 +20,8 @@ npx --yes babel ./client/assets/js/isaiah.js --out-file ./client/assets/js/isaia
|
||||
|
||||
# Minify JS
|
||||
npx --yes terser ./client/assets/js/isaiah.js -o ./client/assets/js/isaiah.js
|
||||
|
||||
# Append a version parameter to the main JS & CSS linked files to prevent caching
|
||||
VERSION=$(git describe --tags --abbrev=0)
|
||||
sed -i.bak "s/isaiah.js/isaiah.js?v=$VERSION/" ./client/index.html
|
||||
sed -i.bak "s/style.css/style.css?v=$VERSION/" ./client/index.html
|
||||
|
||||
Reference in New Issue
Block a user