diff --git a/app/build.ts b/app/build.ts index eb15450..66db700 100644 --- a/app/build.ts +++ b/app/build.ts @@ -61,8 +61,11 @@ function delayTypes() { watcher_timeout = setTimeout(buildTypes, 1000); } +const dependencies = Object.keys(pkg.dependencies); + // collection of always-external packages const external = [ + ...dependencies, "bun:test", "node:test", "node:assert/strict", @@ -87,7 +90,7 @@ async function buildApi() { external: [...external], metafile: true, target: "esnext", - platform: "neutral", + platform: "browser", format: ["esm"], splitting: false, loader: { diff --git a/app/e2e/adapters.ts b/app/e2e/adapters.ts index 9ca8154..0dd009b 100644 --- a/app/e2e/adapters.ts +++ b/app/e2e/adapters.ts @@ -17,7 +17,7 @@ async function run( }); // Read from stdout - const reader = proc.stdout.getReader(); + const reader = (proc.stdout as ReadableStream).getReader(); const decoder = new TextDecoder(); // Function to read chunks @@ -30,7 +30,7 @@ async function run( const text = decoder.decode(value); if (!resolveCalled) { - console.log(c.dim(text.replace(/\n$/, ""))); + console.info(c.dim(text.replace(/\n$/, ""))); } onChunk( text, @@ -189,21 +189,21 @@ const adapters = { async function testAdapter(name: keyof typeof adapters) { const config = adapters[name]; - console.log("adapter", c.cyan(name)); + console.info("adapter", c.cyan(name)); await config.clean(); const { proc, data } = await config.start(); - console.log("proc:", proc.pid, "data:", c.cyan(data)); + console.info("proc:", proc.pid, "data:", c.cyan(data)); //proc.kill();process.exit(0); const add_env = "env" in config && config.env ? config.env : ""; await $`TEST_URL=${data} TEST_ADAPTER=${name} ${add_env} bun run test:e2e`; - console.log("DONE!"); + console.info("DONE!"); while (!proc.killed) { proc.kill("SIGINT"); await Bun.sleep(250); - console.log("Waiting for process to exit..."); + console.info("Waiting for process to exit..."); } } diff --git a/app/package.json b/app/package.json index aea0395..3277694 100644 --- a/app/package.json +++ b/app/package.json @@ -30,7 +30,7 @@ "build:types": "tsc -p tsconfig.build.json --emitDeclarationOnly && tsc-alias", "updater": "bun x npm-check-updates -ui", "cli": "LOCAL=1 bun src/cli/index.ts", - "prepublishOnly": "bun run types && bun run test && bun run test:node && bun run test:e2e && bun run build:all && cp ../README.md ./", + "prepublishOnly": "bun run types && bun run test && bun run test:node && VITE_DB_URL=:memory: bun run test:e2e && bun run build:all && cp ../README.md ./", "postpublish": "rm -f README.md", "test": "ALL_TESTS=1 bun test --bail", "test:all": "bun run test && bun run test:node", @@ -39,8 +39,8 @@ "test:adapters": "bun test src/adapter/**/*.adapter.spec.ts --bail", "test:coverage": "ALL_TESTS=1 bun test --bail --coverage", "test:vitest:coverage": "vitest run --coverage", - "test:e2e": "VITE_DB_URL=:memory: playwright test", - "test:e2e:adapters": "VITE_DB_URL=:memory: bun run e2e/adapters.ts", + "test:e2e": "playwright test", + "test:e2e:adapters": "bun run e2e/adapters.ts", "test:e2e:ui": "VITE_DB_URL=:memory: playwright test --ui", "test:e2e:debug": "VITE_DB_URL=:memory: playwright test --debug", "test:e2e:report": "VITE_DB_URL=:memory: playwright show-report", @@ -71,6 +71,7 @@ "oauth4webapi": "^2.11.1", "object-path-immutable": "^4.1.2", "radix-ui": "^1.1.3", + "picocolors": "^1.1.1", "swr": "^2.3.3" }, "devDependencies": { @@ -108,7 +109,6 @@ "libsql-stateless-easy": "^1.8.0", "open": "^10.1.0", "openapi-types": "^12.1.3", - "picocolors": "^1.1.1", "postcss": "^8.5.3", "postcss-preset-mantine": "^1.17.0", "postcss-simple-vars": "^7.0.1", diff --git a/app/src/Api.ts b/app/src/Api.ts index d9fb8e4..28d2ef0 100644 --- a/app/src/Api.ts +++ b/app/src/Api.ts @@ -43,7 +43,7 @@ export type ApiOptions = { } & ( | { token?: string; - user?: TApiUser; + user?: TApiUser | null; } | { request: Request;