diff --git a/README.md b/README.md index 5ca60f91..353fff89 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,21 @@ wolox-react-bootstrap ## Prerequisites -React: https://facebook.github.io/react/docs/getting-started.html -node & npm: https://github.com/creationix/nvm#install-script -yarn: https://yarnpkg.com/lang/en/docs/install/#alternatives-tab +- [React](https://facebook.github.io/react/docs/getting-started.html) + +- [Node (minimum version: 6.2.0) and npm](https://github.com/creationix/nvm#install-script) + +- [Yarn](https://yarnpkg.com/lang/en/docs/install/#alternatives-tab) + +- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) + ## TL;DR You don't need to clone this repository. Just run the following in your terminal: -1- bash <(curl -s https://raw.githubusercontent.com/Wolox/react-bootstrap/development/run.sh) folderName +1- bash <(curl -s https://raw.githubusercontent.com/Wolox/react-bootstrap/development/run.sh) githubRepo + 2- Track and add or delete comment lines: with: // TODO Add this if you need it with: // TODO import your {..} + 3- Add .env with your API_BASE_URL diff --git a/generators/app/templates/_package.json b/generators/app/templates/_package.json index 9932df52..0409aa8d 100644 --- a/generators/app/templates/_package.json +++ b/generators/app/templates/_package.json @@ -58,13 +58,15 @@ "react-scripts": "^1.0.13" }, "scripts": { - "lint": "./node_modules/eslint/bin/eslint.js src", - "precommit": "npm run lint-diff", "start": "./node_modules/react-scripts/bin/react-scripts.js start", "build": "./node_modules/react-scripts/bin/react-scripts.js build", "test": "./node_modules/react-scripts/bin/react-scripts.js test --env=jsdom", "eject": "./node_modules/react-scripts/bin/react-scripts.js eject", - "deploy": "npm run build" - } + "deploy": "npm run build", + "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" + }, } diff --git a/run.sh b/run.sh index 7c9b43f5..ff1ea83d 100755 --- a/run.sh +++ b/run.sh @@ -8,6 +8,8 @@ system_has() { type "$1" > /dev/null 2>&1 } +currentnodeversion="$(node --version)" +requirednodeversion="v6.2.0" if ! system_has git; then echo "git is mandatory to continue" echo "Check this guide to complete the installation: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" @@ -18,10 +20,16 @@ elif ! system_has node; then echo "- https://github.com/creationix/nvm#install-script" echo "- https://github.com/creationix/nvm#usage" exit 1 +elif [ "$(printf '%s\n' "$requirednodeversion" "$currentnodeversion" | sort -V | head -n1)" != "$requirednodeversion" ]; then + echo "The node version must be >= v6.2.0" + exit 1 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 @@ -36,6 +44,11 @@ yarn global add package-json-merge > /dev/null 2>&1 package-json-merge package.json packageB.json > packageA.json mv packageA.json package.json rm packageB.json +git init + +if ! [[-z "$1" ]]; then +git remote add origin $1 +fi yarn && yarn start wait $!