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

Resolve #1085: Free __DEV__ variable provided by webpack should be used across RSK i… #1088

Closed
wants to merge 10 commits into from
Closed
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js:
- '7'
- '6'
env:
- CXX=g++-4.8
Expand All @@ -10,5 +11,5 @@ addons:
packages:
- g++-4.8
script:
- npm run lint
- npm run test
- yarn lint
- yarn test
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:7.2.1-alpine

# Copy applicaiton files
# Copy application files
COPY ./build /usr/src/app
WORKDIR /usr/src/app

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ and newcomers to the industry.
### Getting Started

* Follow the [getting started guide](./docs/getting-started.md) to download and run the project
([node](https://nodejs.org/) >= 5,
([node](https://nodejs.org/) >= 6,
**[node-gyp](https://github.com/nodejs/node-gyp#readme)**
and **[prerequisites](https://github.com/nodejs/node-gyp#installation)**)
* Check the [code recipes](./docs/recipes) used in this boilerplate, or share yours
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### Requirements

* Mac OS X, Windows, or Linux
* [Yarn][https://yarnpkg.com/] package + [Node.js](https://nodejs.org/) v6.5 or newer
* [Yarn](https://yarnpkg.com/) package + [Node.js](https://nodejs.org/) v6.5 or newer
* `node-gyp` prerequisites mentioned [here](https://github.com/nodejs/node-gyp)
* Text editor or IDE pre-configured with React/JSX/Flow/ESlint ([learn more](./how-to-configure-text-editors.md))

Expand Down
2 changes: 1 addition & 1 deletion docs/how-to-configure-text-editors.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Enable **ESLint** support

Enable **CSSComb** by following the instructions [here](https://github.com/csscomb/jetbrains-csscomb).

**If you have trouble with autoreloading** try to disable "safe write" in `File > Settings > System Settings > Use "safe write" (save chnages to a temporary file first)`
**If you have trouble with autoreloading** try to disable "safe write" in `File > Settings > System Settings > Use "safe write" (save changes to a temporary file first)`

### Atom

Expand Down
48 changes: 27 additions & 21 deletions docs/recipes/how-to-use-sass.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,30 @@ Update [`webpack.config.js`](../../tools/webpack.config.js) file to use `sass-lo
const config = {
...
module: {
loaders: [
rules: [
...
{
test: /\.scss$/,
loaders: [
'isomorphic-style-loader',
`css-loader?${JSON.stringify({ sourceMap: isDebug, minimize: !isDebug })}`,
'postcss-loader?pack=sass',
'sass-loader',
use: [
{
loader: 'isomorphic-style-loader',
},
{
loader: 'css-loader',
options: {
sourceMap: isDebug,
minimize: !isDebug,
},
},
{
loader: 'postcss-loader',
options: {
config: './tools/postcss.sass.js',
},
},
{
loader: 'sass-loader',
},
],
},
...
Expand All @@ -44,24 +59,15 @@ const config = {

### Step 3

Add one more configuration (pack) for [PostCSS](https://github.com/postcss/postcss) named `sass` to
Add one more configuration (`tools/postcss.sass.js`) for [PostCSS](https://github.com/postcss/postcss) to
enable [Autoprefixer](https://github.com/postcss/autoprefixer) for your `.scss` files:

```js
const config = {
...
postcss(bundler) {
return {
defaults: [
...
],
sass: [
require('autoprefixer')(),
],
};
}
...
}
module.exports = () => ({
plugins: [
require('autoprefixer')(),
],
});
```

For more information visit https://github.com/jtangelder/sass-loader and https://github.com/sass/node-sass
111 changes: 57 additions & 54 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,108 +7,109 @@
"npm": ">=3.10"
},
"dependencies": {
"babel-polyfill": "^6.20.0",
"babel-runtime": "^6.20.0",
"bluebird": "^3.4.6",
"body-parser": "^1.15.2",
"babel-polyfill": "^6.22.0",
"babel-runtime": "^6.22.0",
"bluebird": "^3.4.7",
"body-parser": "^1.16.0",
"classnames": "^2.2.5",
"cookie-parser": "^1.4.3",
"core-js": "^2.4.1",
"express": "^4.14.0",
"express-graphql": "^0.6.1",
"express": "^4.14.1",
"express-graphql": "^0.6.2",
"express-jwt": "^5.1.0",
"fastclick": "^1.0.6",
"fbjs": "^0.8.6",
"graphql": "^0.8.2",
"history": "^4.5.0",
"fbjs": "^0.8.8",
"graphql": "^0.9.1",
"history": "^4.5.1",
"isomorphic-style-loader": "^1.1.0",
"jsonwebtoken": "^7.2.1",
"node-fetch": "^1.6.3",
"normalize.css": "^5.0.0",
"passport": "^0.3.2",
"passport-facebook": "^2.1.1",
"pretty-error": "^2.0.2",
"query-string": "^4.2.3",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"sequelize": "^3.28.0",
"source-map-support": "^0.4.6",
"query-string": "^4.3.1",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"sequelize": "^3.30.1",
"source-map-support": "^0.4.11",
"sqlite3": "^3.1.8",
"universal-router": "^2.0.0",
"whatwg-fetch": "^2.0.1"
"whatwg-fetch": "^2.0.2"
},
"devDependencies": {
"assets-webpack-plugin": "^3.5.0",
"autoprefixer": "^6.5.3",
"babel-cli": "^6.18.0",
"babel-core": "^6.18.2",
"assets-webpack-plugin": "^3.5.1",
"autoprefixer": "^6.7.2",
"babel-cli": "^6.22.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.8",
"babel-loader": "^6.2.10",
"babel-plugin-rewire": "^1.0.0",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-latest": "^6.16.0",
"babel-preset-react": "^6.16.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-latest": "^6.22.0",
"babel-preset-react": "^6.22.0",
"babel-preset-react-optimize": "^1.0.1",
"babel-preset-stage-0": "^6.16.0",
"babel-register": "^6.18.0",
"babel-template": "^6.16.0",
"babel-types": "^6.19.0",
"browser-sync": "^2.18.2",
"babel-preset-stage-0": "^6.22.0",
"babel-register": "^6.22.0",
"babel-template": "^6.22.0",
"babel-types": "^6.22.0",
"browser-sync": "^2.18.7",
"chai": "^3.5.0",
"chokidar": "^1.6.1",
"css-loader": "^0.26.0",
"css-loader": "^0.26.1",
"editorconfig-tools": "^0.1.1",
"enzyme": "^2.6.0",
"eslint": "^3.10.2",
"eslint-config-airbnb": "^13.0.0",
"enzyme": "^2.7.1",
"eslint": "^3.14.1",
"eslint-config-airbnb": "^14.0.0",
"eslint-loader": "^1.6.1",
"eslint-plugin-css-modules": "^1.0.9",
"eslint-plugin-css-modules": "^2.1.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.7.1",
"eslint-plugin-jsx-a11y": "^3.0.2",
"eslint-plugin-react": "^6.9.0",
"extend": "^3.0.0",
"file-loader": "^0.9.0",
"front-matter": "^2.1.1",
"file-loader": "^0.10.0",
"front-matter": "^2.1.2",
"git-repository": "^0.1.4",
"glob": "^7.1.1",
"json-loader": "^0.5.4",
"lint-staged": "^3.2.2",
"lint-staged": "^3.3.0",
"markdown-it": "^8.2.2",
"mkdirp": "^0.5.1",
"mocha": "^3.1.2",
"mocha": "^3.2.0",
"pixrem": "^3.0.2",
"pleeease-filters": "^3.0.0",
"postcss": "^5.2.5",
"postcss": "^5.2.11",
"postcss-calc": "^5.3.1",
"postcss-color-function": "^2.0.1",
"postcss-custom-media": "^5.0.1",
"postcss-custom-properties": "^5.0.1",
"postcss-custom-selectors": "^3.0.0",
"postcss-flexbugs-fixes": "^2.0.0",
"postcss-loader": "^1.1.1",
"postcss-flexbugs-fixes": "^2.1.0",
"postcss-loader": "^1.2.2",
"postcss-media-minmax": "^2.1.2",
"postcss-nested": "^1.0.0",
"postcss-nesting": "^2.3.1",
"postcss-partial-import": "^2.1.0",
"postcss-partial-import": "^3.1.0",
"postcss-pseudoelements": "^3.0.0",
"postcss-selector-matches": "^2.0.5",
"postcss-selector-not": "^2.0.0",
"postcss-url": "^5.1.2",
"pre-commit": "^1.2.2",
"raw-loader": "^0.5.1",
"react-addons-test-utils": "15.4.1",
"react-addons-test-utils": "^15.4.2",
"react-deep-force-update": "^2.0.1",
"react-hot-loader": "^3.0.0-beta.6",
"redbox-react": "^1.3.3",
"rimraf": "^2.5.4",
"sinon": "^2.0.0-pre.3",
"stylefmt": "^5.0.2",
"stylelint": "^7.6.0",
"stylelint-config-standard": "^15.0.0",
"sinon": "^2.0.0-pre.5",
"stylefmt": "^5.1.1",
"stylelint": "^7.7.1",
"stylelint-config-standard": "^15.0.1",
"url-loader": "^0.5.7",
"webpack": "^1.13.3",
"webpack-hot-middleware": "^2.13.2",
"webpack-middleware": "^1.5.1"
"webpack": "^2.2.1",
"webpack-dev-middleware": "^1.9.0",
"webpack-hot-middleware": "^2.16.1",
"write-file-webpack-plugin": "^3.4.2"
},
"babel": {
"presets": [
Expand Down Expand Up @@ -155,9 +156,11 @@
"import/no-extraneous-dependencies": "off",
"react/forbid-prop-types": "off",
"react/jsx-filename-extension": "off",
"react/no-array-index-key": "off",
"react/no-danger": "off",
"react/no-unused-prop-types": "off",
"react/prefer-stateless-function": "off"
"react/prefer-stateless-function": "off",
"react/require-default-props": "off"
}
},
"stylelint": {
Expand Down Expand Up @@ -202,9 +205,9 @@
"lint:js": "eslint src tools",
"lint:css": "stylelint \"src/**/*.{css,less,scss,sss}\"",
"lint:staged": "lint-staged",
"lint": "npm run lint:js && npm run lint:css",
"lint": "yarn run lint:js && yarn run lint:css",
"test": "mocha \"src/**/*.test.js\" --require babel-register --require test/setup.js",
"test:watch": "npm run test -- --reporter min --watch",
"test:watch": "yarn run test -- --reporter min --watch",
"clean": "babel-node tools/run clean",
"copy": "babel-node tools/run copy",
"bundle": "babel-node tools/run bundle",
Expand Down
2 changes: 1 addition & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ async function onLocationChange(location) {
}

// Display the error in full-screen for development mode
if (process.env.NODE_ENV !== 'production') {
if (__DEV__) {
appInstance = null;
document.title = `Error: ${error.message}`;
ReactDOM.render(<ErrorReporter error={error} />, container);
Expand Down
2 changes: 1 addition & 1 deletion src/core/devUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/* eslint-disable global-require */

if (module.hot || process.env.NODE_ENV !== 'production') {
if (module.hot || __DEV__) {
module.exports = {
// The red box (aka red screen of death) component to display your errors
// https://github.com/commissure/redbox-react
Expand Down
8 changes: 4 additions & 4 deletions src/data/queries/news.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import fetch from '../../core/fetch';
import NewsItemType from '../types/NewsItemType';

// React.js News Feed (RSS)
const url = 'http://ajax.googleapis.com/ajax/services/feed/load' +
'?v=1.0&num=10&q=https://reactjsnews.com/feed.xml';
const url = 'https://api.rss2json.com/v1/api.json' +
'?rss_url=https%3A%2F%2Freactjsnews.com%2Ffeed.xml';

let items = [];
let lastFetchTask;
Expand All @@ -31,8 +31,8 @@ const news = {
lastFetchTask = fetch(url)
.then(response => response.json())
.then(data => {
if (data.responseStatus === 200) {
items = data.responseData.feed.entries;
if (data.status === 'ok') {
items = data.items;
}

return items;
Expand Down
4 changes: 2 additions & 2 deletions src/data/types/NewsItemType.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const NewsItemType = new ObjectType({
title: { type: new NonNull(StringType) },
link: { type: new NonNull(StringType) },
author: { type: StringType },
publishedDate: { type: new NonNull(StringType) },
contentSnippet: { type: StringType },
pubDate: { type: new NonNull(StringType) },
content: { type: StringType },
},
});

Expand Down
6 changes: 1 addition & 5 deletions src/routes/about/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ export default {
path: '/about',

async action() {
const data = await new Promise((resolve) => {
require.ensure([], require => {
resolve(require('./about.md'));
}, 'about');
});
const data = await require.ensure([], require => require('./about.md'), 'about');

return {
title: data.title,
Expand Down
4 changes: 1 addition & 3 deletions src/routes/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export default {
return { redirect: '/login' };
}

const Admin = await new Promise((resolve) => {
require.ensure([], (require) => resolve(require('./Admin').default), 'admin');
});
const Admin = await require.ensure([], require => require('./Admin').default, 'admin');

return {
title,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/error/ErrorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ErrorPage extends React.Component {
};

render() {
if (process.env.NODE_ENV !== 'production') {
if (__DEV__) {
const { error } = this.props;
return (
<div>
Expand Down
Loading