Giter Site home page Giter Site logo

allanac / react-native-webpack-starter-kit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from miguelramosfdz/react-native-webpack-starter-kit

0.0 1.0 0.0 412 KB

:herb: Build your React Native app with Webpack and Babel

License: MIT License

JavaScript 44.29% Java 9.21% Objective-C 46.50%

react-native-webpack-starter-kit's Introduction

This Project Is Deprecated

This kit was originally used to build and ship, and later extracted from, Lumpen Radio early in the RN lifecycle. Since then there have been significant advances in RN tooling and, as a result, I recommend checking out some of the other Awesome React Native Boilerplates that've popped up lately. Have fun out there!

react-native-webpack-starter-kit

Build Status Dependency Status devDependency Status Gitter

Build your React Native app with Webpack and Babel.

React Native Webpack Starter Kit

Simple asset pipeline for seed apps built with React Native. Uses Babel 6 for ES7 JavaScript transpilation with Stage 1 support, and Webpack as a dev server and module bundler. Provides static code linting using ESLint and build output in the same console window, and Source Maps for debugging in the browser. Unprescriptive in terms of test frameworks and Flux implementations. Additional features listed below.

Features

  • Minimal dependencies
  • Follows the latest React Native stable release
  • Manage assets using Webpack
  • Dynamically generates JS bundles using Webpack Dev Server
  • Provides static code analysis with ESLint
  • Keeps dependencies fresh using Greenkeeper
  • Monitors dependency vulnerabilities with Snyk
  • Aids code consistency using EditorConfig
  • Integrates with webpack-notifier for desktop notifications on OS X
  • Example CI service integration using Travis

Requirements

Installation

Clone repo and install dependencies once your environment is set-up:

git clone -o upstream -b master --single-branch \
    https://github.com/jhabdas/react-native-webpack-starter-kit.git native-starter-kit && cd $_ && npm i

Running

Once project cloned and dependencies installed, run it with:

npm start

This will start the React Packager and a Webpack Dev Server. The dev server will watch your JS files for changes, automatically linting your code as you iterate. Additionally, the dev server will generate the index.[platform].js files expected by your React Native iOS or Android app, allowing you the freedom to build

iOS

Status: All systems go.

Open ios/App.xcodeproj in Xcode, build and run the project.

Unlike the app currently generated by react-native init this app removes the UIViewControllerBasedStatusBarAppearance key to prevent an App Store rejection I received submitting Lumpen Radio to the App Store. The key may be added back, if desired.

For information on HMR support for iOS see react-native-webpack-server/issues/103.

Android

Status: Bug in simulator. Test on actual device instead.

For android development use the following:

npm run android-setup-port # Note that this option is available on devices running android 5.0+ (API 21)
react-native run-android

If you run into any issues please see the Getting Started guide for React Native before submitting an issue.

Docker

Status: Experimental.

This kit includes a Dockerfile which can be used to create a virtualized development environment for building your app. To use it on Windows set-up Docker Machine then run the commands below with cmder (or similar) to get going. OS X users are encouraged to use dlite instead of Docker Machine for this setup.

  1. Clone this repo then update .watchmanconfig to the following: {"ignore_dirs": ["node_modules"]}.
  2. Run docker build --rm . command from the project root directory to build a virtualized Linunx environment configured for development using this starter kit.
  3. Get the ID of the built Docker image by running docker images and looking for the most recently created image.
  4. Then shell into the box with docker run -it 09608e4ec865 /bin/bash (where 09608e4ec865 is the Image ID) and run the app with npm start.

If iOS and Android device emulators are not available for your development environment (anything except OS X, basically) consider shipping code directly to a native device using Exponent or CodePush.

Testing

As a minimalist seed this project does not introduce a testing framework. Instead it leverages simple static code analysis to help prevent coding mistakes and introduce some patterns for building React Native apps with ES2015 and ES7 with a functional mindset inspired by the Elm architecture and functional React alternatives like Deku.

Webpack is configured with a pre-loader to lint the application with ESLint using the Babel parser during app development. And the npm lint command may be run at anytime to lint source code otherwise. See the .eslintrc file to adjust linter rules to your liking. Or run npm test to lint the application and scan its dependencies it for known security vulnerabilities.

Bundling

To bundle the app for distribution for both iOS and Android:

  1. Execute npm run bundle to generate the offline JS bundle.
  2. For iOS, update AppDelegate.m to load from pre-bundled file on disk.
  3. Test the application, create an archive and submit to the store.

Submitting to Store

Please see Submitting to App Store for instructions on iOS. If you have any good Android instructions, please send a PR this way. Good luck and have fun out there!

react-native-webpack-starter-kit's People

Contributors

greenkeeperio-bot avatar pastuhov avatar shprink avatar benjick avatar qimingweng avatar arjun-io avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.