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

Update dependencies and cleanup repo #30

Closed

Conversation

cody-dot-js
Copy link

@cody-dot-js cody-dot-js commented Dec 1, 2018

Summary

Fixes #29

  • Update dependencies
    • Update babelrc
    • Update eslint config and ignore
    • Use .nvmrc lts/carbon (lts node v8.x)
  • Use yarn
  • Cleanup README
  • Fix broken tests from dependency bumps
  • Lint/cleanup code

Additional Info

Comparison of output: Webpack v2 vs Webpack v4 + Terser

screen shot 2018-12-07 at 5 33 58 pm

cc: @cerner/xfc @nickpith @mjhenkes @ikottman

@cody-dot-js cody-dot-js force-pushed the cleanup-repo-bump-deps branch from a8b8c17 to 0e7ea81 Compare December 7, 2018 22:58
@@ -26,4 +25,18 @@ module.exports = {
],
},
devtool: 'source-map',
optimization: {

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?

Copy link
Author

Choose a reason for hiding this comment

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

@@ -1,6 +1,5 @@
const path = require('path');
const webpack = require('webpack');
const pkg = require('./package.json');
const TerserPlugin = require('terser-webpack-plugin');

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',

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.

Copy link
Author

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?

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
image

image
It does have yes for production.
It does say this FYI
image

@@ -1,6 +1,4 @@
const path = require('path');
const webpack = require('webpack');
const pkg = require('./package.json');

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

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",

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

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

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.

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" ]

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"

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",

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": {

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",

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);

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?

Copy link
Author

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",
Copy link
Contributor

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

@mjhenkes
Copy link

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.

@alex-bezek
Copy link

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

@cody-dot-js
Copy link
Author

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.

@cody-dot-js cody-dot-js deleted the cleanup-repo-bump-deps branch April 22, 2020 14:59
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.

Update Dependencies
5 participants