create-nitro-lib
Version:
CLI tool to generate React Native Nitro Modules templates
91 lines (65 loc) ⢠1.94 kB
Markdown
# Create Nitro Lib CLI
A command-line tool to generate React Native Nitro Modules templates quickly and consistently, following industry best practices and modern tooling.
## Usage
Create a new Nitro module project:
```bash
bunx create-nitro-lib my-module
```
With options:
```bash
bunx create-nitro-lib my-module --skip-install
```
## Features
- š Interactive project setup
- š¦ Complete project structure generation
- š§ TypeScript support out of the box
- š± Example app included
- šļø Android and iOS native code structure
- š Ready-to-use configuration files
## Project Structure
The generated project includes:
```
react-native-my-module/
āāā package/ # The nitro module package
ā āāā src/ # TypeScript source code with specs
ā āāā android/ # Android native implementation
ā āāā ios/ # iOS native implementation
ā āāā cpp/ # C++ shared implementation
ā āāā nitro.json # Nitro configuration
āāā example/ # Expo example app
āāā scripts/ # Build scripts
āāā package.json # Workspace configuration
āāā tsconfig.json
āāā README.md
```
## Development
To work on this CLI tool:
```bash
git clone <repo-url>
cd nitro-lib-template-cli
bun install
bun run build
bun link
```
Then you can test it locally:
```bash
create-nitro-lib test-module
```
## Scripts
- `bun run build` - Build the CLI
- `bun run dev` - Run in development mode
- `bun run test` - Test the CLI by generating a project
- `bun run publish:npm` - Publish to NPM
- `bun run publish:dry` - Dry run to see what will be published
## Publishing
When you're ready to publish:
```bash
# Test everything works
bun run test
# Check what will be published
bun run publish:dry
# Publish to NPM (you'll need 2FA code)
bun run publish:npm
```
## License
MIT