diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9cf2014 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,16 @@ +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: "pnpm" + - run: pnpm install --frozen-lockfile --strict-peer-dependencies + - run: pnpm tsc + - run: pnpm build + - run: pnpm test diff --git a/package.json b/package.json index d87a3b1..0b75945 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "tsc": "tsc", "test": "vitest", "prepare": "esbuild src/index.ts --bundle --format=esm --target=esnext --outdir=dist --sourcemap=external && tsc -p tsconfig.d.json", - "build": "esbuild src/main.ts --bundle --format=iife --target=esnext --outfile=public/dist/index.js --sourcemap=inline", + "build": "esbuild src/main.ts --bundle --format=iife --target=esnext --outfile=public/dist/index.js --sourcemap=inline --log-override:import-is-undefined=error", "start": "serve public", "chrome": "chrome --no-sandbox --js-flags=--log-deopt,--log-ic,--log-maps,--log-maps-details,--log-internal-timer-events,--prof,--expose-gc,--detailed-line-info --enable-precise-memory-info --user-data-dir=$(PWD)/chrome http://localhost:3000" }, diff --git a/src/frameworks/tansu.ts b/src/frameworks/tansu.ts new file mode 100644 index 0000000..f625b34 --- /dev/null +++ b/src/frameworks/tansu.ts @@ -0,0 +1,22 @@ +import { ReactiveFramework } from "../util/reactiveFramework"; +import { writable, computed, batch } from "@amadeus-it-group/tansu"; + +export const tansuFramework: ReactiveFramework = { + name: "@amadeus-it-group/tansu", + signal: (initialValue) => { + const w = writable(initialValue); + return { + write: (v) => w.set(v), + read: () => w(), + }; + }, + computed: (fn) => { + const c = computed(fn); + return { + read: () => c(), + }; + }, + effect: (fn) => computed(fn).subscribe(() => {}), + withBatch: (fn) => batch(fn), + withBuild: (fn) => fn(), +};