1 | #!/bin/bash
|
2 | set -e
|
3 | set -o pipefail
|
4 |
|
5 | tmp="`mktemp -d`"
|
6 |
|
7 | function create_hash() {
|
8 | if which md5 &>/dev/null; then
|
9 | cat "$1" | md5
|
10 | else
|
11 | cat "$1" | md5sum | cut -d- -f1
|
12 | fi
|
13 | }
|
14 |
|
15 |
|
16 |
|
17 | rm -rf dist
|
18 | babel src -d dist
|
19 |
|
20 | echo ""
|
21 | echo "Building: .eslintrc.dist.js"
|
22 | node scripts/build-eslint.js
|
23 |
|
24 |
|
25 | echo ""
|
26 | echo "Building: cli using babel-compiled cli:"
|
27 | node dist/cli.js build src/cli.js
|
28 | echo "cli.dist.js - `create_hash cli.dist.js`"
|
29 |
|
30 | echo ""
|
31 | echo "Building: src/register-profiler.js src/bench.js"
|
32 | ./cli.dist.js build src/register-profiler.js src/bench.js
|
33 |
|
34 | echo ""
|
35 | echo "Building: docs"
|
36 | ./cli.dist.js doc
|
37 |
|
38 | if test "$CI" = "true"; then
|
39 |
|
40 |
|
41 | for ((i=0;i<5;i++)); do
|
42 | echo ""
|
43 | echo "build #$[i+1]:"
|
44 | ./cli.dist.js build src/cli.js
|
45 |
|
46 | hash="`create_hash cli.dist.js`"
|
47 | echo "cli.dist.js - $hash"
|
48 | cp "cli.dist.js" "${tmp}/cli.${hash}.js"
|
49 | done
|
50 | fi
|
51 |
|
52 | echo ""
|
53 | echo "Build directory: $tmp"
|
54 | ls -lh "$tmp"
|