Skip to content

refactor(server): clean up lib/server.js #1873

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

Merged
merged 3 commits into from
May 15, 2019

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented May 14, 2019

  • 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?

no

Motivation / Use-Case

Reduce lines in constructor, delete eslint comments, fix typo, and etc..

Breaking Changes

no

Additional Info

@hiroppy hiroppy requested a review from alexander-akait as a code owner May 14, 2019 20:25
@hiroppy hiroppy force-pushed the feature/refactor-server branch from a60aff3 to 794ee09 Compare May 14, 2019 20:28
@codecov
Copy link

codecov bot commented May 14, 2019

Codecov Report

Merging #1873 into master will increase coverage by 0.07%.
The diff coverage is 97.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1873      +/-   ##
==========================================
+ Coverage   87.85%   87.92%   +0.07%     
==========================================
  Files          14       14              
  Lines         782      787       +5     
  Branches      256      259       +3     
==========================================
+ Hits          687      692       +5     
  Misses         82       82              
  Partials       13       13
Impacted Files Coverage Δ
lib/Server.js 85.45% <97.29%> (+0.16%) ⬆️

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 c2360e4...e1fd450. Read the comment docs.

@hiroppy hiroppy force-pushed the feature/refactor-server branch 2 times, most recently from 9a44971 to 8f571bd Compare May 14, 2019 21:10
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.

It is breaking change 😞 we can't rename/change/delete properties and method, because it is public api and can be used other developers. We should keep backward compatibility

@alexander-akait
Copy link
Member

You can send a PR with fixing lint problems and typos, it is not breaking change

@hiroppy hiroppy force-pushed the feature/refactor-server branch from 8f571bd to dd0b66a Compare May 15, 2019 05:33
@hiroppy
Copy link
Member Author

hiroppy commented May 15, 2019

I gave up changing property names. I'll change these when we release as semver-major:)

@hiroppy hiroppy force-pushed the feature/refactor-server branch 2 times, most recently from fe4f67c to 781525c Compare May 15, 2019 05:47
lib/Server.js Outdated
for (const name in this.headers) {
res.setHeader(name, this.headers[name]);
}
if (this.options.headers) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's wait this too because developers can change this.headers in runtime and it is break logic

} else {
this.listeningApp = http.createServer(this.app);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I think we should rename this method on createServer, also we can refactor this on two methods:

  • setupHttps (logic for https)
  • createServer (logic for http.createServer)

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.

Two notes, anyway good work

@hiroppy hiroppy force-pushed the feature/refactor-server branch from 781525c to 7852e07 Compare May 15, 2019 14:15
lib/Server.js Outdated
}
}

this.createServer();
Copy link
Member

Choose a reason for hiding this comment

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

Let's move this after this.setupHttps(); (no in method)

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

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.

One note, and we can merge

@hiroppy hiroppy force-pushed the feature/refactor-server branch from 7852e07 to 84eb4d6 Compare May 15, 2019 14:29
@alexander-akait
Copy link
Member

Let's wait CI green and feel free to merge

@alexander-akait alexander-akait merged commit ab48526 into master May 15, 2019
@alexander-akait alexander-akait deleted the feature/refactor-server branch May 15, 2019 15:28
EslamHiko pushed a commit to EslamHiko/webpack-dev-server that referenced this pull request May 15, 2019
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.

3 participants