-
Notifications
You must be signed in to change notification settings - Fork 65
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
feat: require all files that import nexus #833
Conversation
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.
Let's make sure to do a pass on the schema guide (if needed) and the "project layout" docs section. Also maybe the @nexus/schema migration guide. Other than that, I don't think any other sections need revising. 🤔
@@ -89,36 +98,16 @@ export class Dev implements Command { | |||
} | |||
|
|||
runDebouncedReflection(layout) | |||
|
|||
return { | |||
entrypointScript: getTranspiledStartModule(layout, reflectionMode), |
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.
So now before every restart the hook allows altering what entrypoint source is? Cool
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.
Yeah. Makes me think it's dangerous to expose that on the plugin interface. Here, what this specifically enables is the ability to refresh the required schema modules in the start module whenever a file changes.
This used to not be required because we were looking for schema modules based on the filenames. So recomputing the layout whenever a file was added/deleted was enough.
But now that we find schema modules based on their import to Nexus, we need to recompute that on every file change. Here's a simple use-case where this is needed:
- You create a file (that file is still not considered a nexus module)
- You add
import { schema } from 'nexus'
- The start module needs to be updated to contain a
require
to that file - You comment out the
import
to nexus from that file - The start module needs to be updated to no longer contain a
require
to that file
See, nexus modules are no longer tied to file creation/deletion anymore, but entirely based on their content
a7f87a6
to
4d9ee53
Compare
closes #823
graphql.ts
andgraphql/
convention for schema modules. Instead, nexus parses all the files resolved by typescript (based on the tsconfig.json) and looks for imports tonexus
. If nexus is imported, that file will be both required in dev and in the final build production.Status: Waiting for discussion/approval before updating docs
TODO