2022-11-09 09:58:06 -05:00
|
|
|
#!/usr/bin/env bash
|
2016-02-24 13:41:30 -05:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2020-12-12 04:42:06 -05:00
|
|
|
name=$(grep '"name"' package.json | head -n 1 | sed 's|.*: \"\(.*\)\",|\1|')
|
|
|
|
|
2016-11-04 05:40:24 -04:00
|
|
|
if [ -n "$DIST_VERSION" ]; then
|
|
|
|
version=$DIST_VERSION
|
2016-11-02 07:38:11 -04:00
|
|
|
else
|
2020-12-12 04:42:06 -05:00
|
|
|
version=$(grep version package.json | sed 's|.*: \"\(.*\)\",|\1|')
|
2016-11-02 07:38:11 -04:00
|
|
|
fi
|
2016-02-24 13:41:30 -05:00
|
|
|
|
2019-03-12 07:06:57 -04:00
|
|
|
yarn clean
|
2021-10-22 10:06:14 -04:00
|
|
|
VERSION=$version yarn build
|
2016-11-21 05:40:35 -05:00
|
|
|
|
|
|
|
# include the sample config in the tarball. Arguably this should be done by
|
2019-03-12 07:06:57 -04:00
|
|
|
# `yarn build`, but it's just too painful.
|
2016-11-21 05:40:35 -05:00
|
|
|
cp config.sample.json webapp/
|
|
|
|
|
2016-11-01 11:22:06 -04:00
|
|
|
mkdir -p dist
|
2020-12-12 04:42:06 -05:00
|
|
|
cp -r webapp $name-$version
|
2017-05-02 16:24:02 -04:00
|
|
|
|
2019-04-24 06:27:07 -04:00
|
|
|
# Just in case you have a local config, remove it before packaging
|
2020-12-12 04:42:06 -05:00
|
|
|
rm $name-$version/config.json || true
|
2019-04-24 06:27:07 -04:00
|
|
|
|
2021-12-13 10:45:27 -05:00
|
|
|
$(dirname $0)/normalize-version.sh ${version} > $name-$version/version
|
2017-05-02 16:24:02 -04:00
|
|
|
|
2020-12-12 04:42:06 -05:00
|
|
|
tar chvzf dist/$name-$version.tar.gz $name-$version
|
|
|
|
rm -r $name-$version
|
2016-02-24 13:41:30 -05:00
|
|
|
|
|
|
|
echo
|
2020-12-12 04:42:06 -05:00
|
|
|
echo "Packaged dist/$name-$version.tar.gz"
|