From cefc402263cd1091fb10cc67dc22f6b6ac4449e5 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Mon, 17 Feb 2025 22:09:27 +0100 Subject: [PATCH] build: add separate tsconfig.build.json this prevents tsc from unnecessarily transpiling the frontend part as well: previously it was transpiled by tsc, but the files got discarded and replaced by the files built by webpack. speeds up tsc command a bit as well: from 14 seconds to ~8 secs --- package.json | 2 +- tsconfig.build.json | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tsconfig.build.json diff --git a/package.json b/package.json index 6cddb2e32..58e7f6840 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "docs:build-frontend": "rimraf ./docs/frontend_api && jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/basic_widget.js src/public/app/widgets/note_context_aware_widget.js src/public/app/widgets/right_panel_widget.js", "docs:build": "npm run docs:build-backend && npm run docs:build-frontend", "build:webpack": "tsx node_modules/webpack/bin/webpack.js -c webpack.config.ts", - "build:prepare-dist": "npm run build:webpack && rimraf ./dist && tsc && tsx ./bin/copy-dist.ts", + "build:prepare-dist": "npm run build:webpack && rimraf ./dist && tsc -p tsconfig.build.json && tsx ./bin/copy-dist.ts", "test": "npm run client:test && npm run server:test", "server:test": "cross-env TRILIUM_ENV=dev TRILIUM_DATA_DIR=./integration-tests/db TRILIUM_INTEGRATION_TEST=memory vitest", "server:coverage": "cross-env TRILIUM_ENV=dev TRILIUM_DATA_DIR=./integration-tests/db TRILIUM_INTEGRATION_TEST=memory vitest --coverage", diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 000000000..24a9aa544 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "NodeNext", + "declaration": false, + "sourceMap": true, + "outDir": "./build", + "strict": true, + "noImplicitAny": true, + "resolveJsonModule": true, + "allowJs": true, + "lib": ["ES2023"], + "downlevelIteration": true, + "skipLibCheck": true, + "esModuleInterop": true, + "verbatimModuleSyntax": true + }, + "include": ["./src/**/*.[jt]s", "./*.ts"], + "exclude": [ + "./node_modules/**/*", + "./spec-es6/**/*.ts", + "./spec/**/*", + "./**/*.spec.ts", + "./src/public/**/*", + "./*.config.[jt]s", + ], + "files": ["src/types.d.ts"] +}