Sed inplace is not great across GNU vs BSD...
[ustaxlib.git] / build.sh
1 #!/bin/sh
2 # Copyright 2020 Blue Static <https://www.bluestatic.org>
3 # This program is free software licensed under the GNU General Public License,
4 # version 3.0. The full text of the license can be found in LICENSE.txt.
5 # SPDX-License-Identifier: GPL-3.0-only
6
7 OUTDIR=./dist
8
9 set -ex
10
11 # Clean.
12 rm -rf $OUTDIR
13
14 # Compile.
15 tsc
16
17 # Drop tests from the compiled output.
18 find $OUTDIR -type f -name '*.test.*' -exec rm {} +
19
20 cp -r examples $OUTDIR
21 cp README.md $OUTDIR
22 cp LICENSE.txt $OUTDIR
23
24 # "Preprocess" the dist package.json.
25 cp ./package.json $OUTDIR
26 sed -i.bak -e s@\"dist/@\"@ $OUTDIR/package.json
27 rm $OUTDIR/package.json.bak