-
Notifications
You must be signed in to change notification settings - Fork 367
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: netlify dev --graph
: watch config.toml and reload automatically
#4268
Conversation
📊 Benchmark resultsComparing with fa3980d Package size: 442 MB(no change)
Legend
|
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 @anmonteiro, added a comment.
I think it would be better to introduce this functionality only when the graph
flag is passed to reduce the risk of this breaking other commands.
const watchDebounced = async (target, { depth, onAdd = () => {}, onChange = () => {}, onUnlink = () => {} }) => { | ||
const watcher = chokidar.watch(target, { depth, ignored: /node_modules/, ignoreInitial: true }) | ||
|
||
await pEvent(watcher, 'ready') |
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.
chokidar
can emit error
events.
Not a blocker for this PR, but we might consider handling those.
src/commands/base-command.js
Outdated
watchDebounced(configPath, { | ||
depth: 1, | ||
onChange: async () => { | ||
const { config: newConfig } = await actionCommand.getConfig({ cwd, state, token, ...apiUrlOpts }) |
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.
Adding/removing/changing a netlify.toml
might also modify the buildDir
and the configPath
returned by actionCommand.getConfig()
.
In a follow-up PR, we should consider handling this.
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 is very well spotted, and it also looks a little harder than a quickfix. I'm going to open an issue to track it.
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 looks good to me, with some notes for follow-up PRs.
Also, some tests are failing, but I'm unsure whether this is related to this PR or not.
🎉 Thanks for submitting a pull request! 🎉
Summary
Fixes https://github.com/netlify/netlify-graph-project-planning/issues/16
For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)