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: add watchFiles option #3136

Merged
merged 13 commits into from Apr 3, 2021
Merged

feat: add watchFiles option #3136

merged 13 commits into from Apr 3, 2021

Conversation

anshumanv
Copy link
Member

  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

wip on tests

Motivation / Use-Case

Add watchFiles option to listen to user-defined file changes

Breaking Changes

Nope

Additional Info

Fix #3121

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Also we need better test, look on test in test/server/liveReload-option.test.js

@codecov
Copy link

codecov bot commented Apr 1, 2021

Codecov Report

Merging #3136 (12f045f) into master (e3c2683) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3136      +/-   ##
==========================================
+ Coverage   94.94%   94.99%   +0.04%     
==========================================
  Files          37       37              
  Lines        1206     1218      +12     
  Branches      332      338       +6     
==========================================
+ Hits         1145     1157      +12     
  Misses         55       55              
  Partials        6        6              
Impacted Files Coverage Δ
lib/Server.js 94.16% <100.00%> (+0.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e3c2683...12f045f. Read the comment docs.

lib/Server.js Outdated Show resolved Hide resolved
Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Also we need CLI option --watch-files /foo/ (can be multiple)

@alexander-akait
Copy link
Member

I will finish this PR, need small improvements

@alexander-akait
Copy link
Member

/cc @anshumanv @snitin315 I make occasional mistakes sometimes, it would be nice to get more eyes

Copy link
Member Author

@anshumanv anshumanv left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

lib/options.json Outdated
"port": "should be {Number|String|Null} (https://webpack.js.org/configuration/dev-server/#devserverport)",
"proxy": "should be {Object|Array} (https://webpack.js.org/configuration/dev-server/#devserverproxy)",
"public": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserverpublic)",
"setupExitSignals": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserversetupexitsignals)",
"static": "should be {Boolean|String|Object|Array} (https://webpack.js.org/configuration/dev-server/#devserverstatic)",
"transportMode": "should be {String|Object} (https://webpack.js.org/configuration/dev-server/#devservertransportmode)"
"transportMode": "should be {String|Object} (https://webpack.js.org/configuration/dev-server/#devservertransportmode)",
"watchFiles": "should be {String|Array} (https://webpack.js.org/configuration/dev-server/#devserverwatchfiles)"
Copy link
Member Author

Choose a reason for hiding this comment

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

it can also be object

Copy link
Member

Choose a reason for hiding this comment

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

Just not, this is not work right now, we need move them to description property, also remove types, our default validator already print them in pretty way, just test

Should be easy task

@anshumanv
Copy link
Member Author

will add docs after release

bin/cli-flags.js Outdated
@@ -228,5 +228,16 @@ module.exports = {
multiple: true,
negative: true,
},
{
name: 'watch-files',
type: [String],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
type: [String],
type: String,

Copy link
Member

@snitin315 snitin315 left a comment

Choose a reason for hiding this comment

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

Lgtm

@alexander-akait alexander-akait merged commit d73213a into master Apr 3, 2021
@alexander-akait alexander-akait deleted the watch-files branch April 3, 2021 16:41
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.

onBeforeSetupMiddleware server isn't accessible
3 participants