From c9bf222e4a3d79a8cd9e86b1bf413ea5531cccc1 Mon Sep 17 00:00:00 2001 From: jkomyno Date: Mon, 16 Sep 2024 12:33:00 +0200 Subject: [PATCH] fix(scaffolding): allow TS Server to see Vitest globals on tests --- package.json | 3 --- packages/common-utils/package.json | 4 ++-- packages/common-utils/tsconfig.build.json | 7 +++++++ packages/common-utils/tsconfig.json | 2 +- packages/example/package.json | 4 ++-- packages/example/tsconfig.build.json | 7 +++++++ packages/example/tsconfig.json | 2 +- turbo.json | 3 --- 8 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 packages/common-utils/tsconfig.build.json create mode 100644 packages/example/tsconfig.build.json diff --git a/package.json b/package.json index 05dcee1..b308a92 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,6 @@ "build": "turbo run build", "clean": "turbo run clean", "watch": "turbo run watch", - "prettier-check": "turbo run prettier-check", - "prettier-write": "turbo run prettier-write", - "typecheck": "turbo run typecheck", "lint:ci": "turbo run lint:ci", "lint": "turbo run lint", "test": "pnpm -r --if-present test", diff --git a/packages/common-utils/package.json b/packages/common-utils/package.json index 96e1ac3..95d8489 100644 --- a/packages/common-utils/package.json +++ b/packages/common-utils/package.json @@ -13,8 +13,8 @@ }, "scripts": { "clean": "rimraf build", - "build": "pnpm clean && tsc", - "typecheck": "tsc", + "prebuild": "pnpm clean", + "build": "tsc --build tsconfig.build.json", "lint:ci": "biome ci", "lint": "biome check --fix --unsafe", "test": "vitest --workspace ../../vitest.workspace.ts run", diff --git a/packages/common-utils/tsconfig.build.json b/packages/common-utils/tsconfig.build.json new file mode 100644 index 0000000..9191049 --- /dev/null +++ b/packages/common-utils/tsconfig.build.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.base.node.json", + "include": ["src"], + "compilerOptions": { + "outDir": "build" + } +} diff --git a/packages/common-utils/tsconfig.json b/packages/common-utils/tsconfig.json index 9191049..78ccf26 100644 --- a/packages/common-utils/tsconfig.json +++ b/packages/common-utils/tsconfig.json @@ -1,6 +1,6 @@ { "extends": "../../tsconfig.base.node.json", - "include": ["src"], + "include": ["src", "__tests__"], "compilerOptions": { "outDir": "build" } diff --git a/packages/example/package.json b/packages/example/package.json index abba2d4..9acb248 100644 --- a/packages/example/package.json +++ b/packages/example/package.json @@ -6,8 +6,8 @@ "main": "./build/index.js", "scripts": { "clean": "rimraf build", - "build": "pnpm clean && tsc", - "typecheck": "tsc", + "prebuild": "pnpm clean", + "build": "tsc --build tsconfig.build.json", "lint:ci": "biome ci", "lint": "biome check --fix --unsafe", "test:unit": "vitest --workspace ../../vitest.workspace.ts --project unit run" diff --git a/packages/example/tsconfig.build.json b/packages/example/tsconfig.build.json new file mode 100644 index 0000000..9191049 --- /dev/null +++ b/packages/example/tsconfig.build.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.base.node.json", + "include": ["src"], + "compilerOptions": { + "outDir": "build" + } +} diff --git a/packages/example/tsconfig.json b/packages/example/tsconfig.json index 9191049..78ccf26 100644 --- a/packages/example/tsconfig.json +++ b/packages/example/tsconfig.json @@ -1,6 +1,6 @@ { "extends": "../../tsconfig.base.node.json", - "include": ["src"], + "include": ["src", "__tests__"], "compilerOptions": { "outDir": "build" } diff --git a/turbo.json b/turbo.json index 635671f..f8b2411 100644 --- a/turbo.json +++ b/turbo.json @@ -8,9 +8,6 @@ "app#watch": { "dependsOn": ["^build"] }, - "typecheck": { - "dependsOn": ["^typecheck"] - }, "lint:ci": {}, "lint": {}, "clean": {