From 1626cf57e94706e1fc8b2f9ff4f173fe486d5150 Mon Sep 17 00:00:00 2001 From: Young-Jin Park Date: Mon, 11 Nov 2024 17:43:09 -0500 Subject: [PATCH] feat: add back deno runtime testing without type checks --- ecosystem-tests/cli.ts | 18 ++++++++---------- ecosystem-tests/deno/deno.jsonc | 7 +++---- scripts/build-deno | 18 +++++++++++++----- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/ecosystem-tests/cli.ts b/ecosystem-tests/cli.ts index b0ff712f1..4803b47c2 100644 --- a/ecosystem-tests/cli.ts +++ b/ecosystem-tests/cli.ts @@ -95,16 +95,14 @@ const projectRunners = { await run('bun', ['test']); } }, - // Temporarily comment this out until we can test with JSR transformations end-to-end. - // deno: async () => { - // // we don't need to explicitly install the package here - // // because our deno setup relies on `rootDir/deno` to exist - // // which is an artifact produced from our build process - // await run('deno', ['task', 'install']); - // await run('deno', ['task', 'check']); - - // if (state.live) await run('deno', ['task', 'test']); - // }, + deno: async () => { + // we don't need to explicitly install the package here + // because our deno setup relies on `rootDir/dist-deno` to exist + // which is an artifact produced from our build process + await run('deno', ['task', 'install', '--unstable-sloppy-imports']); + + if (state.live) await run('deno', ['task', 'test']); + }, }; let projectNames = Object.keys(projectRunners) as Array; diff --git a/ecosystem-tests/deno/deno.jsonc b/ecosystem-tests/deno/deno.jsonc index 7de05f2ba..46d7ee486 100644 --- a/ecosystem-tests/deno/deno.jsonc +++ b/ecosystem-tests/deno/deno.jsonc @@ -1,11 +1,10 @@ { "tasks": { "install": "deno install --node-modules-dir main_test.ts -f", - "check": "deno lint && deno check main_test.ts", - "test": "deno test --allow-env --allow-net --allow-read --node-modules-dir" + "test": "deno test --allow-env --allow-net --allow-read --node-modules-dir --unstable-sloppy-imports --no-check" }, "imports": { - "openai": "../../deno/mod.ts", - "openai/": "../../deno/" + "openai": "../../dist-deno/index.ts", + "openai/": "../../dist-deno/" } } diff --git a/scripts/build-deno b/scripts/build-deno index 4a2000a66..dfce83548 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -7,13 +7,21 @@ cd "$(dirname "$0")/.." rm -rf dist-deno; mkdir dist-deno cp -rp src/* jsr.json dist-deno +rm -rf dist-deno/shims + +rm dist-deno/_shims/node*.{js,mjs,ts} +rm dist-deno/_shims/manual*.{js,mjs,ts} +rm dist-deno/_shims/index.{d.ts,js,mjs} +for file in dist-deno/_shims/*-deno.ts; do + mv -- "$file" "${file%-deno.ts}.ts" +done + rm dist-deno/_shims/auto/*-node.ts -for dir in dist-deno/_shims dist-deno/_shims/auto; do - rm "${dir}"/*.{d.ts,js,mjs} - for file in "${dir}"/*-deno.ts; do - mv -- "$file" "${file%-deno.ts}.ts" - done +rm dist-deno/_shims/auto/*.{d.ts,js,mjs} +for file in dist-deno/_shims/auto/*-deno.ts; do + mv -- "$file" "${file%-deno.ts}.ts" done + for file in README.md LICENSE CHANGELOG.md; do if [ -e "${file}" ]; then cp "${file}" dist-deno; fi done