-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
24 lines (19 loc) · 761 Bytes
/
build.sh
File metadata and controls
24 lines (19 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
#
# build helper script
# $1 = output dir name (gas or dist)
#
if [ "$#" != "1" ]; then
echo "Error! $0 - missing output dirname"
exit 1;
fi
# set version in generated Code.js & also update it in the package.json, package-lock.json
VERS=$(cat ./version.txt)
sed -i "s/__VERSION__/$VERS/g" ./$1/Code.js
sed -i "/version/c\ \"version\" : \"$VERS\"," ./package*.json
# a little gentle sed because exports & require statements cannot work in the deployed AppsScript environment
# ...and yes i tried a webpack loader plugin to sort this but failed
sed -i '/^module\.exports/d; /^exports\./d; /require(/d; /eslint-disable/d;' ./$1/Code.js
# remove the webpack generated main file, we do not need this for GAS
rm -f ./$1/main
exit 0