Add a build script to help create the package.
[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 # "Preprocess" the dist package.json.
21 cp ./package.json $OUTDIR
22 sed -i '' -e s@\"dist/@\"@ $OUTDIR/package.json