Skip to content
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

CPP-782 Add nodemon plugin #176

Merged
merged 2 commits into from
Mar 8, 2022
Merged

CPP-782 Add nodemon plugin #176

merged 2 commits into from
Mar 8, 2022

Conversation

ivomurrell
Copy link
Contributor

@ivomurrell ivomurrell commented Feb 25, 2022

This plugin provides a task that can be used in place of the Node plugin and will restart the running process if there are file changes in the directory or if the process exits unexpectedly. Will respect the configuration specified in a nodemon.json in $CWD, $HOME, or the location specified by the configPath option.

I figured there was big enough difference in code to justify splitting this out into a new module rather than just being an option you could toggle in a .toolkitrc.yml. Splitting the plugins also means that we do not force consumers to install the nodemon package when they just want to install the Node plugin.

@ivomurrell ivomurrell requested a review from a team as a code owner February 25, 2022 16:16
@ivomurrell ivomurrell changed the title Add nodemon plugin CPP-782 Add nodemon plugin Feb 25, 2022
Copy link
Member

@rowanmanning rowanmanning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very excited for this to release, thanks!

I haven't done an in-depth review but, while I was investigating how you got this working, I spotted a few potential issues/improvements. Please don't consider the nitpick to be blocking, as tbh it could come down to tool kit code style which I'm not familiar with.

plugins/nodemon/src/tasks/nodemon.ts Outdated Show resolved Hide resolved
})
const nodemonLogger = this.logger.child({ process: 'nodemon' })
nodemon.on('log', (msg) => {
function nodemonToWinstonLogLevel(level: string): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: I don't think this will have a particularly negative impact if it's not addressed, but this function is redefined each time nodemon logs. It's maybe a bit of a micro-optimisation to move it out of here though so happy if you want to ignore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a habit of embedding throwaway functions like this right next to the code that uses it so that you don't have to jump around too much when reading the code. It's the kind of thing that I'd hope V8 will optimise away at runtime though, especially when it's not even using any closure state! Maybe that's too optimistic haha I have no idea about the engine's internals

Copy link
Contributor

@serena97 serena97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks good to @leannecornish-ft and I, we have a couple of non blocking nitpicks but this is good to merge

core/sandbox/package.json Show resolved Hide resolved
plugins/nodemon/src/tasks/nodemon.ts Show resolved Hide resolved
This plugin provides a task that can be used in place of the Node plugin
and will restart the running process if there are file changes in the
directory or if the process exits unexpectedly. Will respect the
configuration specified in a nodemon.json in $CWD or $HOME.
Allow users to override the location of the nodemon config from its
default location in either the $PWD or $HOME directory.
@ivomurrell ivomurrell merged commit f138885 into main Mar 8, 2022
@ivomurrell ivomurrell deleted the nodemon-plugin branch March 8, 2022 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants