-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add api generator watch mode #3447
base: next
Are you sure you want to change the base?
Conversation
1f16988
to
c5c1c0f
Compare
childProcesses[path].kill(); | ||
} | ||
delete childProcesses[path]; | ||
} |
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'm not sure if it would be more safe to await the kill to be finished. Not that two processes (or even more if many change events come in for the same file) write the same files.
In practice - due to the slowness of the generator - it might be never a problem.
}); | ||
|
||
child.on("close", (code) => { | ||
if (errorOutput.length > 0) { |
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 would use the exit code as source for sucess/failure
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.
yes true, changed this.
3887bbf
to
b8ce4d6
Compare
b8ce4d6
to
810368c
Compare
4cddd17
to
8e99627
Compare
return false; | ||
}, | ||
}) | ||
.on("change", async (path) => { |
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.
How does chokidar handle consecutive writes to the same file? Would it be possible to wait until the child process has finished? The we wouldn't need to kill "old" child processes.
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.
what problem do you see with killing?
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.
Probably that it may be as unreliable as the "old" way we restarted the Vite dev server, resulting in tangling Node processes. And doing lot's of useless work 🤷🏼♂️
But if we can reliably kill child process than there's no real problem.
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.
killing processes works perfectly fine, when done correctly.
What can cause problems are multiple child processes (a tree), that can happen for example with npm run xxx
that itself starts another child process. If you kill the npm run
process, it's child process doesn't receive a kill signal. (This is different from Ctrl+C on the cli, which gets sent to all child processes). (I had those issues in dev-process-manager)
When you have a single child process (should be the case here, though it should be tested explicitly) this won't be an issue.
8e99627
to
68e77fd
Compare
depends on: #3446
Description
adds
--watch
option tocomet api-generator --watch
which watches for changes onentity.ts
files. If changes occur - the necessary generated files for the entity get regenerated.adds
--file
option tocomet api-generator -f src/products/entities/product.entity.ts
Screenshots/screencasts
Screen.Recording.2025-02-14.at.13.17.03.mov
Further information