aboutsummaryrefslogtreecommitdiffstats
path: root/build.ps1
blob: 9cdd2e6f8b6bea5eb09efb9801c11054c7137064 (plain)
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
if (-Not (Test-Path node_modules)) {
    npm install
}

# Clear the old build
Remove-Item -LiteralPath "temp"  -Force -Recurse | out-null
Remove-Item -LiteralPath "build" -Force -Recurse | out-null

echo "build.ps1: Running the Microsoft(R) TypeScript(TM) Compiler. This will take a while!"

# Call the typescript compiler, this will output a bunch of js files in the 'temp' folder
npx tsc
if (-Not $?) {
    echo "build.ps1: The Microsoft(R) TypeScript(TM) Compiler failed :("
    exit 1
}

echo "build.ps1: Running the bundler"

mkdir build | out-null
npx esbuild --bundle temp/main.js --outfile=build/bundle.js
if (-Not $?) {
    echo "build.ps1: The bundler failed. unlucky"
    exit 1
}

echo "build.ps1: Build successful!"