RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feature request] Custom env file flag

thiskevinwang opened this issue · comments

Request

  • support a --env-file flag (or other solution!)

Rationale

I currently an using kysely-codegen within a nested npm workspace. I have a top-level .env file that I want to reference, and I have a monstrosity of a cmd like:

  "db": "kysely-codegen --dialect=postgres  --out-file=./generated/db.d.ts",
  "gen:db": "DOTENV_CONFIG_PATH=../../.env node -r dotenv/config -e 'require(`child_process`).exec(`npm run db`)'",

Project structure looks like:

/my-project
├── package.json
├── .env
├── apps/
|   ├── api/
|   |   ├── package.json
|   |   ├── docker-compose.yml

Prior art

Here's a docker compose example to be run from a monorepo root

docker compose --env-file .env -f apps/api/docker-compose.yml up --build --abort-on-container-exit
  • references a top-level .env file
  • references a nested docker-compose.yml file