Thank you for working on kysely
. I really love working with it.
I found a couple of issues with the codegen cli though: I have a monorepo and I wanted to run kysely-codegen
in one of the packages, but it doesn't seem to find the dependencies:
$ DATABASE_URL="..." npx kysely-codegen --dialect mysql --log-level debug
• Loaded environment variables from .env file.
• Using dialect 'mysql'.
node:internal/modules/cjs/loader:1077
const err = new Error(message);
^
Error: Cannot find module 'mysql2'
Please note I already added mysql2
as a dependency to that project.
$ cat package.json | jq '.dependencies.mysql2'
"^3.6.3"
Also, it looks like the dependency is in the root node_modules
directory, which is most likely the issue.
Then I decided I would add the cli as a dev dependency to overcome the issue:
$ yarn add kysely-codegen --dev
The installation was successful, but running the CLI generated an empty db.t.ts
file a couple of times. This is probably a duplicate of #91 .
$ DATABASE_URL="..." yarn kysely-codegen --dialect mysql --log-level debug --verify
• Loaded environment variables from .env file.
• Using dialect 'mysql'.
• Introspecting database...
Found 55 public tables:
- table1
...
- table55
✓ Introspected 55 tables and generated ./node_modules/kysely-codegen/dist/db.d.ts in 502ms.
✨ Done in 1.19s.
It correctly listed all the tables from the database though. I removed and reinstalled the package, and that solved the issue.
P.S. I use node@18, [email protected] and [email protected] workspaces.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too