Skip to main content

Setup A new Project

Few steps to start A new Project with React Native

Create New Project Using Obytes Template( recomended)#

Make sure to remove React Native cli global install in case you already install it globally

npm uninstall -g react-native-cli

Use npx to start the new project

npx react-native init MyApp --template

Add the following script to your packages.json and reinstall dependencies to enable husky pre-commit using yarn install

"scripts": {     "postinstall": "husky install",  },

Create New Project#

Use npx to start the new project

npx react-native init MyApp --template react-native-template-typescript

we recommend using typescript ๐Ÿ˜‰

๐Ÿ‘‰ More Info :

Setup Husky pre-commit hook with ESLint.#

Husky lets us run commands or script before committing or pushing our code to git, its very useful to To stupe some pre-commit hook easily, we are going to use it to run Eslint and Prettier to validate our commit. We can use the power of pre-commit to Make sure our commit messages meet the conventional commit format.

  • Install Deps :
yarn add husky lint-staged @commitlint/config-conventional @commitlint/cli -D
  • Configure commitlint to use conventional config (optional)
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
  • Add the following code to your package.json
"husky": {    "hooks": {       "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",       "pre-commit": "yarn lint"    }  }
"lint-staged": {    "*.{js,jsx,tsx}": "eslint"  }

UseFull Npm scripts :#

Some Npm script to be added to your package.json

 "clean:android": "cd android && ./gradlew cleanBuildCache && ./gradlew clean && cd ..", "clean:ios": "rm -rf ios/build", "clean": "run-p clean:*", "setup:ios": "cd ios && pod install --repo-update && cd ..",

Make sure to install npm-run-all as Dev deps

๐Ÿ‘€ More Info#



Last updated on by Youssouf EL Azizi