-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·48 lines (40 loc) · 1.65 KB
/
build
File metadata and controls
executable file
·48 lines (40 loc) · 1.65 KB
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
#!/usr/bin/env bash
root=web/src/pug/block
subsets="default bootstrap"
echo "prepare..."
if [[ "$1" == "simple" ]]; then
echo "[simple] skipping removing dist folder"
else
echo "removing dist folder..."
rm -rf dist
mkdir -p dist
fi
echo "building index.ls -> index.js ..."
./node_modules/.bin/lsc -cpb --no-header src/index.ls > dist/index.js
echo "(function(){" > dist/index.js
./node_modules/.bin/lsc -cpb --no-header src/index.ls >> dist/index.js
./node_modules/.bin/lsc tools/pack.ls >> dist/index.js
echo "})();" >> dist/index.js
./node_modules/.bin/lsc tools/pack.ls -s bootstrap > dist/konfig.widget.bootstrap.js
echo "minify index.js -> index.min.js ..."
./node_modules/.bin/uglifyjs dist/index.js -m -c > dist/index.min.js
echo "minify konfig.widget.bootstrap.js -> konfig.widget.bootstrap.min.js ..."
./node_modules/.bin/uglifyjs dist/konfig.widget.bootstrap.js -m -c > dist/konfig.widget.bootstrap.min.js
if [[ "$1" == "simple" ]]; then
echo "[simple] skipping widget transpilation."
else
for subset in $subsets; do
for dir in $(ls $root/$subset); do
echo "transpile widget $subset/$dir -> dist/widgets/$subset/$dir/$subset/index.html ..."
mkdir -p dist/widgets/$subset/$dir
./node_modules/.bin/srcbuild-pug $root/$subset/$dir/index.pug > dist/widgets/$subset/$dir/index.html
done
done
cp -R dist/widgets/default/* dist
fi
echo "bundling blocks -> index.html ..."
./node_modules/.bin/lsc tools/bundle.ls > web/static/assets/bundle/index.html
echo "copy dist to web ..."
rm -rf web/static/assets/lib/@plotdb/konfig/dev/
mkdir -p web/static/assets/lib/@plotdb/konfig/dev/
cp -R dist/* web/static/assets/lib/@plotdb/konfig/dev/