Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Modernize cf-ui #93

Merged
merged 89 commits into from
Mar 14, 2017
Merged

Modernize cf-ui #93

merged 89 commits into from
Mar 14, 2017

Conversation

tajo
Copy link
Contributor

@tajo tajo commented Mar 14, 2017

Changes

  • Gulp is gone. Webpack rules everything now. Migrate to Webpack #23
  • The style-guide is now an app that's using webpack so you can use npm start and enjoy hot module replacement. You can build /docs through npm run build:styleguide.
  • The style-guide is server-side rendered (including Fela styles). There was a problem with cf-component-tooltip so it's not visible in the style guide for now.
  • CommonJS modules replaced by ES6 modules.
  • New build targets: ES6, UMD and UMD minified. Webpack2 can now use ES6 modules to do tree-shaking. CommonJS build is now done via Webpack as well.
  • Karma, Mocha, Chai, Browserify... all gone. All tests are using Jest. In rare cases where the DOM is needed, we use JSDom now. Jest for testing #73
    • I had some weird problems with cf-util-http and cf-util-http-poll tests. They are skipped now. @jwineman promised to fix them :-). It's related to Upgrade superagent #67.
  • All READMEs udpated.

I didn't change functionality of any component. Everything's related only to the build process, style guide and testing.

There are probably some small errors in the style guide. Let's fix them later!

tajo added 30 commits March 5, 2017 23:08
…-container external, so the umd builds are not bloated with 3rd party deps
…ComponentTheme is used without global BaseTheme
@terinjokes
Copy link

😰

@@ -1,58 +0,0 @@
# No Customizing `className`'s
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we deleting this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess because we use Fela, it will generate className automatically

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it's still true but we need to expose classNames so Fela can inject styles into the components. Eventually, I'm going to write some new pieces explaining the whole Fela thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the whole no className thing still applies. Customizing the classes through Fela is not the same as customizing it directly. Its probably worth explaining.

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 definitely does, I just don't want to confuse people with "no classNames" article and then exposing classNames everywhere without explaining Fela bits.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree the current article is confusing given our current implementation. We don't have to do it in this PR but we should talk about separation of concerns at some point. The idea here is that the component is responsible for functionality and Fela is responsible for style, and modifying className without Fela violates that.

@@ -1,53 +0,0 @@
# No ES6 Modules
Copy link
Contributor

Choose a reason for hiding this comment

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

I might update this rather than deleting it, explaining why we chose webpack2 etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea. I'll write something but later.

"presets": ["es2015", "react"],
"plugins": ["transform-object-rest-spread"]
"presets": [
["es2015", { "modules": false }],
Copy link
Contributor

Choose a reason for hiding this comment

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

obviously, it is out of the scope of this PR, is it agreed not to use ES modules in this repo?

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 PR changes everything to ES6 modules. Now, there's webpack2 that can handle them so there is no need for babel transformation which was main reason why not to use them before.

build.sh Outdated
@@ -0,0 +1,10 @@
#!/bin/sh
Copy link
Contributor

Choose a reason for hiding this comment

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

please move into scripts folder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

$ git tag -a "[[version]]"
$ npm publish
$ git push origin master --follow-tags
npm run publish
Copy link
Contributor

Choose a reason for hiding this comment

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

if someone wants to publish single/multiple packages is the 'npm run publish' will be used in both cases?

Copy link
Contributor Author

@tajo tajo Mar 14, 2017

Choose a reason for hiding this comment

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

yes, lerna has a nice interface to select what and how to publish

@@ -21,7 +21,7 @@ functions that take state and render UI.
A unit test for state => ui looks something like this:

```js
it('should render the list of items', function() {
test('should render the list of items', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

could update using () => {} syntax

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

"babel-generator": "^6.18.0",
"babel-loader": "^6.3.2",
"babel-jest": "^19.0.0",
"babel-loader": "7.0.0-alpha.3",
Copy link
Contributor

Choose a reason for hiding this comment

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

are you sure it is a good idea using alpha version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, because of this babel/babel-loader#391

const React = require('react');
const { render } = require('react-dom');
const { PaginationBuilder } = require('../../src/index');
import React from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

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

we change from common.js to es6 modules syntax. Is it not enough to bump package version of all components?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you mean by this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Changing the module syntax for our imports doesn't represent a SEMVER incompatible API change, as far as I'm aware.

Copy link
Contributor Author

@tajo tajo Mar 14, 2017

Choose a reason for hiding this comment

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

The actual /lib output should be identical. The main index.js is still commonjs module. But now we add /es target where ES6 modules are preserved and webpack2 or rollup can leverage that. Also /dist target for UMD builds - I'm going to put them on cdnjs.com.

@tajo tajo merged commit b8ad457 into cloudflare:master Mar 14, 2017
This was referenced Mar 14, 2017
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.

None yet

6 participants