Last active
April 11, 2018 22:15
-
-
Save simonporter007/3beb30be4426d515978f176a72fd3c26 to your computer and use it in GitHub Desktop.
react native project seed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TO BE RUN AFTER react-native init <project> | |
# Install eslint, babel and airbnb style guide | |
yarn add install eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y babel-eslint eslint-plugin-import eslint-import-resolver-babel-module babel-plugin-module-resolver babel-plugin-transform-object-rest-spread --dev | |
# Install chai, enzyme, husky, prettier-eslint, lint-stages | |
yarn add chai eslint-plugin-chai-friendly enzyme enzyme-adapter-react-16 husky lint-staged prettier-eslint --dev | |
# Install e2e test modules | |
yarn add selenium-standalone wdio-dot-reporter wdio-mocha-framework wdio-selenium-standalone-service --dev | |
./node_modules/.bin/eslint --init | |
cat >.eslintrc.json <<EOF | |
{ | |
"parser": "babel-eslint", | |
"extends": "airbnb", | |
"plugins": [ | |
"chai-friendly" | |
], | |
"rules": { | |
"no-unused-expressions": 0, | |
"chai-friendly/no-unused-expressions": 2, | |
"react/jsx-filename-extension": [ | |
2, | |
{ | |
"extensions": [".js", ".jsx"] | |
} | |
] | |
}, | |
"settings": { | |
"import/resolver": { | |
"babel-module": {} | |
} | |
} | |
} | |
EOF | |
cat >.babelrc <<EOF | |
{ | |
"presets": ["react-native"], | |
"env": { | |
"development": { | |
"plugins": [ | |
"transform-react-jsx-source", | |
"transform-object-rest-spread", | |
[ | |
"module-resolver", | |
{ | |
"root": ["./src"] | |
} | |
] | |
] | |
} | |
} | |
} | |
EOF | |
cat >setupTests.js <<EOF | |
import { configure } from 'enzyme'; | |
import Adapter from 'enzyme-adapter-react-16'; | |
configure({ adapter: new Adapter() }); | |
EOF | |
# setup e2etests | |
npm install webdriverio --force --save-dev | |
./node_modules/.bin/wdio --init | |
# make new project default directories | |
mkdir -p e2etests src/db src/api src/components src/features src/navigation | |
# package json changes: | |
cat << EOM | |
"scripts": { | |
"start": "node node_modules/react-native/local-cli/cli.js start", | |
"test": "node node_modules/jest/bin/jest.js", | |
"lint": "node node_modules/.bin/eslint .", | |
"lint:fix": "node node_modules/.bin/eslint . --fix", | |
"prettier": "prettier --write '*.js'", | |
"format-code": "yarn run prettier && yarn run lint:fix", | |
"selenium-setup": "selenium-standalone install", | |
"selenium-start": "selenium-standalone start", | |
"e2e-tests": "wdio wdio.conf.js", | |
"e2e-tests-watch": "wdio wdio.conf.js --watch" | |
}, | |
"lint-staged": { | |
"*.js": [ | |
"yarn run format-code", | |
"git add" | |
] | |
}, | |
"jest": { | |
"preset": "react-native", | |
"setupFiles": [ | |
"./setupTests.js" | |
] | |
}, | |
EOM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment