-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
refactor(gatsby): Change develop command to use startWebpackServer service #24946
Conversation
(I've put it to draft mode since that's what it is) |
@pvdz No, it's ready for review. It's just dependent on the other PR |
@ascorbic what's up with the added commits? 🤔 |
@pvdz Merging master, via the base branch. It initally showed all of those commits before it realised the base branch had been updated too |
Co-authored-by: Peter van der Zee <209817+pvdz@users.noreply.github.com>
… into chore/bootstrap-refactor
): Promise<{ gatsbyNodeGraphQLFunction: Runner }> { | ||
): Promise<{ | ||
gatsbyNodeGraphQLFunction: Runner | ||
workerPool: JestWorker |
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.
Are we just picking workerPool
from context here or the workerPool
is created someone in here?
If we are not creating it, it feels weird to return it from bootstrap
and not just grab it from context
if needed?
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.
We're getting it at line 35, where we spread in the results of initialize.
@ascorbic is it possible to add some comments to say what actually changed, it feels like it's lot of moving pieces around and I want to make sure the changed bits are thoroughly reviewed. Also should we put some tests in place or should we just really on e2e tests? |
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.
I spot checked it and am assuming the new files etc are just moving code, not making actual changes.
It looks okay. I have two small issues.
The new files should be virtually identical code. It's annoying that there's no easy way to track that. I'm not sure the best way of testing it, because it's mostly about spinning up webpack |
import { printDeprecationWarnings } from "../utils/print-deprecation-warnings" | ||
import { printInstructions } from "../utils/print-instructions" | ||
import { prepareUrls } from "../utils/prepare-urls" | ||
import { startServer } from "../utils/start-server" |
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.
bikesheddy: given how all those utils are only used by this service, could we group them in some directory and not just add 4 more files to utils
?
so maybe:
- services/
- start-webpack-server/
- index.ts (this file)
- print-deprecation-warnings (utils - repeat for other util)
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.
I like the cut of your jib
workerPool: JestWorker | ||
} | ||
|
||
export async function startServer( |
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.
Here I've changed the signature to accept the app and workerPool from outside, rather than creating them here
This PR extracts the nitty-gritty of the starting of the webpack dev server and CLI bootstrapping from the
develop-process
command into astartWebpackServer
service. In the state machine branch this is spawned during bootstrap. It also extracts some of the functions used by that into seperate utils files.