Usage¶
Basic Commands¶
Create a new app¶
This creates a new React Native app with the following structure:
my-app/
├── app/
│ ├── _layout.tsx
│ ├── index.tsx
│ └── storybook.tsx
├── components/
├── assets/
├── android/
├── ios/
├── package.json
├── app.config.js
├── metro.config.js
├── tailwind.config.js
├── tsconfig.json
└── ...
Generate components¶
This creates a new React component with:
- TypeScript component file
- Type definitions
- Storybook story
- Unit test file
Examples¶
Creating an app¶
Adding components¶
# Generate a button component
ok-cli generate component Button
# Generate a header component
ok-cli generate component Header
# Generate a card component
ok-cli generate component Card
Command Reference¶
ok-cli new <name>¶
Creates a new React Native app with the specified name.
Options:
- <name>: The name of the app (required)
ok-cli generate <type> <name>¶
Generates a new item based on templates.
Options:
- <type>: Type of item to generate (component, service, page)
- <name>: Name of the item to generate (required)
Project Structure¶
After creating an app and adding components, your project will look like:
MyAwesomeApp/
├── components/
│ ├── Button/
│ │ ├── Button.tsx
│ │ ├── Button.types.tsx
│ │ ├── Button.story.tsx
│ │ ├── Button.test.tsx
│ │ └── index.tsx
│ └── Header/
│ ├── Header.tsx
│ ├── Header.types.tsx
│ ├── Header.story.tsx
│ ├── Header.test.tsx
│ └── index.tsx
├── app/
│ ├── _layout.tsx
│ ├── index.tsx
│ └── storybook.tsx
└── ...