• Stars
    star
    1,453
  • Rank 32,372 (Top 0.7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📓 Command line tool to create a React Native library with a single command

react-native-create-library

Tool to create a React Native library with a single command.

Why might you need this?

If you are looking to create a native module for React Native, you need some native code for each platform you want to support and then some JavaScript code to bind it all together. Setting this up by yourself can be time-consuming.

This is where this tool comes in. It creates a boilerplate with all current best practices in mind. Why not use react-native new-library? Unfortunately that command doesn't create an up-to-date library, requires an already initialized React Native project and only sets up the iOS side of things.

Caution: This only creates native modules without a view component.

Alternatives

react-native-create-bridge

Installation

Requirements: Node 6.0+

$ npm install -g react-native-create-library

Command-line usage

Navigate into an empty directory to execute the command.

$ react-native-create-library MyFancyLibrary

This will create the folder MyFancyLibrary in which the library will be created in.

Now install dependencies by running this command in the newly created library.

$ npm install
Usage: react-native-create-library [options] <name>

Options:

  -h, --help                                output usage information
  -V, --version                             output the version number
  -p, --prefix <prefix>                     The prefix for the library (Default: `RN`)
  --module-prefix <modulePrefix>            The module prefix for the library (Default: `react-native`)
  --package-identifier <packageIdentifier>  (Android only!) The package name for the Android module (Default: `com.reactlibrary`)
  --namespace <namespace>                   (Windows only!) The namespace for the Windows module
   (Default: The name as PascalCase)
  --platforms <platforms>                   Platforms the library will be created for. (comma separated; default: `ios,android,windows`)
  --github-account <github_account>         The github account where the library is hosted (Default: `github_account`)
  --author-name <name>                      The author's name (Default: `Your Name`)
  --author-email <email>                    The author's email (Default: `[email protected]`)
  --license <license>                       The license type of this library (Default: `Apache-2.0`)
  --generate-example <shouldGenerate>       Will generate a RN example project and link the new library to it (Default: `false`)

Programmatic usage

const createLibrary = require('react-native-create-library');

createLibrary({
  name: 'MyFancyLibrary'
}).then(() => {
  console.log('Oh yay! My library has been created!');
})

Options

{
  name: String, /* The name of the library (Default: Library) */
  prefix: String, /* The prefix for the library (Default: RN) */
  modulePrefix: String, /* The module prefix for the library (Default: react-native) */
  platforms: Array, /* Platforms the library will be created for. (Default: ['ios', 'android', 'windows']) */
  packageIdentifier: String, /* (Android only!) The package name for the Android module (Default: com.reactlibrary) */
  namespace: String, /* (Windows only!) The namespace for the Windows module (Default: The package identifier as PascalCase, which is `Com.Reactlibrary`) */
  githubAccount: String, /* The github account where the library is hosted (Default: `github_account`) */
  authorName: String, /* The author's name (Default: `Your Name`) */
  authorEmail: String, /* The author's email (Default: `[email protected]`) */ 
  license: String, /* The license type of this library (Default: `Apache-2.0`) */
  generateExample: Boolean, /* Will generate a RN example project and link the new library to it (Default: `false`) */
}

Acknowledgements

react-native-share (https://github.com/EstebanFuentealba/react-native-share) has been a great source of inspiration for this project.

License

MIT

More Repositories

1

react-native-ibeacon

📡 iBeacon support for React Native
Objective-C
375
star
2

react-native-bluetooth-state

📶 Answering the question of "Is my bluetooth on?" in React Native
Objective-C
73
star
3

react-intl-native

react-intl components for React Native
JavaScript
62
star
4

react-native-flags

🏁 Fun with flags (in React Native)!
JavaScript
51
star
5

moirai

🃏 React.js game engine. Exciting, experimental and unstable
JavaScript
46
star
6

react-spritesheet

Spritesheets for React
JavaScript
34
star
7

superobject

💢 A fast Delphi JSON parser - Fork of http://code.google.com/p/superobject/
Pascal
22
star
8

react-native-agenda-view

Display a schedule/agenda quickly with <AgendaView />
JavaScript
22
star
9

rollup-babel-lib-bundler

🚜 Utility to bundle JavaScript libraries with Rollup
JavaScript
20
star
10

talks

Fancy talks I've done or will be doing
JavaScript
19
star
11

react-native-yaml-styles

👔 If you prefer YAML over JSON for stylesheets in your React Native projects
Objective-C
17
star
12

flockn

🎮 Leightweight declarative game engine for JavaScript
JavaScript
16
star
13

react-lib-starterkit

My personal starterkit for React libraries
JavaScript
15
star
14

react-native-notification

🔔 Customizable toast-like notifications for React Native
JavaScript
13
star
15

react-native-piechart

Pie Chart for React Native
Objective-C
12
star
16

react-native-helloworld

Transforming a React Hello World application into a React Native one
Objective-C
11
star
17

grunt-codo

Grunt task for generating codo documentation
CoffeeScript
8
star
18

tilelogic

Logic for tilemaps
TypeScript
7
star
19

rollup-plugin-local-resolve

Resolves Node-style directories with `index.js` files in Rollup
JavaScript
6
star
20

react-native-fontbase

The missing `rem` for React Native
JavaScript
6
star
21

rollup-plugin-named-directory

Resolves modules to its directory names
JavaScript
6
star
22

webpack-config-builder

Split your webpack config into multiple smaller parts
JavaScript
5
star
23

react-app-starterkit

My personal (opiniated) template for React projects
JavaScript
4
star
24

react-scenedirector

Managing scenes in React projects
JavaScript
4
star
25

require-webpack-compat

🐒 Monkey-patches `require.context` into Node.js require
JavaScript
4
star
26

babel-preset-es2015-loose-rollup

Babel ES2015 Loose mode to be used with rollup
JavaScript
3
star
27

react-europe-hackathon2017

Something VR with embedding the Youtube conference streams and stuff
JavaScript
3
star
28

BESEN

Fork of BESEN Ecmascript Engine.
Component Pascal
3
star
29

react-tilemap

Tilemap built using React
JavaScript
2
star
30

detectr

detectr is a small library for adding user tests, for example detecting the current platform, display size and orientation
JavaScript
2
star
31

generator-pixi

Yeoman generator for Pixi.js
JavaScript
2
star
32

ava-tdd-starterkit

AVA TDD Starterkit
JavaScript
2
star
33

mealplan

TypeScript
2
star
34

gamebricks

Think Lodash, but for games
TypeScript
2
star
35

my-tech-stack

This is my personal opinionated tech stack
2
star
36

react-simple-component-state

Dead-simple component state with functional stateless React components
JavaScript
2
star
37

astroorigami

Migjam #12
JavaScript
1
star
38

travel-checklist

1
star
39

isr2013

Indie Speedrun Game 2013
JavaScript
1
star
40

bundlebee

Experiment to provide a unified API for bundlers and allow to just drop in bundlers
JavaScript
1
star
41

reshine

Let's take the sunshine path with RethinkDB
JavaScript
1
star
42

survivalguide-vampires

Indie Speed Run 2015
JavaScript
1
star
43

ghosthand

Lightweight blog engine for node.js
JavaScript
1
star
44

crust

Crust Library: Use the same (cheese-filled) crust, create a new topping.
C++
1
star
45

grunt-bower-commands

Grunt task for running bower commands
JavaScript
1
star
46

martian-robots

Command-line tool to path out the way for a robot on Mars
JavaScript
1
star
47

functional-game-template

JavaScript
1
star
48

migratr

Dead-simple database-agnostic migrations
JavaScript
1
star
49

github-issue-browser

TypeScript
1
star
50

repo-template

1
star
51

confessor

Command line library for FreePascal/Delphi
Pascal
1
star
52

fruityscript

TypeScript
1
star
53

todo-cards

Simple todo management for iOS written in React Native
Objective-C
1
star
54

moviedb

Movie DB app made in React
JavaScript
1
star
55

gitmoji-toolkit

:clown2: Several tools to use gitmoji commits in your projects
JavaScript
1
star
56

hapi-json-api-starterkit

Starterkit for creating JSON APIs with Hapi
JavaScript
1
star
57

standup-randomizer

1
star
58

monorepo-talk

JavaScript
1
star
59

conference-time

It's conference time! A mobile app made with React Native
JavaScript
1
star
60

immutable-tilelogic

TypeScript
1
star
61

react-native-image-container

An image container for images - in React Native
JavaScript
1
star
62

gitmoji-commiteur

Use emojis for your commits! ⚡ ✨
JavaScript
1
star
63

clearice

Functional Canvas Renderer
TypeScript
1
star
64

juicyscript

Sweet experimental scripting language
TypeScript
1
star
65

shapeshifter

Experimental source-to-source transformer
1
star
66

horde3d-pascal

Pascal Bindings for Horde3D
Pascal
1
star
67

processing-sketcher

Small wrapper for using Processing.js with CoffeeScript
CoffeeScript
1
star
68

learning-curve

1
star
69

react-scaling-viewport

📺 React viewport component that scales based on the window size
1
star
70

asteria

Prototyping a framework for JavaScript that works on the desktop
Component Pascal
1
star
71

react-proxy-es2015-loader

Like `react-proxy-loader`, but using ES2015
JavaScript
1
star