Spaces:
Paused
Paused
File size: 865 Bytes
aa0155d 7f178fb aa0155d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
#!/bin/bash
# Script to build Flutter web app with cache busting
echo "π¨ Building Flutter web app..."
# we cannot use " --no-wasm-dry-run"
# the reason is because we use "dart:html":
#
# Error: Dart library 'dart:html' is not available on this platform.
# import 'dart:html' as html;
# ^
flutter build web --release
# for debugging, use:
#flutter build web --profile
# Check if the build was successful
if [ $? -ne 0 ]; then
echo "β Flutter build failed!"
exit 1
fi
# Generate timestamp
TIMESTAMP=$(date +%s)
# Replace BUILD_TIMESTAMP in index.html with the current timestamp
echo "π Adding build timestamp ($TIMESTAMP) for cache busting..."
sed -i.bak "s/BUILD_TIMESTAMP/$TIMESTAMP/g" build/web/index.html
rm build/web/index.html.bak
echo "β
Flutter build complete!"
echo "π Next step: commit build/web and push to Hugging Face!" |