From 11222f240ed1e223c4fa4d4a581aaadc9e5759f4 Mon Sep 17 00:00:00 2001 From: seveibar Date: Sat, 30 Nov 2024 20:01:37 +0800 Subject: [PATCH 1/2] add workflows --- .github/workflows/bun-formatcheck.yml | 26 ++++++++++++++++++++++++++ .github/workflows/bun-test.yml | 25 +++++++++++++++++++++++++ .github/workflows/bun-typecheck.yml | 26 ++++++++++++++++++++++++++ lib/index.ts | 2 ++ package.json | 3 ++- tests/example1-readme-example.test.tsx | 2 +- 6 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/bun-formatcheck.yml create mode 100644 .github/workflows/bun-test.yml create mode 100644 .github/workflows/bun-typecheck.yml diff --git a/.github/workflows/bun-formatcheck.yml b/.github/workflows/bun-formatcheck.yml new file mode 100644 index 0000000..2d36363 --- /dev/null +++ b/.github/workflows/bun-formatcheck.yml @@ -0,0 +1,26 @@ +# Created using @tscircuit/plop (npm install -g @tscircuit/plop) +name: Format Check + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + format-check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Run format check + run: bun run format:check diff --git a/.github/workflows/bun-test.yml b/.github/workflows/bun-test.yml new file mode 100644 index 0000000..bb0b453 --- /dev/null +++ b/.github/workflows/bun-test.yml @@ -0,0 +1,25 @@ +# Created using @tscircuit/plop (npm install -g @tscircuit/plop) +name: Bun Test + +on: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Run tests + run: bun test diff --git a/.github/workflows/bun-typecheck.yml b/.github/workflows/bun-typecheck.yml new file mode 100644 index 0000000..22b3f96 --- /dev/null +++ b/.github/workflows/bun-typecheck.yml @@ -0,0 +1,26 @@ +# Created using @tscircuit/plop (npm install -g @tscircuit/plop) +name: Type Check + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + type-check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Install dependencies + run: bun i + + - name: Run type check + run: bunx tsc --noEmit diff --git a/lib/index.ts b/lib/index.ts index a119017..d3c3e61 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -22,5 +22,7 @@ export const createCircuitWebWorker = async ( // TODO set up listeners to track render state + console.log(webWorker) + return webWorker as any } diff --git a/package.json b/package.json index eb35311..c9933d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { - "name": "eval-webworker", + "name": "@tscircuit/eval-webworker", "main": "dist/lib/index.js", + "version": "0.0.1", "type": "module", "scripts": { "build": "tsup-node ./lib/index.ts ./webworker/index.ts --format esm --sourcemap" diff --git a/tests/example1-readme-example.test.tsx b/tests/example1-readme-example.test.tsx index fa91773..c376a5d 100644 --- a/tests/example1-readme-example.test.tsx +++ b/tests/example1-readme-example.test.tsx @@ -2,7 +2,7 @@ import { createCircuitWebWorker } from "lib" import { expect, test } from "bun:test" test("example1-readme-example", async () => { - const circuitWebWorker = createCircuitWebWorker({ + const circuitWebWorker = await createCircuitWebWorker({ webWorkerUrl: new URL("../webworker/index.ts", import.meta.url), }) From ce4bc277c6a088435b8d269651dd92d6f7d3ece4 Mon Sep 17 00:00:00 2001 From: seveibar Date: Sat, 30 Nov 2024 20:04:38 +0800 Subject: [PATCH 2/2] add format and format check commands --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c9933d1..4bb1f82 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "version": "0.0.1", "type": "module", "scripts": { - "build": "tsup-node ./lib/index.ts ./webworker/index.ts --format esm --sourcemap" + "build": "tsup-node ./lib/index.ts ./webworker/index.ts --format esm --sourcemap", + "format": "biome format --write .", + "format:check": "biome format ." }, "devDependencies": { "@babel/standalone": "^7.26.2",