chore: add an ption to turn off TSC check step

This also speeds up the recompilation times, since TSC is now used only
if the output is missing or the typescript files are changed.
This commit is contained in:
Mikhail Zolotukhin 2021-11-20 03:48:17 +03:00
parent 3154606047
commit 54eec739dc
2 changed files with 15 additions and 10 deletions

View File

@ -5,6 +5,15 @@ cmake_minimum_required(VERSION 3.16)
project(bismuth)
option(
USE_TSC
"Use TypeScript Compler to check the code before bundling \
using esbuild. This could be useful, if you know, that the \
code is correct and you want to speed up building times. \
For example - you are a packager."
ON
)
set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.80.0")

View File

@ -23,24 +23,20 @@ add_custom_target(
file(GLOB_RECURSE TYPESCRIPT_SOURCES CONFIGURE_DEPENDS "*.ts")
if(USE_TSC)
set(TSC_COMMAND "npx" "tsc" "--noEmit" "--incremental")
endif()
add_custom_command(
OUTPUT "bismuth/contents/code/index.mjs"
COMMAND ${TSC_COMMAND}
COMMAND "npx" "esbuild"
"--bundle" "${CMAKE_CURRENT_SOURCE_DIR}/index.ts"
"--outfile=${CMAKE_CURRENT_BINARY_DIR}/bismuth/contents/code/index.mjs"
"--format=esm"
"--platform=neutral"
DEPENDS
LintViaTSC
${TYPESCRIPT_SOURCES}
COMMENT "🎁 Bundling using esbuild..."
)
add_custom_target(
LintViaTSC
COMMAND "npx" "tsc" "--noEmit" "--incremental"
COMMENT "👮 Checking sources using TS Compiler..."
DEPENDS ${TYPESCRIPT_SOURCES}
COMMENT "🏗 Compiling and bundling TypeScirpt sources..."
)
add_custom_command(