nobody
nobody•2mo ago

How to install npm dev dependencies?

I try to install keysely-codegen using deno add -D npm:kysely-codegen but everytime it adds the dependency to my regular imports in the deno.json, which looks like this:
{
"nodeModulesDir": "auto",
"tasks": {
"dev": "deno run --watch main.ts"
},
"imports": {
"hono": "npm:hono@^4.6.11",
"kysely": "npm:kysely@^0.27.4",
"kysely-codegen": "npm:kysely-codegen@^0.17.0",
"pg": "npm:pg@^8.13.1",
"@types/pg": "npm:@types/pg@^8.11.10",
"pg-pool": "npm:pg-pool@^3.7.0"
}
}
{
"nodeModulesDir": "auto",
"tasks": {
"dev": "deno run --watch main.ts"
},
"imports": {
"hono": "npm:hono@^4.6.11",
"kysely": "npm:kysely@^0.27.4",
"kysely-codegen": "npm:kysely-codegen@^0.17.0",
"pg": "npm:pg@^8.13.1",
"@types/pg": "npm:@types/pg@^8.11.10",
"pg-pool": "npm:pg-pool@^3.7.0"
}
}
what am I doing wrong here? I still have a hard time how the npm stuff works with deno
1 Reply
Doctor 🤖
Doctor 🤖•2mo ago
There is no separation in the imports within deno.json. One isn't needed for Deno as only the dependencies actually used are actually loaded when ran or compiled when built. Etc The flag only does something if Deno was adding it to a package.json file.

Did you find this page helpful?