Skip to content

Commit

Permalink
Merge pull request #19 from Wolox/rewire
Browse files Browse the repository at this point in the history
using wolox-react-scripts react-scripts configuration with rewire
  • Loading branch information
damfinkel authored and damfinkel committed May 21, 2018
2 parents 5466016 + 2a411b6 commit 3b285b3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
5 changes: 5 additions & 0 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ class GeneratorReact extends Generator {
includeAll: this.includeAll
}
);
this.fs.copyTpl(
this.templatePath('config-overrides.js'),
this.destinationPath('config-overrides.js'),
{}
);

// TODO remove this, and add only index from CRA (with Webpack configuration)
this.fs.copy(
Expand Down
14 changes: 8 additions & 6 deletions generators/app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"seamless-immutable": "^7.1.2"
},
"devDependencies": {
"react-app-rewired": "^1.5.2",
"babel-eslint": "^7.2.3",
"eslint": "^4.6.1",
"eslint-config-airbnb": "^15.1.0",
Expand All @@ -55,18 +56,19 @@
"husky": "^0.14.3",
"prettier": "^1.6.1",
"prettier-eslint": "^8.0.0",
"react-scripts": "^1.0.13"
"react-scripts": "^1.0.13",
"wolox-react-scripts": "^1.2.0"
},
"scripts": {
"start": "./node_modules/react-scripts/bin/react-scripts.js start",
"build": "./node_modules/react-scripts/bin/react-scripts.js build",
"start": "react-app-rewired start --scripts-version wolox-react-scripts",
"build": "react-app-rewired build --scripts-version wolox-react-scripts",
"test":
"./node_modules/react-scripts/bin/react-scripts.js test --env=jsdom",
"react-app-rewired test --scripts-version wolox-react-scripts --env=jsdom",
"eject": "./node_modules/react-scripts/bin/react-scripts.js eject",
"deploy": "npm run build",
"deploy": "react-app-rewired build --scripts-version wolox-react-scripts",
"lint": "./node_modules/eslint/bin/eslint.js src",
"lint-fix": "./node_modules/eslint/bin/eslint.js src --fix",
"lint-diff": "git diff --name-only --cached --relative | grep \\.js$ | xargs eslint",
"precommit": "npm run lint-diff"
},
}
}
4 changes: 4 additions & 0 deletions generators/app/templates/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = function override(config, env) {
//do stuff with the webpack config...
return config;
}
2 changes: 1 addition & 1 deletion generators/app/templates/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';

import App from './app';
import App from './App';
import './config/i18n';

ReactDOM.render(<App />, document.getElementById('root'));
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-react-bootstrap",
"version": "0.1.6",
"version": "0.1.7",
"description": "wolox-react-bootstrap",
"files": [
"index.js",
Expand Down Expand Up @@ -58,6 +58,7 @@
"husky": "^0.14.3",
"prettier": "^1.6.1",
"prettier-eslint": "^8.0.0",
"react-scripts": "^1.0.13"
"react-scripts": "^1.0.13",
"react-app-rewired": "^1.5.2"
}
}
5 changes: 1 addition & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,13 @@ elif ! system_has yarn; then
echo "Yarn is mandatory to continue"
echo "Check this guide to complete the installation: https://yarnpkg.com/lang/en/docs/install/#alternatives-tab"
exit 1
elif [[ $PATH != *"$HOME/.yarn/bin"* ]]; then
echo "Yarn global bin path must be cointained inside PATH varible"
exit 1
fi


yarn global add create-react-app --prefix /usr/local > /dev/null 2>&1
PROJECT_NAME=`echo "${PWD##*/}"`
cd ..
create-react-app "${PROJECT_NAME}" --scripts-version wolox-react-scripts
create-react-app "${PROJECT_NAME}"
yarn global add yo generator-react-bootstrap > /dev/null 2>&1
cd $PROJECT_NAME
yo react-bootstrap --force
Expand Down

0 comments on commit 3b285b3

Please sign in to comment.