From 00826aecccac8dfcedba571ac02af1e3e1911c31 Mon Sep 17 00:00:00 2001 From: Whitewater Date: Fri, 22 Nov 2024 12:48:40 +0800 Subject: [PATCH] fix: package export path for tsconfig (#1690) * fix: update package.json paths and enable composite in tsconfig * fix: add tsconfig.tsbuildinfo to .gitignore * fix: enable composite in main * fix: update AppType import path * chore: clean tsup --- .gitignore | 1 + apps/main/package.json | 6 +++--- apps/main/src/lib/api-client.ts | 2 +- apps/main/tsconfig.json | 1 + apps/main/tsup.config.ts | 12 ------------ apps/renderer/tsconfig.json | 3 ++- package.json | 1 - packages/shared/src/index.ts | 1 + pnpm-lock.yaml | 3 --- 9 files changed, 9 insertions(+), 21 deletions(-) delete mode 100644 apps/main/tsup.config.ts diff --git a/.gitignore b/.gitignore index 715c0bbde..bb82b1017 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ vite.config.*.mjs .generated .turbo +tsconfig.tsbuildinfo diff --git a/apps/main/package.json b/apps/main/package.json index 15c6de6bd..83d904c27 100644 --- a/apps/main/package.json +++ b/apps/main/package.json @@ -11,13 +11,13 @@ }, "exports": { ".": { - "types": "./dist/export.d.ts", - "import": "./dist/export.js" + "types": "./export.d.ts", + "import": "./export.js" } }, "main": "./src/index.ts", "scripts": { - "build": "tsup", + "build": "tsc", "test": "vitest", "typecheck": "tsc --noEmit" }, diff --git a/apps/main/src/lib/api-client.ts b/apps/main/src/lib/api-client.ts index faf82a868..27821e2ee 100644 --- a/apps/main/src/lib/api-client.ts +++ b/apps/main/src/lib/api-client.ts @@ -1,9 +1,9 @@ +import type { AppType } from "@follow/shared" import { env } from "@follow/shared/env" import PKG from "@pkg" import { hc } from "hono/client" import { ofetch } from "ofetch" -import type { AppType } from "../../../../packages/shared/src/hono" import { logger } from "../logger" import { getAuthSessionToken, getUser } from "./user" diff --git a/apps/main/tsconfig.json b/apps/main/tsconfig.json index f43b867b0..83e899f20 100644 --- a/apps/main/tsconfig.json +++ b/apps/main/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "@electron-toolkit/tsconfig/tsconfig.node.json", "compilerOptions": { + "composite": true, "outDir": "dist", "types": ["electron-vite/node"], "moduleResolution": "Bundler", diff --git a/apps/main/tsup.config.ts b/apps/main/tsup.config.ts deleted file mode 100644 index b18fd438f..000000000 --- a/apps/main/tsup.config.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { defineConfig } from "tsup" - -export default defineConfig(() => ({ - entry: ["./export.ts"], - outDir: "dist", - format: "esm", - clean: true, - dts: true, - splitting: false, - sourcemap: true, - skipNodeModulesBundle: true, -})) diff --git a/apps/renderer/tsconfig.json b/apps/renderer/tsconfig.json index fd7d0c417..2d04a7ab3 100644 --- a/apps/renderer/tsconfig.json +++ b/apps/renderer/tsconfig.json @@ -17,5 +17,6 @@ "@pkg": ["../../package.json"], "@locales/*": ["../../locales/*"] } - } + }, + "references": [{ "path": "../main" }] } diff --git a/package.json b/package.json index 86e99ce0e..698509fc4 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,6 @@ "tailwindcss": "3.4.14", "tailwindcss-animate": "1.0.7", "tailwindcss-motion": "0.3.0-beta", - "tsup": "8.3.5", "tsx": "4.19.2", "turbo": "2.2.3", "typescript": "5.6.3", diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 23fdb6981..ce7c2e684 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -1 +1,2 @@ export * from "./constants" +export type { AppType } from "./hono" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5a6ecbe2c..cfc9b943d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -224,9 +224,6 @@ importers: tailwindcss-motion: specifier: 0.3.0-beta version: 0.3.0-beta(tailwindcss@3.4.14(ts-node@10.9.1(@types/node@22.8.7)(typescript@5.6.3))) - tsup: - specifier: 8.3.5 - version: 8.3.5(jiti@2.3.3)(postcss@8.4.47)(tsx@4.19.2)(typescript@5.6.3)(yaml@2.6.0) tsx: specifier: 4.19.2 version: 4.19.2