-
Notifications
You must be signed in to change notification settings - Fork 443
Docs build improvements #683
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
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.
Thanks for updating the links! Nice catch!
I am not seeing the watch command work. I haven't been able to track it down, but every now and then the first change I make will show up, but none after that. I make the change in the .md
file, watch the output from the rebuild in the terminal, reload the page, and the change is still there. Any ideas?
I fixed a bug in the |
Also, note, edits to the base README.md do not get added to the docs. I don't know a good way around this at present since when we copy the README to |
At the end of the day, this is a somewhat sub-optimal solution. Ideally, gatsby would just rebuild every time we update the spec without needing to do a complete restart of the dev server. Since we're dependent on the openrpc generator for building the api spec and I haven't been able to figure out how to configure gatsby to rebuild those spec files using its hot module reload feature, we're stuck with restarting the server and then having the user refresh the page. |
Totally agree the current setup works, but it does feel a bit clunky, especially with the repeated restarts and the need to manually copy files around. One small improvement that might make things smoother for contributors (even if it doesn’t fully solve the hot reload issue) is to combine those separate steps into a single npm run dev script. That way, devs can just run one command and get everything going:
I know it’s not a fix for the HMR issue, but at least it streamlines the workflow and hides some of the friction for contributors. |
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.
Is it possible to prevent nodemon from watching the destination file, more like telling nodemon to ignore the destination
"scripts": {
"watch": "nodemon --watch src --watch docs --watch README.md --ignore docs/reference/quickstart.md --ext yaml,md,json --exec \"npm run build && cp ./openrpc.json build/docs/gatsby/src/openrpc.json && npm run serve\""
}
just for us to avoid the loop or another option would be to only copy README.md
if it changed, we can use a small shell check
cmp -s README.md docs/reference/quickstart.md || cp README.md docs/reference/quickstart.md
the script might look like this
"scripts": {
"dev": "npm run build && npm run build:test && cmp -s README.md docs/reference/quickstart.md || cp README.md docs/reference/quickstart.md && cp ./openrpc.json build/docs/gatsby/src/openrpc.json && npm run watch"
}
Thanks for this suggestion. I wasn't aware of the |
package.json
Outdated
@@ -6,14 +6,17 @@ | |||
"scripts": { | |||
"build": "npm run build:spec", |
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.
nit. I think I would probably make build, build everything v just spe , and have the specific build for running specific stages as you have here. The rationale being if you're new to the repo, you'd git clone, npm run build . This would make it so you could then run test or launch docs right after, as you level up you'll probably run build:spec or whatever specific thing you're looking to run.
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.
Good point. I've updated the build script to do everything..
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.
Overall I think these changes look good
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.
@acolytec3 you might need to also change the deploy.yaml to not run build with this change but run build:specs
https://github.com/ethereum/execution-apis/blob/main/.github/workflows/test-deploy.yaml#L32
and
https://github.com/ethereum/execution-apis/blob/main/.github/workflows/deploy.yaml#L28
Unfortunately you can't say just run build in ci unless you introduce the golang image into the CI for deploying the ghpages.
I think CI in general could maybe use a rethink or reworking, but that would be out of the scope of this PR. so my suggestion is to convert npm run build to npm run build:specs
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.
This LGTM once the comments about CI from @zcstarr are addressed!
Thanks! Should be ready to merge. |
Can this get merged? |
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.
LGTM - thanks @acolytec3 🫡
This continues work from #667 cleaning up the docs.
dependencies
anddevDependencies
that no longer makes sense since this isn't a package being published anywherewatch
script for the docs that reloads the local dev server when changes are made to the spec or docs