From d8be7eca33e9159a96e7ae82b0be0e98ea5dcded Mon Sep 17 00:00:00 2001 From: Chris Wegrzyn Date: Fri, 24 May 2024 12:59:30 -0400 Subject: [PATCH] Add typecheck to build --- esbuild.config.js | 4 ++-- package.json | 1 + pnpm-lock.yaml | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/esbuild.config.js b/esbuild.config.js index 6fc8fce7..5338a513 100644 --- a/esbuild.config.js +++ b/esbuild.config.js @@ -1,3 +1,4 @@ +import { typecheckPlugin } from "@jgoz/esbuild-plugin-typecheck"; import builtins from "builtin-modules"; import esbuild from "esbuild"; import process from "process"; @@ -10,8 +11,6 @@ if you want to view the source, please visit the github repository of this plugi const prod = process.argv[2] === "production"; -const ASSETS = ["styles.css", "manifest.json"]; - const context = await esbuild.context({ banner: { js: banner, @@ -40,6 +39,7 @@ const context = await esbuild.context({ sourcemap: prod ? false : "inline", treeShaking: true, outfile: prod ? "main.js" : "test-vault/.obsidian/plugins/forged/main.js", + plugins: [typecheckPlugin({ watch: !prod })], }); const cssCtx = await esbuild.context({ diff --git a/package.json b/package.json index 8f272026..45f840e8 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@codemirror/view": "^6.26.3", "@datasworn/core": "0.0.10", "@datasworn/starforged": "0.0.10", + "@jgoz/esbuild-plugin-typecheck": "^4.0.0", "@nrsk/sigma": "^3.8.0", "@popperjs/core": "^2.11.8", "@swc/core": "^1.5.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7f700bb8..b8722b59 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: '@datasworn/starforged': specifier: 0.0.10 version: 0.0.10 + '@jgoz/esbuild-plugin-typecheck': + specifier: ^4.0.0 + version: 4.0.0(esbuild@0.21.3)(typescript@5.4.5) '@nrsk/sigma': specifier: ^3.8.0 version: 3.8.0 @@ -549,6 +552,16 @@ packages: resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + '@jgoz/esbuild-plugin-typecheck@4.0.0': + resolution: {integrity: sha512-7yyamv/ahDr1INsPlkrmRxxa60haiGCvifcMniO9eVfSs37bz+f7yb588lNb52geUuzuPnY8Uo0LnbtFHr96BQ==} + peerDependencies: + '@jgoz/esbuild-plugin-livereload': '>=2.1.0' + esbuild: 0.17.x || 0.18.x || 0.19.x || 0.20.x || 0.21.x + typescript: '>= 3.5' + peerDependenciesMeta: + '@jgoz/esbuild-plugin-livereload': + optional: true + '@jridgewell/gen-mapping@0.3.3': resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} engines: {node: '>=6.0.0'} @@ -2699,6 +2712,11 @@ snapshots: '@types/yargs': 17.0.32 chalk: 4.1.2 + '@jgoz/esbuild-plugin-typecheck@4.0.0(esbuild@0.21.3)(typescript@5.4.5)': + dependencies: + esbuild: 0.21.3 + typescript: 5.4.5 + '@jridgewell/gen-mapping@0.3.3': dependencies: '@jridgewell/set-array': 1.1.2