wongjiahau/ttap-web

View on GitHub
scripts/build

Summary

Maintainability
Test Coverage
#!/bin/bash

pwd
sed -i "" "s/isProductionBuild = false/isProductionBuild = true/g" ./src/index.tsx # toggle production build to disable redux middleware



# For checking if the lastest version is the latest
HASH=$(git rev-parse HEAD)
sed -i "" "s/LGCH/$HASH/g" ./public/index.html

# For substituing the latest revision number (i.e. the UNIX timestamp of the latest commit)
sed -i "" "s/LAST_REVISION/$(git log -1 --format=%ct)/g" ./public/index.html

# Build the React app
npm run build || exit 1

sed -i "" 's|/static|./static|g' ./build/index.html  # this is to fix some relative path bug


# To reset the files modified by this script
git checkout -- ./public/index.html
git checkout -- ./src/index.tsx