notiz-dev / prisma-dbml-generator

Prisma DBML Generator
MIT License
685 stars 37 forks source link

prisma-dbml-generator not fund when using local package call #24

Open ssukienn opened 3 years ago

ssukienn commented 3 years ago

I am using husky to execute pre-commit script. I have there something like:

   ...
    ./node_modules/.bin/prisma generate <-- problem
    git add 'prisma/dbml/schema.dbml'

it is not working returning error:

Error: Generator at prisma-dbml-generator could not start: /bin/sh: 1: prisma-dbml-generator: not found

Everything works fine using prisma generate from local project terminal or npx/yarn prisma generate in husky script but not with explicit package call. I suspect there is some problem with PATH and my intention here is to let the husky script be package manager agnostic by using preinstalled binaries whether it is yarn or npm etc.

Could you direct me on how to make it work or maybe is there something you could do to make prisma binary be aware of your generator so it can call it directly?

luskin commented 1 year ago

We solved this by having separate generate calls, move the dbml generate out and use "prisma generate --generator client" in package.json instead.

RioChndr commented 3 months ago

I found this problem too. I agree with @luskin, separate the process generate calls. here is my package.json:

"scripts": {
    "prisma:generate": "npx prisma generate --generator client",
    "prisma:generate:all": "npx prisma generate",
}

by default run npm run prisma:generate will generate the client only, in my case I run inside the docker. And run npm run prisma:generate:all to generate all generator (include dbml)

Reference : Prisma cli generator