From df7ed99a54367c3b690167ecbf55862e178d38a0 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Mon, 26 Aug 2024 20:06:13 +0700 Subject: [PATCH] Create build.sh --- scripts/build.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 scripts/build.sh diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000..bddae71 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Set the build directory +BUILD_DIR="build" + +# Set the source directory +SRC_DIR="src" + +# Set the TypeScript compiler options +TSC_OPTIONS="-p $SRC_DIR --outDir $BUILD_DIR --target es6 --moduleResolution node --esModuleInterop --allowSyntheticDefaultImports" + +# Clean the build directory +echo "Cleaning build directory..." +rm -rf $BUILD_DIR + +# Compile the TypeScript code +echo "Compiling TypeScript code..." +npx tsc $TSC_OPTIONS + +# Copy static assets +echo "Copying static assets..." +cp -r $SRC_DIR/assets $BUILD_DIR/assets + +# Create a production-ready build +echo "Creating production-ready build..." +npx webpack --config webpack.config.js --mode production + +# Output a success message +echo "Build complete!"