From 65e90325d0e786a56d1ffc1ecdc06d3e3610bd2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Sat, 25 Jul 2026 23:47:16 +0200 Subject: [PATCH] Change build system --- packages/effect-fc-next/package.json | 4 +-- .../{test => src}/Async.test.tsx | 8 +++--- .../{test => src}/Component.test.tsx | 8 +++--- .../{test => src}/Lens.test.tsx | 6 ++--- .../{test => src}/Query.test.ts | 6 ++--- .../{test => src}/Refreshable.test.ts | 4 +-- .../{test => src}/View.test.tsx | 6 ++--- .../{test/setup.ts => src/setup-tests.ts} | 0 packages/effect-fc-next/tsconfig.build.json | 4 +++ packages/effect-fc-next/tsconfig.json | 1 - packages/effect-fc-next/vitest.config.ts | 4 +-- packages/effect-fc/package.json | 4 +-- .../{test => src}/Component.test.tsx | 4 +-- .../effect-fc/{test => src}/Lens.test.tsx | 6 ++--- .../effect-fc/{test => src}/Query.test.ts | 6 ++--- .../{test => src}/Subscribable.test.tsx | 6 ++--- packages/effect-fc/tsconfig.build.json | 4 +++ packages/effect-fc/tsconfig.json | 1 - packages/effect-fc/vitest.config.ts | 2 +- packages/vite-plugin/biome.json | 2 +- packages/vite-plugin/package.json | 4 +-- .../vite-plugin/{test => src}/plugin.test.ts | 2 +- .../vite-plugin/{test => src}/runtime.test.ts | 2 +- packages/vite-plugin/tsconfig.build.json | 4 +++ packages/vite-plugin/tsconfig.json | 26 ++++++++++++++++--- packages/vite-plugin/vitest.config.ts | 2 +- 26 files changed, 78 insertions(+), 48 deletions(-) rename packages/effect-fc-next/{test => src}/Async.test.tsx (91%) rename packages/effect-fc-next/{test => src}/Component.test.tsx (98%) rename packages/effect-fc-next/{test => src}/Lens.test.tsx (97%) rename packages/effect-fc-next/{test => src}/Query.test.ts (97%) rename packages/effect-fc-next/{test => src}/Refreshable.test.ts (95%) rename packages/effect-fc-next/{test => src}/View.test.tsx (95%) rename packages/effect-fc-next/{test/setup.ts => src/setup-tests.ts} (100%) create mode 100644 packages/effect-fc-next/tsconfig.build.json rename packages/effect-fc/{test => src}/Component.test.tsx (99%) rename packages/effect-fc/{test => src}/Lens.test.tsx (97%) rename packages/effect-fc/{test => src}/Query.test.ts (97%) rename packages/effect-fc/{test => src}/Subscribable.test.tsx (96%) create mode 100644 packages/effect-fc/tsconfig.build.json rename packages/vite-plugin/{test => src}/plugin.test.ts (98%) rename packages/vite-plugin/{test => src}/runtime.test.ts (98%) create mode 100644 packages/vite-plugin/tsconfig.build.json diff --git a/packages/effect-fc-next/package.json b/packages/effect-fc-next/package.json index ce2152c..091e545 100644 --- a/packages/effect-fc-next/package.json +++ b/packages/effect-fc-next/package.json @@ -90,9 +90,9 @@ "lint:tsc": "tsc --noEmit", "lint:biome": "biome lint", "test": "vitest run", - "build": "tsc", + "build": "tsc -b tsconfig.build.json", "pack": "npm pack", - "clean:cache": "rm -rf .turbo tsconfig.tsbuildinfo", + "clean:cache": "rm -rf .turbo *.tsbuildinfo", "clean:dist": "rm -rf dist", "clean:modules": "rm -rf node_modules" }, diff --git a/packages/effect-fc-next/test/Async.test.tsx b/packages/effect-fc-next/src/Async.test.tsx similarity index 91% rename from packages/effect-fc-next/test/Async.test.tsx rename to packages/effect-fc-next/src/Async.test.tsx index 91182d2..eb41758 100644 --- a/packages/effect-fc-next/test/Async.test.tsx +++ b/packages/effect-fc-next/src/Async.test.tsx @@ -2,10 +2,10 @@ import { act, fireEvent, render, screen } from "@testing-library/react" import { Effect, Layer } from "effect" import * as React from "react" import { describe, expect, it, vi } from "vitest" -import * as Async from "../src/Async.js" -import * as Component from "../src/Component.js" -import * as Memoized from "../src/Memoized.js" -import * as ReactRuntime from "../src/ReactRuntime.js" +import * as Async from "./Async.js" +import * as Component from "./Component.js" +import * as Memoized from "./Memoized.js" +import * as ReactRuntime from "./ReactRuntime.js" describe("Async", () => { it("does not rerun for an unrelated parent state update", async () => { diff --git a/packages/effect-fc-next/test/Component.test.tsx b/packages/effect-fc-next/src/Component.test.tsx similarity index 98% rename from packages/effect-fc-next/test/Component.test.tsx rename to packages/effect-fc-next/src/Component.test.tsx index 4087766..b15d3ef 100644 --- a/packages/effect-fc-next/test/Component.test.tsx +++ b/packages/effect-fc-next/src/Component.test.tsx @@ -2,10 +2,10 @@ import { act, fireEvent, render, screen, waitFor } from "@testing-library/react" import { Context, Effect, HashMap, Layer, SubscriptionRef } from "effect" import * as React from "react" import { afterEach, describe, expect, it, vi } from "vitest" -import * as Component from "../src/Component.js" -import * as ReactRuntime from "../src/ReactRuntime.js" -import * as Refreshable from "../src/Refreshable.js" -import * as ScopeRegistry from "../src/ScopeRegistry.js" +import * as Component from "./Component.js" +import * as ReactRuntime from "./ReactRuntime.js" +import * as Refreshable from "./Refreshable.js" +import * as ScopeRegistry from "./ScopeRegistry.js" class ValueService extends Context.Service()("ValueService") {} diff --git a/packages/effect-fc-next/test/Lens.test.tsx b/packages/effect-fc-next/src/Lens.test.tsx similarity index 97% rename from packages/effect-fc-next/test/Lens.test.tsx rename to packages/effect-fc-next/src/Lens.test.tsx index 093b7bf..82e161d 100644 --- a/packages/effect-fc-next/test/Lens.test.tsx +++ b/packages/effect-fc-next/src/Lens.test.tsx @@ -2,9 +2,9 @@ import { fireEvent, render, screen, waitFor } from "@testing-library/react" import { Effect, Layer, SubscriptionRef } from "effect" import * as React from "react" import { describe, expect, it } from "vitest" -import * as Component from "../src/Component.js" -import * as Lens from "../src/Lens.js" -import * as ReactRuntime from "../src/ReactRuntime.js" +import * as Component from "./Component.js" +import * as Lens from "./Lens.js" +import * as ReactRuntime from "./ReactRuntime.js" const makeRuntime = async () => { diff --git a/packages/effect-fc-next/test/Query.test.ts b/packages/effect-fc-next/src/Query.test.ts similarity index 97% rename from packages/effect-fc-next/test/Query.test.ts rename to packages/effect-fc-next/src/Query.test.ts index 66724d1..b518c0d 100644 --- a/packages/effect-fc-next/test/Query.test.ts +++ b/packages/effect-fc-next/src/Query.test.ts @@ -1,9 +1,9 @@ import { Effect, type Scope, Stream } from "effect" import { AsyncResult } from "effect/unstable/reactivity" import { describe, expect, it } from "vitest" -import * as Query from "../src/Query.js" -import * as QueryClient from "../src/QueryClient.js" -import * as View from "../src/View.js" +import * as Query from "./Query.js" +import * as QueryClient from "./QueryClient.js" +import * as View from "./View.js" const runQueryTest = (effect: Effect.Effect) => diff --git a/packages/effect-fc-next/test/Refreshable.test.ts b/packages/effect-fc-next/src/Refreshable.test.ts similarity index 95% rename from packages/effect-fc-next/test/Refreshable.test.ts rename to packages/effect-fc-next/src/Refreshable.test.ts index e756d7c..110ca74 100644 --- a/packages/effect-fc-next/test/Refreshable.test.ts +++ b/packages/effect-fc-next/src/Refreshable.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from "vitest" -import type * as Component from "../src/Component.js" -import * as Refreshable from "../src/Refreshable.js" +import type * as Component from "./Component.js" +import * as Refreshable from "./Refreshable.js" describe("Refreshable", () => { diff --git a/packages/effect-fc-next/test/View.test.tsx b/packages/effect-fc-next/src/View.test.tsx similarity index 95% rename from packages/effect-fc-next/test/View.test.tsx rename to packages/effect-fc-next/src/View.test.tsx index 301b6de..4dbd72b 100644 --- a/packages/effect-fc-next/test/View.test.tsx +++ b/packages/effect-fc-next/src/View.test.tsx @@ -2,9 +2,9 @@ import { render, screen, waitFor } from "@testing-library/react" import { Effect, Layer, SubscriptionRef } from "effect" import { Lens } from "effect-lens" import { describe, expect, it } from "vitest" -import * as Component from "../src/Component.js" -import * as ReactRuntime from "../src/ReactRuntime.js" -import * as View from "../src/View.js" +import * as Component from "./Component.js" +import * as ReactRuntime from "./ReactRuntime.js" +import * as View from "./View.js" const makeRuntime = async () => { diff --git a/packages/effect-fc-next/test/setup.ts b/packages/effect-fc-next/src/setup-tests.ts similarity index 100% rename from packages/effect-fc-next/test/setup.ts rename to packages/effect-fc-next/src/setup-tests.ts diff --git a/packages/effect-fc-next/tsconfig.build.json b/packages/effect-fc-next/tsconfig.build.json new file mode 100644 index 0000000..a79c9cd --- /dev/null +++ b/packages/effect-fc-next/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["**/setup-tests.ts", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"] +} diff --git a/packages/effect-fc-next/tsconfig.json b/packages/effect-fc-next/tsconfig.json index 6ad0810..f5ac024 100644 --- a/packages/effect-fc-next/tsconfig.json +++ b/packages/effect-fc-next/tsconfig.json @@ -36,5 +36,4 @@ }, "include": ["./src"], - "exclude": ["**/*.test.ts", "**/*.spec.ts"] } diff --git a/packages/effect-fc-next/vitest.config.ts b/packages/effect-fc-next/vitest.config.ts index 1374d42..b59fb83 100644 --- a/packages/effect-fc-next/vitest.config.ts +++ b/packages/effect-fc-next/vitest.config.ts @@ -4,7 +4,7 @@ import { defineConfig } from "vitest/config" export default defineConfig({ test: { environment: "jsdom", - include: ["test/**/*.test.ts?(x)"], - setupFiles: ["test/setup.ts"], + include: ["./src/**/*.test.ts?(x)"], + setupFiles: ["./src/setup-tests.ts"], }, }) diff --git a/packages/effect-fc/package.json b/packages/effect-fc/package.json index f729dad..f49579e 100644 --- a/packages/effect-fc/package.json +++ b/packages/effect-fc/package.json @@ -29,12 +29,12 @@ ] }, "scripts": { - "build": "tsc", "lint:tsc": "tsc --noEmit", "lint:biome": "biome lint", "test": "vitest run", + "build": "tsc -b tsconfig.build.json", "pack": "npm pack", - "clean:cache": "rm -rf .turbo tsconfig.tsbuildinfo", + "clean:cache": "rm -rf .turbo *.tsbuildinfo", "clean:dist": "rm -rf dist", "clean:modules": "rm -rf node_modules" }, diff --git a/packages/effect-fc/test/Component.test.tsx b/packages/effect-fc/src/Component.test.tsx similarity index 99% rename from packages/effect-fc/test/Component.test.tsx rename to packages/effect-fc/src/Component.test.tsx index f870806..8ab9af1 100644 --- a/packages/effect-fc/test/Component.test.tsx +++ b/packages/effect-fc/src/Component.test.tsx @@ -2,8 +2,8 @@ import { render, screen, waitFor } from "@testing-library/react" import { Context, Effect, Layer } from "effect" import * as React from "react" import { afterEach, describe, expect, it, vi } from "vitest" -import * as Component from "../src/Component.js" -import * as ReactRuntime from "../src/ReactRuntime.js" +import * as Component from "./Component.js" +import * as ReactRuntime from "./ReactRuntime.js" class ValueService extends Context.Tag("ValueService")() {} diff --git a/packages/effect-fc/test/Lens.test.tsx b/packages/effect-fc/src/Lens.test.tsx similarity index 97% rename from packages/effect-fc/test/Lens.test.tsx rename to packages/effect-fc/src/Lens.test.tsx index 9bf6233..e6ce6bb 100644 --- a/packages/effect-fc/test/Lens.test.tsx +++ b/packages/effect-fc/src/Lens.test.tsx @@ -2,9 +2,9 @@ import { fireEvent, render, screen, waitFor } from "@testing-library/react" import { Effect, Layer, SubscriptionRef } from "effect" import * as React from "react" import { describe, expect, it } from "vitest" -import * as Component from "../src/Component.js" -import * as Lens from "../src/Lens.js" -import * as ReactRuntime from "../src/ReactRuntime.js" +import * as Component from "./Component.js" +import * as Lens from "./Lens.js" +import * as ReactRuntime from "./ReactRuntime.js" const makeRuntime = async () => { diff --git a/packages/effect-fc/test/Query.test.ts b/packages/effect-fc/src/Query.test.ts similarity index 97% rename from packages/effect-fc/test/Query.test.ts rename to packages/effect-fc/src/Query.test.ts index ee6544f..c5d37be 100644 --- a/packages/effect-fc/test/Query.test.ts +++ b/packages/effect-fc/src/Query.test.ts @@ -1,8 +1,8 @@ import { Effect, Option, type Scope, Stream } from "effect" import { describe, expect, it } from "vitest" -import * as Query from "../src/Query.js" -import * as QueryClient from "../src/QueryClient.js" -import * as Result from "../src/Result.js" +import * as Query from "./Query.js" +import * as QueryClient from "./QueryClient.js" +import * as Result from "./Result.js" const runQueryTest = (effect: Effect.Effect) => diff --git a/packages/effect-fc/test/Subscribable.test.tsx b/packages/effect-fc/src/Subscribable.test.tsx similarity index 96% rename from packages/effect-fc/test/Subscribable.test.tsx rename to packages/effect-fc/src/Subscribable.test.tsx index 772d330..c76132a 100644 --- a/packages/effect-fc/test/Subscribable.test.tsx +++ b/packages/effect-fc/src/Subscribable.test.tsx @@ -2,9 +2,9 @@ import { render, screen, waitFor } from "@testing-library/react" import { Effect, Fiber, Layer, Stream, SubscriptionRef } from "effect" import { Lens } from "effect-lens" import { describe, expect, it } from "vitest" -import * as Component from "../src/Component.js" -import * as ReactRuntime from "../src/ReactRuntime.js" -import * as Subscribable from "../src/Subscribable.js" +import * as Component from "./Component.js" +import * as ReactRuntime from "./ReactRuntime.js" +import * as Subscribable from "./Subscribable.js" const makeRuntime = async () => { diff --git a/packages/effect-fc/tsconfig.build.json b/packages/effect-fc/tsconfig.build.json new file mode 100644 index 0000000..a79c9cd --- /dev/null +++ b/packages/effect-fc/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["**/setup-tests.ts", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"] +} diff --git a/packages/effect-fc/tsconfig.json b/packages/effect-fc/tsconfig.json index 6ad0810..f5ac024 100644 --- a/packages/effect-fc/tsconfig.json +++ b/packages/effect-fc/tsconfig.json @@ -36,5 +36,4 @@ }, "include": ["./src"], - "exclude": ["**/*.test.ts", "**/*.spec.ts"] } diff --git a/packages/effect-fc/vitest.config.ts b/packages/effect-fc/vitest.config.ts index cec0e39..75476d8 100644 --- a/packages/effect-fc/vitest.config.ts +++ b/packages/effect-fc/vitest.config.ts @@ -4,6 +4,6 @@ import { defineConfig } from "vitest/config" export default defineConfig({ test: { environment: "jsdom", - include: ["test/**/*.test.ts?(x)"], + include: ["./src/**/*.test.ts?(x)"], }, }) diff --git a/packages/vite-plugin/biome.json b/packages/vite-plugin/biome.json index 868f17a..41d707b 100644 --- a/packages/vite-plugin/biome.json +++ b/packages/vite-plugin/biome.json @@ -3,6 +3,6 @@ "root": false, "extends": "//", "files": { - "includes": ["./src/**", "./test/**"] + "includes": ["./src/**"] } } diff --git a/packages/vite-plugin/package.json b/packages/vite-plugin/package.json index e863379..74c9c4b 100644 --- a/packages/vite-plugin/package.json +++ b/packages/vite-plugin/package.json @@ -26,9 +26,9 @@ "lint:tsc": "tsc --noEmit", "lint:biome": "biome lint", "test": "vitest run", - "build": "tsc", + "build": "tsc -b tsconfig.build.json", "pack": "npm pack", - "clean:cache": "rm -rf .turbo tsconfig.tsbuildinfo", + "clean:cache": "rm -rf .turbo *.tsbuildinfo", "clean:dist": "rm -rf dist", "clean:modules": "rm -rf node_modules" }, diff --git a/packages/vite-plugin/test/plugin.test.ts b/packages/vite-plugin/src/plugin.test.ts similarity index 98% rename from packages/vite-plugin/test/plugin.test.ts rename to packages/vite-plugin/src/plugin.test.ts index ce2fdbc..f78486c 100644 --- a/packages/vite-plugin/test/plugin.test.ts +++ b/packages/vite-plugin/src/plugin.test.ts @@ -1,7 +1,7 @@ import path from "node:path" import type { Plugin, TransformPluginContext } from "vite" import { describe, expect, it } from "vitest" -import { effectViewPlugin } from "../src/index.js" +import { effectViewPlugin } from "./index.js" const runTransform = async ( diff --git a/packages/vite-plugin/test/runtime.test.ts b/packages/vite-plugin/src/runtime.test.ts similarity index 98% rename from packages/vite-plugin/test/runtime.test.ts rename to packages/vite-plugin/src/runtime.test.ts index ff200ef..65be4a7 100644 --- a/packages/vite-plugin/test/runtime.test.ts +++ b/packages/vite-plugin/src/runtime.test.ts @@ -1,7 +1,7 @@ import type * as Component from "effect-fc-next/Component" import * as Refreshable from "effect-fc-next/Refreshable" import { describe, expect, it, vi } from "vitest" -import { accept, register } from "../src/runtime.js" +import { accept, register } from "./runtime.js" describe("refresh runtime", () => { diff --git a/packages/vite-plugin/tsconfig.build.json b/packages/vite-plugin/tsconfig.build.json new file mode 100644 index 0000000..a79c9cd --- /dev/null +++ b/packages/vite-plugin/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["**/setup-tests.ts", "**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"] +} diff --git a/packages/vite-plugin/tsconfig.json b/packages/vite-plugin/tsconfig.json index 625da67..f5ac024 100644 --- a/packages/vite-plugin/tsconfig.json +++ b/packages/vite-plugin/tsconfig.json @@ -1,19 +1,39 @@ { "compilerOptions": { - "lib": ["ESNext"], + // Enable latest features + "lib": ["ESNext", "DOM"], "target": "ESNext", "module": "NodeNext", "moduleDetection": "force", + "jsx": "react-jsx", + // "allowJs": true, + + // Bundler mode "moduleResolution": "NodeNext", + // "allowImportingTsExtensions": true, "verbatimModuleSyntax": true, + // "noEmit": true, + + // Best practices "strict": true, "skipLibCheck": true, "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false, + + // Build "rootDir": "./src", "outDir": "./dist", "declaration": true, - "sourceMap": true + "sourceMap": true, + + "plugins": [ + { "name": "@effect/language-service" } + ] }, + "include": ["./src"], - "exclude": ["**/*.test.ts", "**/*.spec.ts"] } diff --git a/packages/vite-plugin/vitest.config.ts b/packages/vite-plugin/vitest.config.ts index 78ac2cb..a5cdb63 100644 --- a/packages/vite-plugin/vitest.config.ts +++ b/packages/vite-plugin/vitest.config.ts @@ -3,6 +3,6 @@ import { defineConfig } from "vitest/config" export default defineConfig({ test: { - include: ["test/**/*.test.ts"], + include: ["./src/**/*.test.ts?(x)"], }, })