From 09fc0f111f604c1970374f3e5262e92a4c4242ad Mon Sep 17 00:00:00 2001 From: Monty Anderson Date: Sat, 4 Jan 2025 21:32:00 +0000 Subject: [PATCH] `*`: use `example.mjs` --- .github/workflows/validate.yml | 2 ++ example.ts => example.mjs | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) rename example.ts => example.mjs (66%) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ad4dff7..6988ae5 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -37,3 +37,5 @@ jobs: node-version: ${{ matrix.node-version }} - run: npm run prepublish + + - run: node example.js diff --git a/example.ts b/example.mjs similarity index 66% rename from example.ts rename to example.mjs index fb45ffb..6266051 100644 --- a/example.ts +++ b/example.mjs @@ -1,12 +1,13 @@ -import { createProdia } from "./v2"; +import { createProdia } from "./dist/v2/index.js"; +import { strictEqual } from "assert"; -const token = Deno.env.get("PRODIA_TOKEN"); +const token = process.env.PRODIA_TOKEN; if (typeof token !== "string") { throw new Error("PRODIA_TOKEN is not set"); } -const isJpeg = (image: ArrayBuffer): boolean => { +const isJpeg = (image) => { const view = new Uint8Array(image); return view[0] === 0xff && view[1] === 0xd8; @@ -28,4 +29,4 @@ const job = await client.job({ const image = await job.arrayBuffer(); -assertEquals(isJpeg(image), true, "Image should be a JPEG"); \ No newline at end of file +strictEqual(isJpeg(image), true, "Image should be a JPEG");