-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun-build.sh
executable file
·63 lines (41 loc) · 1.7 KB
/
run-build.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
if [ -z ${HEROKU_SLUG_COMMIT+x} ]; then
SOURCE_VERSION=$(git rev-parse --verify HEAD);
fi
BUILD_DIR="$( node -e "console.log(process.cwd())")/build";
echo Build $APP_ENV $SOURCE_VERSION $BUILD_DIR
#clean build dir
rm -rf $BUILD_DIR
mkdir $BUILD_DIR
# npm install
# env
cd ./src
npm version $(node ../version.js)
cd ..
#build gun
# BUILD_DIR=$BUILD_DIR sh ./build_gun.sh
#minifiy r.js
# npm exec -c "minify ./src/peersocial/lib/r.js > ./src/peersocial/lib/r.min.js"
#build app
BUILD_DIR=$BUILD_DIR SOURCE_VERSION=$SOURCE_VERSION npm run build-default
#copy files from src into build
cp -a $BUILD_DIR/../src/* $BUILD_DIR
CP_DIR="$( node -e "console.log(require('path').dirname(require.resolve('gun/package.json')))" )";
cp -a $CP_DIR $BUILD_DIR/gun
CP_DIR="$( node -e "console.log(require('path').resolve( require('path').dirname(require.resolve('ace/package.json')) , './lib/ace'))" )";
cp -a $CP_DIR $BUILD_DIR/peersocial/ace
CP_DIR="$( node -e "console.log(require('path').dirname(require.resolve('@fortawesome/fontawesome-free/package.json')))" )";
cp -a $CP_DIR $BUILD_DIR/fontawesome
#link additional_plugins
rm -rf $BUILD_DIR/peersocial/additional_plugins
ln -s ../../src/peersocial/additional_plugins $BUILD_DIR/peersocial/additional_plugins
#link config
rm -rf $BUILD_DIR/peersocial/config
ln -s ../../src/peersocial/config $BUILD_DIR/peersocial/config
#link service *worker
rm -rf $BUILD_DIR/peersocial/service
ln -s ../../src/peersocial/service $BUILD_DIR/peersocial/service
ln -sf ./peersocial/service/worker.js $BUILD_DIR/service.worker.js
#link other experimental folders
rm -rf $BUILD_DIR/peersocial/securerender
ln -s ../../src/peersocial/securerender $BUILD_DIR/peersocial/securerender
echo BUILD DONE