-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Having multiple locations for basePath #61
Comments
I looked through the source code a little bit. I think it should be fairly simple to add this. I'm looking at PrismaSchema.ts > toString. Existing code: if (this.basePath) {
await importAllFiles(this.basePath, "enums");
await importAllFiles(this.basePath, "models");
await importAllFiles(this.basePath, "mixins");
} Possible update: constructor(
// constructor stuff
private readonly additionalPaths?: string[]
) {}
// other functions and stuff
public toString(): Promise<string> {
return new Promise(async (resolve) => {
const allPaths = [this.basePath, ...this.additionalPaths];
allPaths.forEach((path) => {
await importAllFiles(path, "enums");
await importAllFiles(path, "models");
await importAllFiles(path, "mixins");
}
// rest of function I can put up a PR for this if you want. |
I think the |
I haven’t actually tried. I’ll try to get one up today. |
* adds support for using a new flag `additionalPaths` in `createSchema` * adds new example for splitting the schema code across directories * adds new test / snapshot
@ridafkih I have created a PR for this issue when you have a chance to look at it. Let me know what you think. |
* updated schema to use additionalPath as it's own path, not as a path relative to basePath * updated the example readme / index * noticed the second additionalPath in the example is missing somehow so I removed that * updated the test
* adds support for using a new flag `additionalPaths` in `createSchema` * adds new example for splitting the schema code across directories * adds new test / snapshot
* updated schema to use additionalPath as it's own path, not as a path relative to basePath * updated the example readme / index * noticed the second additionalPath in the example is missing somehow so I removed that * updated the test
Closing, #66 has been released in v1.12.0. Thanks for the suggestion and implementation! |
Hey, building a fullstack application that uses schemix and I wanted to see if there was a way to allow multiple directory locations for src files. I want to make my app extensible and provide clear locations for those extensions to live so anyone who may decide to contribute doesn't have to deal with adding code in my base models.
Maybe something like :
or possibly:
Let me know if you need/want any additional information or if this is just plain too hard to do. Thanks!
The text was updated successfully, but these errors were encountered: