mirror of
https://github.com/Bismuth-Forge/bismuth.git
synced 2024-09-17 11:37:10 +03:00
feat!: use esbuild for compiling script
This commit is contained in:
parent
393d1bbf1a
commit
584555191b
16
bin/build.sh
16
bin/build.sh
@ -11,16 +11,12 @@ mkdir -p "${npm_package_config_build_dir:=build}/contents/code"
|
||||
mkdir -p "$npm_package_config_build_dir/contents/config"
|
||||
mkdir -p "$npm_package_config_build_dir/contents/ui"
|
||||
|
||||
# Compile source into the form usable from QML
|
||||
echo "Compiling typescript..."
|
||||
npx tsc --outDir "$npm_package_config_build_dir/contents/code/"
|
||||
|
||||
# Rename all js files to mjs, because TypeScript cannot do that (https://github.com/Microsoft/TypeScript/issues/18442)
|
||||
# We need to to that in order to use Javascripts modules from Qt
|
||||
find "$npm_package_config_build_dir/contents/code/" -name "*.js" -exec bash -c 'mv "$1" "${1%.js}".mjs' - '{}' \;
|
||||
|
||||
# Fix the import statements (replace .js to .mjs, or add .mjs extention)
|
||||
find "$npm_package_config_build_dir/contents/code/" -name "*.mjs" -exec sed -i '/^import/s/\(\.js\)*";*$/.mjs";/g' {} +
|
||||
echo "Compiling using esbuild..."
|
||||
npx esbuild \
|
||||
--bundle src/index.ts \
|
||||
--outfile="$npm_package_config_build_dir/contents/code/index.mjs" \
|
||||
--format=esm \
|
||||
--platform=neutral
|
||||
|
||||
# Copy resources to the build directory with correct paths
|
||||
cp -v res/config.ui "$npm_package_config_build_dir/contents/ui/config.ui"
|
||||
|
@ -14,6 +14,7 @@
|
||||
"@types/jest": "^27.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.3",
|
||||
"@typescript-eslint/parser": "^4.29.3",
|
||||
"esbuild": "^0.12.26",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"husky": "^7.0.2",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"target": "es2016",
|
||||
"noEmitOnError": false,
|
||||
"removeComments": true,
|
||||
"lib": ["es5", "ES2015", "ES2016"],
|
||||
|
Loading…
Reference in New Issue
Block a user