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

feat(run): add allowRestarts option #820

Merged
merged 3 commits into from
Apr 22, 2021
Merged

feat(run): add allowRestarts option #820

merged 3 commits into from
Apr 22, 2021

Conversation

nicholas-ochoa
Copy link
Contributor

Rollup Plugin Name: run

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:
#769

Description

This PR adds functionality to enable optional manual restarts of the running bundle by entering rs, restart or pressing Ctrl+K on the terminal followed by Enter. This mimics the behavior of nodemon. Additionally, the terminal screen can be cleared by entering cls, clear or pressing Ctrl+L followed by Enter.

The use case for this functionality is developing applications that reference external configuration files, resources or databases that may change while the application source remains unchanged. When these are updated often times the application will need to be restarted. In my case, this is currently accomplished by terminating the current instance using Ctrl+C and then restarting it by running pnpm run dev.

I've tested this on Windows (under cmd.exe as well as under Bash using Windows Terminal) and Linux (bash, over SSH using Putty, as well as using ssh under Windows Terminal) and it works as expected.

I did add a single test case but I admit it is pretty simplistic and could use improvement. I was unable to get sinon to properly mock the process.stdin.resume function call to determine whether or not it was called.

…arts by entering sequences on the terminal
packages/run/README.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@shellscape shellscape left a comment

Choose a reason for hiding this comment

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

thanks!

@nicholas-ochoa
Copy link
Contributor Author

@shellscape is this waiting for anything on my end before it can be merged? Just double checking to make sure I didn't miss anything, thanks!

@shellscape
Copy link
Collaborator

We generally like to get more than one review before merging. Just waiting for some others to have the time to check.

@shellscape shellscape merged commit f963269 into rollup:master Apr 22, 2021
@shellscape
Copy link
Collaborator

thanks!

guybedford pushed a commit that referenced this pull request Apr 30, 2021
* feat(run): add `allowRestarts` option that enables manual bundle restarts by entering sequences on the terminal

* minor: change `forkBundle` function to an arrow function

* minor: clarify `stdin` behavior in `README.md` when `allowRestarts` is `true`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants