0.1.0 • Published 4 years ago
rn-create-library v0.1.0
rn-create-library
React Native command-line tool, used to generate native module with a single command
Requirements:
- Node.js 13.1.0
- Yarn 1.19.1
Installation
$ yarn global add rn-create-library
Command-line usage
Usage: rn-create-library [options] <name>
Creates a React Native library for different platforms
Options:
--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) The package name for the Android module (default: "com.reactlibrary")
--license [license] The license type (default: "MIT")
--example Generates an example project for iOS and Android and links the library to it (default: false)
-V, --version Output the version number
-h, --help Output usage information
Navigate into an empty directory to execute the command.
$ rn-create-library library-name
This will create the folder react-native-
library-name
in which the library will be created in.
Now install dependencies by running this command in the newly created library.
$ yarn install
Example
import createLibrary, { CLOptions } from 'rn-create-library';
const options: CLOptions = {
name: 'library-name',
};
createLibrary({
name: 'LibraryName',
}).then(() => {
console.log('Oh yay! My library has been created!');
});
0.1.0
4 years ago