-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·40 lines (32 loc) · 1.11 KB
/
build
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
#!/usr/bin/env bash
echo "prepare..."
rm -rf dist
mkdir -p dist
rm -rf .built
mkdir -p .built
echo "build src -> .built .."
./node_modules/.bin/lsc -cb --no-header -o .built src
cat .built/head.js > dist/node.js
cat .built/index.js >> dist/node.js
cat .built/bundle.js >> dist/node.js
echo "block.__node = true;" >> dist/node.js
cat .built/foot.js >> dist/node.js
echo "(function(){" > dist/index.js
cat .built/index.js >> dist/index.js
cat .built/foot.js >> dist/index.js
echo "}())" >> dist/index.js
echo "(function(){" > dist/bundle.js
cat .built/index.js >> dist/bundle.js
cat .built/bundle.js >> dist/bundle.js
cat .built/foot.js >> dist/bundle.js
echo "}())" >> dist/bundle.js
echo "minify dist/index.js -> index.min.js ..."
./node_modules/.bin/uglifyjs dist/index.js -m -c > dist/index.min.js
echo "minify dist/bundle.js -> bundle.min.js ..."
./node_modules/.bin/uglifyjs dist/bundle.js -m -c > dist/bundle.min.js
echo "copy dist to web ..."
rm -rf web/static/assets/lib/@plotdb/block/dev/
mkdir -p web/static/assets/lib/@plotdb/block/dev/
cp -R dist/* web/static/assets/lib/@plotdb/block/dev/
rm -rf .built
echo "done."