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

refactor(client): separate into modules #1948

Merged
merged 1 commit into from
Jun 1, 2019

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented Jun 1, 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?

yep

Motivation / Use-Case

This is the first step to refactor client code.

Breaking Changes

no

Additional Info

@codecov
Copy link

codecov bot commented Jun 1, 2019

Codecov Report

Merging #1948 into master will increase coverage by 0.26%.
The diff coverage is 97.43%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1948      +/-   ##
=========================================
+ Coverage   91.54%   91.8%   +0.26%     
=========================================
  Files          19      22       +3     
  Lines         840     879      +39     
  Branches      263     276      +13     
=========================================
+ Hits          769     807      +38     
- Misses         68      69       +1     
  Partials        3       3
Impacted Files Coverage Δ
client-src/default/utils/reloadApp.js 100% <100%> (ø)
client-src/default/utils/getCurrentScriptSource.js 100% <100%> (ø)
client-src/default/utils/sendMessage.js 85.71% <85.71%> (ø)

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 fb31770...fbaec41. Read the comment docs.

@hiroppy hiroppy force-pushed the feature/refactor-client-default branch 2 times, most recently from 960df69 to 2a1166e Compare June 1, 2019 09:07
if (typeof window !== 'undefined') {
const qs = window.location.search.toLowerCase();
hotReload = qs.indexOf('hotreload=false') === -1;
options.hotReload = !qs.includes('hotreload=false');
Copy link
Member

Choose a reason for hiding this comment

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

Can't be used, includes is not supported old browsers, we can change this only in major release

Copy link
Member

Choose a reason for hiding this comment

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

You we need setup polyfill for this

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, I'll add babel-polyfill

Copy link
Member

Choose a reason for hiding this comment

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

@hiroppy let's do this in other PR, using babel-polyfill directly can break many apps, because only one babel-polyfill can be defined, we should using core-js directly

Copy link
Member

Choose a reason for hiding this comment

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

@hiroppy let's leave this as is in this PR and change this in other PR (where we include polyfills)

throw new Error('[WDS] Failed to get current script source.');
}
const sendMessage = require('./utils/sendMessage');
const reloadApp = require('./utils/reloadApp');

This comment was marked as resolved.

@@ -0,0 +1,49 @@
'use strict';
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 rename test directory to client not client-src. src postfix used because we build bundle


// check ipv4 and ipv6 `all hostname`
if (hostname === '0.0.0.0' || hostname === '::') {
// why do we need this check?
// hostname n/a for file protocol (example, when using electron, ionic)
// see: https://github.com/webpack/webpack-dev-server/pull/384
// eslint-disable-next-line no-bitwise
if (self.location.hostname && !!~self.location.protocol.indexOf('http')) {
if (self.location.hostname && self.location.protocol.includes('http')) {
Copy link
Member

Choose a reason for hiding this comment

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

Also don't use includes

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 leave as is in this PR as i said above

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.

Looks good, some notes

@hiroppy hiroppy mentioned this pull request Jun 1, 2019
6 tasks
@hiroppy hiroppy force-pushed the feature/refactor-client-default branch from 2a1166e to ee3bd45 Compare June 1, 2019 14:50
@hiroppy
Copy link
Member Author

hiroppy commented Jun 1, 2019

/cc @evilebottnawi PTAL

alexander-akait
alexander-akait previously approved these changes Jun 1, 2019
@hiroppy
Copy link
Member Author

hiroppy commented Jun 1, 2019

updated snapshots

@codecov
Copy link

codecov bot commented Jun 1, 2019

Codecov Report

Merging #1948 into master will increase coverage by 0.26%.
The diff coverage is 97.43%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1948      +/-   ##
=========================================
+ Coverage   91.54%   91.8%   +0.26%     
=========================================
  Files          19      22       +3     
  Lines         840     879      +39     
  Branches      263     276      +13     
=========================================
+ Hits          769     807      +38     
- Misses         68      69       +1     
  Partials        3       3
Impacted Files Coverage Δ
client-src/default/utils/reloadApp.js 100% <100%> (ø)
client-src/default/utils/getCurrentScriptSource.js 100% <100%> (ø)
client-src/default/utils/sendMessage.js 85.71% <85.71%> (ø)

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 fb31770...fbaec41. Read the comment docs.

@alexander-akait alexander-akait merged commit ffb2c79 into master Jun 1, 2019
@alexander-akait alexander-akait deleted the feature/refactor-client-default branch June 1, 2019 15:16
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

2 participants