UNPKG

create-nitro-lib

Version:
91 lines (65 loc) • 1.94 kB
# 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