Comments (15)
My use-case is a monorepo setup where I would like to keep the prisma files together and not modify the node-modules.
If this is not supposed to work, I would suggest to change the console output that indicates the new location. Right now the config does make it at least into the prisma generate console info.
from nexus-prisma.
I don't know what's a PSL file. I have one prisma schema file, one emitted Prisma client, that's used from a bunch of different places. I've now ditch nexus-prisma and use Pal.js to connect it to Nexus, so Prisma schema is decoupled from Nexus or nexus-prisma
generator, so I can share it with services that don't need Nexus at all.
from nexus-prisma.
This might bring significant internal complexity, I'd like to see strong use-cases for it first.
from nexus-prisma.
If this is not supposed to work, I would suggest to change the console output that indicates the new location.
You're saying that if it cannot be controlled it should not be mentioned in the logging to the user?
My use-case is a monorepo setup where I would like to keep the prisma files together and not modify the node-modules.
So this sounds like a subjective organizing principal which is fine but it would be good to know how, without this feature, what happens in your setup? What breaks? What are the blockers?
from nexus-prisma.
I think a really good way to motivate this would be to start with a PR that changes the docs in such a way as to motivate this, e.g. a recipe for "if you have X problem then set output to Y".
from nexus-prisma.
I have exactly the same usecase as @heddendorp, I want to build everything related to Prisma and Nexus once, and share it among our microservices.
from nexus-prisma.
@dimaip could you share more about what that looks like. How does the db for one microservice translate to another in a useful way?
from nexus-prisma.
@jasonkuhrt my use-case: an API that needs to access 2 different prisma schemas/clients. I don't see any solution other than having the possibility to generate the nexus-prisma files into 2 different locations. Am I wrong?
from nexus-prisma.
@filippodossena-mozart so you have two PSL files in your project modelling two different databases?
from nexus-prisma.
@jasonkuhrt all microservices share the same database/schema/Prisma client in our case.
Basically it's a bunch of independent logic deployed and packaged separately, on top of existing monolith app.
from nexus-prisma.
@dimaip so there is one PSL file. Thus Prisma Client is being emitted into one place I assume?
from nexus-prisma.
@jasonkuhrt yes, 2 different prisma schema files.
from nexus-prisma.
@filippodossena-mozart interesting use-case, I think that seals it for me, in that case its essential.
from nexus-prisma.
@jasonkuhrt as a workaround I leveraged the nohoist option of yarn
.
The following is the setup that seems to be working.
In the monorepo I created 2 packages, each one containing its own PSL file and an index.ts
that exports from @prisma/client
and nexus-prisma
:
// index.ts
export * from "@prisma/client"
export * as NexusPrisma from "nexus-prisma" // `as` is required because prisma and nexus-prisma have some exports with equal names
The trick is to use the nohoist
config in the root package.json
of the monorepo:
"workspaces": {
"packages": [
"packages/*"
],
"nohoist": [
"**/@prisma/client",
"**/prisma",
"**/nexus-prisma"
]
},
In this way, prisma
and nexus-prisma
are not hoisted and they are kept separated in each of the packages created above.
In the other packages that need to access the prisma client or the code generated by nexus-prisma
, I do not import them directly from @prisma/client
or nexus-prisma
, but I import them from the packages created above.
from nexus-prisma.
🎉 This issue has been resolved in version 1.0.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from nexus-prisma.
Related Issues (20)
- Mutation input list type error
- Error: NEXUS__UNKNOWN__TYPE was already defined and imported as a type, check the docs for extending types HOT 6
- Create a test using pnpm with deployment to vercel HOT 1
- Docs website is down HOT 2
- support for prisma ^4.0.0 HOT 12
- `nexus-prisma` is handed over to the community for more active maintenance & future development 🚀 HOT 8
- Renovate doesn't have visibility for dependencies hardcoded directly HOT 1
- Dependency Dashboard
- Roadmap 2023-Q3 HOT 8
- Scheduled cut of new releases HOT 1
- Missing check for documentation build HOT 1
- Get type error when using `scalar` in `asNexusMethod` after update to `1.0.3` HOT 2
- nexus-prisma command not found
- Test failing in vitest HOT 1
- Cannot find module @prisma/client in Vercel deployment HOT 8
- e2e tests are failing randomly on dependencies installation part HOT 1
- Cannot Import ES Module HOT 3
- Invalid prisma version used in tests
- Read Operations (Query and Input Generation)
- Error: Cannot find module ... @prisma/client/generator-build in @prisma/client 5.9.0+ HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nexus-prisma.