UNPKG

1.08 kBapplication/x-shView Raw
1#!/bin/bash
2set -e
3set -o pipefail
4
5tmp="`mktemp -d`"
6
7function 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# compile an initial copy with just babel, since
16# that should always work
17rm -rf dist
18babel src -d dist
19
20echo ""
21echo "Building: .eslintrc.dist.js"
22node scripts/build-eslint.js
23
24# compile the actual build with the babel version
25echo ""
26echo "Building: cli using babel-compiled cli:"
27node dist/cli.js build src/cli.js
28echo "cli.dist.js - `create_hash cli.dist.js`"
29
30echo ""
31echo "Building: src/register-profiler.js src/bench.js"
32./cli.dist.js build src/register-profiler.js src/bench.js
33
34echo ""
35echo "Building: docs"
36./cli.dist.js doc
37
38if test "$CI" = "true"; then
39 # compile several times with the tool itself to ensure
40 # that the build works
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
50fi
51
52echo ""
53echo "Build directory: $tmp"
54ls -lh "$tmp"