Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Update dependencies to their latest #373

Merged
merged 20 commits into from
Nov 28, 2018
Merged

Conversation

valentijnnieman
Copy link
Contributor

@valentijnnieman valentijnnieman commented Nov 8, 2018

This PR updates most of the packages to their latest version.

This also removes some unused packages, like builder and old babel packages that are no longer needed.

Note that the move from react-dates 12.3 to 18.2 is a slightly bigger one - not only does it change the way styling is handled, but it also just looks different in general. I've updated the way we style our DatePicker components with some simple overwrites, but it still will look a little bit different. I don't think that's a bad thing though, necessarily. Check out the Percy diffs to see the changes in the DatePickers.

@rmarren1
Copy link
Contributor

rmarren1 commented Nov 9, 2018

Would this require moving dash-renderer from react 15 react 16?

@rmarren1
Copy link
Contributor

rmarren1 commented Nov 9, 2018

Those percy diffs look okay to me. Looks like a few components grew a pixel or two

@valentijnnieman
Copy link
Contributor Author

valentijnnieman commented Nov 9, 2018

@rmarren1 Yeah exactly, the biggest difference is the DatePicker stuff, and indeed some of the Percy screenshots look off by a pixel or two (I noticed in the last snapshot the Dropdown component's text's vertical centering was a bit off). I don't think it requires upgrading dash-renderer's React, since there aren't really any breaking changes. Taken from the React docs, if your app runs in 15.6 without any warnings, it should work in 16.

edit:
And dash-renderer supplies the version of React for Dash apps, which is 15.6

@valentijnnieman valentijnnieman changed the title [WIP] Update to React 16.6.1 Update to React 16.6.1 Nov 9, 2018
@@ -1,3 +1,4 @@
import 'react-dates/initialize';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the new (or old, in any case the documented) way of using react-dates, as is on the github page

@bpostlethwaite
Copy link
Member

We should either support package.lock and npm or yarn and yarn.lock. I think moving to yarn should happen as a separate project.

Can you remove yarn.lock and all references and commits to yarn and yarn.lock?

Copy link
Contributor

@wbrgss wbrgss left a comment

Choose a reason for hiding this comment

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

Please see comments 🙂

@@ -51,61 +51,61 @@ describe('Props can be set properly', () => {

test('props.id is set as the <input> id', () => {
// test if id is in the actual HTML string
const inputTag = input.render().children();
const inputTag = input.render();
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the difference between render() and render().children() ? Does the change to the latter have to do with the React 16 upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has to do with the Enzyme upgrade.

@@ -118,15 +118,15 @@ describe('Input with (default) type=text', () => {
input = mount(<Input value="initial value" />);
});
test('Input updates value', () => {
expect(input.find('input').getNode().value).toEqual(
expect(input.find('input').instance().value).toEqual(
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar question here, what is the difference between getNode() and instance()? An API change in enzyme?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly. Enzyme got updated, and a bunch of the methods I used before didn't work anymore after upgrading.

}
*, *:before, *:after {
box-sizing: inherit;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good idea in principle but it's a bit dangerous to set the wildcard selector. Other components might be expecting the default content-box; we should double check if the layout looks different. I'd prefer if the above lines (6-11) were more explicitly in a "global" or "base" CSS file with the above comment explaining the rationale.

Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand, there's minimal changes in the Percy diffs, so that's promising.

'height': '60px',
'lineHeight': '60px',
'borderWidatetimeh': '1px',
'borderWidth': '1px',
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@valentijnnieman valentijnnieman changed the base branch from master to 1.0-release November 12, 2018 17:07
@valentijnnieman valentijnnieman changed the base branch from 1.0-release to master November 12, 2018 17:13

// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",

// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],
setupFiles: ['<rootDir>/test/setupTests.js'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Jest and Enzyme updates now require us to specify a React adapter to use - so we create this setupTests.js setup file to run before our tests.

// "<rootDir>"
// ],
roots: [
"<rootDir>/test/unit"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't want to look in other folders for JS tests - specifically the new setupTests.js file shouldn't be run as a unit test with Jest.

* ideally, we would use cloneElement however
* that doesn't work with dash's recursive
* renderTree implementation for some reason
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for this noise - it seems Prettier still picks up some formatting issues here and there from time to time. I think the formatting tests in Cirlce are maybe not 100% right, as it seems to miss these formatting issues.

@@ -1,4 +1,4 @@
import {arduinoLight, monokai} from 'react-syntax-highlighter/dist/styles';
import {arduinoLight, monokai} from 'react-syntax-highlighter/dist/styles/hljs';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New syntax for updated react-syntax-highlighter

@valentijnnieman
Copy link
Contributor Author

@chriddyp We could still merge this branch, since almost all of the packages used are updated. If dash-renderer provides React, and if the dcc bundles build with these updated packages/dependencies work without failing, then surely that won't break anything? I've also checked the updated packages's dependencies, and none specify that they don't work below React 16. If you're good with it, I can take out the references to version 1.0.0 and we can merge this, closing all of the open greenkeeper ones (which was the goal of this PR when I started with it anyway)

@wbrgss wbrgss modified the milestone: Add base set of core components Nov 22, 2018
@valentijnnieman valentijnnieman changed the title Update to React 16.6.1 Update dependencies to their latest Nov 28, 2018
@valentijnnieman
Copy link
Contributor Author

@Marc-Andre-Rivet Reverted the changes to the client-facing react packages such as react-dates, only internal tooling updates now. Again apologies for the messy PR / commit history!

@valentijnnieman
Copy link
Contributor Author

@Marc-Andre-Rivet Also removed react-select because it wasn't used - we're using react-virtualized-select and the dependency to react-select doesn't really do anything.

Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet left a comment

Choose a reason for hiding this comment

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

With the removal of the customer facing package updates (react-dates, markdown, highlighter, etc.) I see this essentially as a toolchain update. I understand that we are still running the integration/e2e tests against react 15.4.2 / the dash-renderer version, so the bump to react 16.6.1 only impacts the enzyme tests.

This feels very similar to the current situation in the dash-table where the table is technically coded against 16.6.x, has 0.14 peer deps, is tested against 15.4.2 and only tested against 16.6.x with @storybook/react. The slight difference is that here the unit tests are run against 16 instead of 15 but integration/e2e tests should be able to catch a breaking change/usage.

lgtm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants