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: allow disabling manual restart for ts watchmode #2070

Conversation

m4tt72
Copy link
Contributor

@m4tt72 m4tt72 commented May 8, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

When running the REPL, the server interferes with the REPL especially when running REPL from within a docker container.

This is implemented in Nodemon: https://github.com/remy/nodemon/blob/main/faq.md#nodemon-doesnt-work-with-my-repl

Issue Number: N/A

What is the new behavior?

Allow manual restart to be disabled, this will prevent nest from listening to STDIN and allow REPL to take over.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@m4tt72
Copy link
Contributor Author

m4tt72 commented May 8, 2023

Here's a Codesandbox example: https://codesandbox.io/p/sandbox/great-paper-96fkjj

Notice when setting restartable to true, which is the default value, the REPL behaves in a weird way. Setting it to false disables the rs input and allows the REPL to capture user input

@m4tt72
Copy link
Contributor Author

m4tt72 commented May 15, 2023

@kamilmysliwiec any opinions for this issue? Also, I'm not sure if this is considered a new feature or a bugfix

@kamilmysliwiec
Copy link
Member

That's a great catch @m4tt72, thank you! Turns out this feature may have broken existing REPL setups which is definitely unexpected. Perhaps we should turn it off by default then? And let it control with a dedicated flag (as implemented in this repository)?

I'm also wondering if we should rename this attribute to be manualRestart instead of restartable (which is quite generic - that's my main concern)

@m4tt72
Copy link
Contributor Author

m4tt72 commented May 16, 2023

That's a great catch @m4tt72, thank you! Turns out this feature may have broken existing REPL setups which is definitely unexpected. Perhaps we should turn it off by default then? And let it control with a dedicated flag (as implemented in this repository)?

I'm also wondering if we should rename this attribute to be manualRestart instead of restartable (which is quite generic - that's my main concern)

Thank you @kamilmysliwiec for the reply.

Of course, I don't mind changing the variable name, I was following how nodemon did it, I will push a commit to set it to false 🚀

@kamilmysliwiec
Copy link
Member

Excellent! Could you also create a PR to the docs (preferably this section https://docs.nestjs.com/cli/monorepo#global-compiler-options ?) adding the new configuration attribute?

@m4tt72
Copy link
Contributor Author

m4tt72 commented May 17, 2023

@kamilmysliwiec done, documentation for this option is ready nestjs/docs.nestjs.com#2730

@kamilmysliwiec kamilmysliwiec merged commit 1bedd79 into nestjs:master May 17, 2023
1 check passed
@kamilmysliwiec
Copy link
Member

LGTM

@m4tt72 m4tt72 deleted the feat/allow-disable-manual-restart-watchmode branch May 17, 2023 12:07
@micalevisk
Copy link
Member

@m4tt72 could you please update the nest-cli.json schema definition at https://github.com/SchemaStore/schemastore as well? an example of such change: SchemaStore/schemastore#2561

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.

None yet

3 participants