RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.
MIT License
770 stars 69 forks source link

Deno support #83

Open harastaivan opened 1 year ago

harastaivan commented 1 year ago

Hello, I tried to use kysely-codegen with Deno. Since kysely supports Deno, I thought kysely-codegen will work too.

I ran:

deno run npm:kysely-codegen

It outputs:

• Loaded environment variables from .env file.
• No dialect specified. Assuming 'postgres'.

But it seems it doesn't do anything. Could you test it and possibly help me what's the problem? I'm happy to help with investigation but need some guide

Upvote & Fund

Fund with Polar

kbaba1001 commented 7 months ago

I was able to run like this on deno.json:

"tasks": {
    "kysely-codegen": "echo \"import 'npm:pg@^8.11.3'; import 'npm:kysely-codegen@^0.11.0';\" | deno run --allow-env -A npm:kysely-codegen@^0.11.0 - kysely-codegen --dialect=postgres --out-file ./src/database-types.ts --env-file .env"
},
w7it commented 5 months ago

Or try to cache required package before run codegen:

deno cache npm:pg && deno run -A npm:kysely-codegen --out-file=./db_schema.ts