-
Notifications
You must be signed in to change notification settings - Fork 24
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
Update dependencies and cleanup repo #30
Update dependencies and cleanup repo #30
Conversation
a8b8c17
to
0e7ea81
Compare
@@ -26,4 +25,18 @@ module.exports = { | |||
], | |||
}, | |||
devtool: 'source-map', | |||
optimization: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, the TerserPlugin in used by webpack 4 for optimization. This webpack configuration is pretty simple. Is there a reason we can't use the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just copy-pasted from terra-toolkit: https://github.com/cerner/terra-toolkit/blob/master/config/webpack/webpack.config.js#L125-L138
@@ -1,6 +1,5 @@ | |||
const path = require('path'); | |||
const webpack = require('webpack'); | |||
const pkg = require('./package.json'); | |||
const TerserPlugin = require('terser-webpack-plugin'); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With upgrading to webpack v4, we need to add the mode
key to this configuration https://webpack.js.org/concepts/mode/
@@ -26,4 +25,18 @@ module.exports = { | |||
], | |||
}, | |||
devtool: 'source-map', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not be using source-map for production mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nickpith @alex-bezek @mhemesath I believe the source maps are still wanted for prod?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes? don't you always want source maps in production mode because thats when its minified and everything and we wantt to be able to debug things?
https://webpack.js.org/configuration/devtool/#devtool
@@ -1,6 +1,4 @@ | |||
const path = require('path'); | |||
const webpack = require('webpack'); | |||
const pkg = require('./package.json'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets remove disableHostCheck: true,
from the devServer options. This is not recommended configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the only different between this config and the non-dev configuration should be the mode
, output.path
, devServer
and devTool
config. IMO we should combine these files.
"docs": "jsdoc --package package.json -d doc ./src/**/*.js", | ||
"lint": "eslint './src/**/*.js'", | ||
"prepublish": "yarn run build", | ||
"prebuild": "yarn run clean && yarn run lint && yarn run test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets keep the npm references and npm-package.lock file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have you changed / remove scripts that haven't been replaced? I might be missing them.
npm run dev | ||
|
||
```bash | ||
yarn install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets keep the npm references
@@ -1,4 +1,4 @@ | |||
Copyright 2017 Cerner Innovation, Inc. | |||
Copyright 2018 Cerner Innovation, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be 2017-2019
"env", | ||
{ | ||
"targets": { | ||
"browsers": [ "last 2 versions", "iOS >= 10", "ie >= 10" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure on this list, but this might need to align with the terra-supported browserlist. Likely an issue for another PR. https://github.com/cerner/browserslist-config-terra
"transform-runtime", | ||
"transform-object-rest-spread", | ||
"transform-class-properties" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we adding this plugin?
"babel-preset-env": "^1.7.0", | ||
"babel-preset-react": "^6.24.1", | ||
"chai": "^4.2.0", | ||
"eslint": "^5.9.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if we aligned with our sharable eslint configuration: https://github.com/cerner/eslint-config-terra/blob/master/package.json
@@ -10,42 +10,52 @@ | |||
"src" | |||
], | |||
"scripts": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add the following since you've opened up the node version
"engines": {
"node": ">=8.9.2"
},
"babel-loader": "^6.2.4", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "10.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this locked down?
return Promise.resolve(); | ||
}, | ||
|
||
authorized(detail = {}) { | ||
self.wrapper.setAttribute('data-status', 'authorized'); | ||
self.emit('xfc.authorized', detail); | ||
self.emit(events.authorized, detail); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why you've changed this? How have you tested this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just essentially an enum
"babel-cli": "^6.7.5", | ||
"babel-core": "^6.7.7", | ||
"babel-loader": "^6.2.4", | ||
"babel-cli": "^6.26.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we're upgrading dependencies.. should just update to babel 7
Is this PR still active? I'd like to see xfc upgraded to babel 7, namely the babel-runtime dependency. Which will probably require a major version bump. |
It seems this is very old. It also has lots of changes all grouped together. IMO if you want, update just the babel stuff without all the lint fixes and do a couple of small changes. I'll leave it up to @dev-cprice to say if he is done with this or not, but I would err on making a new PR with just the babel updates and he can always merge those changes into his branch |
Closing this since it's wayyyy old and I don't know if I'll ever have time to get around to it anytime soon. |
Summary
Fixes #29
.nvmrc
lts/carbon (lts node v8.x)Additional Info
Comparison of output: Webpack v2 vs Webpack v4 + Terser
cc: @cerner/xfc @nickpith @mjhenkes @ikottman