try not to always build
This commit is contained in:
parent
b3848c35ee
commit
b6c0dde776
|
|
@ -1,8 +1,23 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
SHA=$(git rev-parse --short HEAD)
|
SHA=$(git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
# Build to a temporary file
|
||||||
bun build ./src/js/main.js \
|
bun build ./src/js/main.js \
|
||||||
--outfile ./public/bundle.js \
|
--outfile ./public/bundle.tmp.js \
|
||||||
--target browser
|
--target browser
|
||||||
printf "////\n// version: %s\n\n" "$SHA" | cat - ./public/bundle.js > ./public/bundle.tmp.js
|
|
||||||
mv ./public/bundle.tmp.js ./public/bundle.js
|
# If bundle.js doesn't exist yet, fake it it
|
||||||
|
if [ ! -f ./public/bundle.js ]; then
|
||||||
|
touch ./public/bundle.js
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Strip version comments from both files and compare
|
||||||
|
tail -n +4 ./public/bundle.js > ./public/bundle.old.content.tmp
|
||||||
|
tail -n +1 ./public/bundle.tmp.js > ./public/bundle.new.content.tmp
|
||||||
|
|
||||||
|
if ! cmp -s ./public/bundle.old.content.tmp ./public/bundle.new.content.tmp; then
|
||||||
|
printf "////\n// version: %s\n\n" "$SHA" | cat - ./public/bundle.tmp.js > ./public/bundle.js
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm ./public/bundle.tmp.js ./public/bundle.old.content.tmp ./public/bundle.new.content.tmp
|
||||||
Loading…
Reference in New Issue
Block a user