-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(sdk): don't create package.json when running "prisma generate" #10542
Conversation
Don't create `package.json` when running `npx prisma generate`. This logic is located on the code path where `@prisma/client` is going to be installed, so npm will generate the missing `package.json` file automatically. Our implementation, though, doesn't always finding the existing `package.json` file and makes it possible to accidentally create new spurious ones in the project subfolders, which, in turn, might lead to installing packages or possibly even generating the Prisma Client in the wrong location. It's better to just remove this logic and let the package manager handle this correctly. Possibly/partially related: * #9553 (comment) * #9553 (comment) * #10488
Is that indeed so? Also when there is a |
If there's a From the user perspective, you can run |
So right now (with the code still in place) this would prevent And if there is no |
Generally, yes. A few notes though:
Interestingly, it doesn't necessarily prevent the automatic installation of
Yes, I've just double-checked this with npm and Yarn. The only difference seems to be that the |
Difficult statement to make. I think we modelled the created file after what |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are not aware of any functionality depending on this file creation, I am in favor of removing it and waiting for something to break and then potentially fix it.
If nothing breaks, we got rid of a badly understood and completely undocumented feature with a lot of potential for damage (see issues and general discussion).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a good thing to remove that could break in weird ways in some setups.
It’s mentioned in https://www.prisma.io/docs/reference/api-reference/command-reference#generate and we would need to update that
Not a problem for the following because the tutorial uses
npm init -y
just before
https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/mongodb-typescript-mongodb#create-project-setup
https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-postgres#create-project-setup
Don't create
package.json
when runningnpx prisma generate
.This logic is located on the code path where
@prisma/client
is going to be installed, so npm will generate the missingpackage.json
file automatically. Our implementation, though, doesn't always finding the existingpackage.json
file and makes it possible to accidentally create new spurious ones in the project subfolders, which, in turn, might lead to installing packages or possibly even generating the Prisma Client in the wrong location. It's better to just remove this logic and let the package manager handle this correctly.Possibly/partially related: