-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.sh
executable file
·28 lines (23 loc) · 921 Bytes
/
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
#!/bin/bash -
#===============================================================================
#
# USAGE: ./build.sh
#
# DESCRIPTION: Compile source file into the actual node module
#
# AUTHOR: Rickey Visinski
# REVISION: 0.0.2
#===============================================================================
set -o nounset # Treat unset variables as an error
BIN=bin/beautifier.js
LIB=lib/beautify.js
echo '#!/usr/bin/env node' > $BIN
# I use the closure compiler, this is the quick and dirty check if you build from source
if [[ $(which closure) ]] ; then
closure --compilation_level SIMPLE_OPTIMIZATIONS --js src/beautify*.js --js_output_file $LIB || exit 1
closure --compilation_level SIMPLE_OPTIMIZATIONS --js src/run-jsbeautifier.js >> $BIN || exit 1
else
cat src/beautify*.js > $LIB
cat src/run-jsbeautify.js >> $BIN
fi
chmod +x $BIN