Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Version 2 #53

Merged
merged 21 commits into from
May 4, 2017
Merged

Version 2 #53

merged 21 commits into from
May 4, 2017

Conversation

crisu83
Copy link
Contributor

@crisu83 crisu83 commented Apr 22, 2017

Bootstrap project with Create React App instead of using custom configuration.

Todo before this can be merged

  • Add and configure Stylelint @crisu83
  • Ensure that HMR is working correctly @AriaMinaei
  • Ensure that Flow is properly configured @AriaMinaei
  • Rewrite tests with Jest (try codemods) @crisu83
  • Upgrade to React Router v4 @crisu83
  • Add Reselect (and rewrite selectors) @crisu83
  • Go through dependencies
  • Update documentation

Things you might be wondering about

  • Why no es2015 or stage-1 Babel presets? Adding these presets has severe performance implications, so we wanted to leave it up to the project to decide which presets it actually needs. See also Consider leaving out babel-preset-es2015 in development. facebook/create-react-app#435
  • Why Jest? Facebook is using Jest for testing all of their JavaScript and they have made huge improvements to it during the past year. The DE (Developer Experience) is also superior to any other testing framework).
  • Why Reselect? We have noticed that we need a unified way to select data from the state to ease the work of the developer. Reselect has detailed documentation and it may also increase the performance of the application with memorized selectors.

@hugovk
Copy link
Contributor

hugovk commented Apr 23, 2017

CI is failing:

$ flow 
sh: 1: flow: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "flow" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@crisu83
Copy link
Contributor Author

crisu83 commented Apr 23, 2017

I fixed the build, but I still need to go over all the changes and verify that everything is OK.

@crisu83
Copy link
Contributor Author

crisu83 commented Apr 23, 2017

@AriaMinaei @ericnishio @Kotpes @villeristi could you also please go through the changes and approve them? Thank you in advance.

@crisu83 crisu83 assigned crisu83 and unassigned villeristi, Kotpes and ericnishio Apr 23, 2017
.gitignore Outdated
@@ -1,5 +1,26 @@
<<<<<<< HEAD
Copy link

Choose a reason for hiding this comment

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

Merge error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix, this is basically a completely new code base that was rebased on master.

.lintstagedrc Outdated
@@ -1,5 +1,6 @@
{
"*.js": [
"git add .",
Copy link

Choose a reason for hiding this comment

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

But why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it's one less manual step that speeds up development and makes people work in smaller chunks. https://github.com/okonet/lint-staged#examples

Copy link

Choose a reason for hiding this comment

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

Think about this scenario:

  1. You work on something
  2. You've staged parts of some files and you're ready to commit
  3. You run the linter, and git add . fucks up your stage. Now you have to unstage everything and carefully stage the lines/chunks/files you had before.

Copy link
Contributor

@hugovk hugovk Apr 24, 2017

Choose a reason for hiding this comment

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

I'm also a bit dubious. Did this cause the .gitignore merge errors to be committed? If anything, perhaps it should only add the modified .js files.

https://github.com/okonet/lint-staged#examples says:

Please note, that it doesn’t work well with committing hunks (git add -p).

Copy link

Choose a reason for hiding this comment

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

Indeed, IMO staging/committing is a job for the developer, not the machine.

README.md Outdated
@@ -10,7 +10,11 @@

## Why do I want this?

<<<<<<< HEAD
Copy link

Choose a reason for hiding this comment

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

Lots of merge errors here

package.json Outdated
"redux-actions": "^2.0.2",
"redux-saga": "^0.14.7"
},
"devDependencies": {
Copy link

Choose a reason for hiding this comment

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

IMO everything that is not related to webpack-dev-server, linting etc. should be in dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But why? We should be installing dev dependencies during CI and only leave them out when building production.

Copy link

@Jalle19 Jalle19 Apr 24, 2017

Choose a reason for hiding this comment

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

We've discussed this once already. The fact is that there are no "production dependencies" since the production build is just a bunch of .js files and some assets.

Currently in order to build the production bundle you have to install every single dependency, including webpack-dev-server.

You have to ask yourself "what can I do if I run yarn install --production"? With the current package.json you will not be able to do anything, not even, i.e. none of the commands here will work (AFAIK):

+  "scripts": {
+    "ci": "CI=true run-p flow lint-staged test",
+    "flow": "flow",
+    "lint": "eslint src --fix",
+    "lint-staged": "lint-staged",
+    "precommit": "lint-staged",
+    "stylelint": "stylelint 'src/**/*.css'",
+    "start": "node scripts/start.js",
+    "build": "node scripts/build.js",
+    "test": "node scripts/test.js --env=jsdom"
+  },

@crisu83 crisu83 changed the title WIP: Bootstrap with Create React App WIP: Version 2 Apr 23, 2017
README.md Outdated

```bash
yarn run compile
yarn run build
Copy link
Contributor

Choose a reason for hiding this comment

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

Or simply yarn build.

env[key] = process.env[key];
return env;
}, {
// Useful for determining whether we’re running in production mode.
Copy link
Contributor

Choose a reason for hiding this comment

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

Overall, I think the inline documentation is too verbose.

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's all from Create React App with as few modifications as possible.

@@ -0,0 +1,80 @@
'use strict';

var path = require('path');
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're no longer supporting older versions of Node, we should be able to replace all instances of var with const (and let if needed).

@@ -0,0 +1,16 @@
'use strict';
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed?

var paths = require('./paths');



Copy link
Contributor

Choose a reason for hiding this comment

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

Too many empty lines.

@crisu83
Copy link
Contributor Author

crisu83 commented Apr 26, 2017

@Jalle19 let's look at the dependencies today when we meet face to face.

src/index.js Outdated
import React, {createElement} from 'react'
import {render} from 'react-dom'
import {AppContainer} from 'react-hot-loader'
import {browserHistory} from 'react-router'
Copy link
Contributor

Choose a reason for hiding this comment

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

'browserHistory' is defined but never used.

@Jalle19
Copy link

Jalle19 commented Apr 27, 2017

+1 from me as long as rm -rf node_modules && yarn install --production && yarn run compile works

@crisu83 crisu83 removed the request for review from villeristi April 27, 2017 09:27
@crisu83 crisu83 force-pushed the next branch 5 times, most recently from 1828fda to 5d52394 Compare April 27, 2017 10:27
/node_modules/
/dist/
# See https://help.github.com/ignore-files/ for more about ignoring files.

Choose a reason for hiding this comment

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

Why are we committing the build folder to the repo? @crisu83

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 are not?

@crisu83 crisu83 merged commit b7eb7cf into master May 4, 2017
@crisu83 crisu83 deleted the next branch May 4, 2017 07:10
@crisu83 crisu83 changed the title WIP: Version 2 Version 2 May 4, 2017
crisu83 added a commit that referenced this pull request May 4, 2017
* Bootstrap with Create React App
* Add Stylefmt and Stylelint
* Wrote tests with Jest
* Fix Flow configuration
* Upgrade to React Router v4
* Remove Node versions 4 and 5 from Travis build
* Add Reselect and rewrote selectors
* Fix Code Climate configuration
* Remove unused .csslintrc
* Remove unused routes.js
* Update README.md
* Add .eslintrc
* Update Code Climate configuration
* Improve types (#54)
* Move components into a subdirectory
* Simplify bootstrap
* Fix import path
* Move build dependencies
* Fix hyperlink
* Update documentation
* Add /decls to .eslintignore
crisu83 added a commit that referenced this pull request May 4, 2017
* Bootstrap with Create React App
* Add Stylefmt and Stylelint
* Wrote tests with Jest
* Fix Flow configuration
* Upgrade to React Router v4
* Remove Node versions 4 and 5 from Travis build
* Add Reselect and rewrote selectors
* Fix Code Climate configuration
* Remove unused .csslintrc
* Remove unused routes.js
* Update README.md
* Add .eslintrc
* Update Code Climate configuration
* Improve types (#54)
* Move components into a subdirectory
* Simplify bootstrap
* Fix import path
* Move build dependencies
* Fix hyperlink
* Update documentation
* Add /decls to .eslintignore
@hugovk hugovk mentioned this pull request Oct 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants