Skip to content

feat: start docs #702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jun 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Deploy to GitHub Pages

on:
push:
branches: [next]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:

# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4

- name: Set node version
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install
shell: 'bash'
run: yarn install

- name: Build
shell: 'bash'
working-directory: docs
run: yarn build

- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/build/'

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ built-storybooks
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.eslintcache
.eslintcache
examples/expo-example/.maestro/diffs
examples/expo-example/.maestro/screenshots
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.yarn
dist/
examples/expo-example/.expo
examples/expo-example/.rnstorybook/storybook.requires.ts
examples/expo-example/.rnstorybook/storybook.requires.ts
docs/.docusaurus
docs/build
.claude/
95 changes: 95 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Common Development Commands

### Initial Setup

```bash
yarn install
yarn build
```

### Development

```bash
# Watch all packages for changes
yarn dev

# Run the expo example app with Storybook
yarn example
```

### Testing

```bash
# Run unit tests across all packages
yarn test

# Run tests in CI mode
yarn test:ci

```

### Linting and Code Quality

```bash
# Run ESLint across the codebase
yarn lint
```

### Release Process

```bash
# Version packages (maintainers only)
yarn version-packages

# Publish to npm
yarn publish:latest # For stable releases
yarn publish:next # For pre-releases
yarn publish:alpha # For alpha releases
```

## Architecture Overview

This is a **Yarn workspaces monorepo** managed by Lerna containing React Native Storybook packages:

### Core Packages

- **@storybook/react-native** - Main package providing Storybook functionality for React Native
- **@storybook/react-native-ui** - Full UI components for on-device Storybook
- **@storybook/react-native-ui-lite** - Lightweight UI components
- **@storybook/react-native-ui-common** - Shared UI components
- **@storybook/react-native-theming** - Theming utilities

### On-Device Addons

- **@storybook/addon-ondevice-actions** - Log component interactions
- **@storybook/addon-ondevice-backgrounds** - Change story backgrounds
- **@storybook/addon-ondevice-controls** - Dynamically edit component props
- **@storybook/addon-ondevice-notes** - Add markdown documentation to stories

### Build System

- Uses **tsup** for TypeScript compilation
- Targets ES2022 with CommonJS output
- Each package has its own `tsup.config.ts`
- Running `yarn prepare` in a package builds it

### Metro Configuration

The `withStorybook` wrapper is crucial for React Native Storybook:

- Enables `unstable_allowRequireContext` for dynamic story imports
- Automatically generates `storybook.requires.ts` file
- Optional WebSocket server for remote control
- Can be conditionally enabled/disabled via options

### Key Concepts

1. **CSF (Component Story Format)**: Standard story syntax used across Storybook
2. **On-device UI**: Native UI that runs directly on mobile devices
3. **Story requires generation**: Automatic generation of story imports via Metro
4. **Portable stories**: Reuse stories in unit tests
5. **WebSocket support**: Remote control stories from external devices
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
14 changes: 14 additions & 0 deletions docs/blog/2025-03-23-first-blog-post.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
slug: hello-world
title: Hello World
authors: [dannyhw]
tags: []
---

React Native Storybook docs are here. Over the next few weeks and months we'll be building out the documentation.

<!-- truncate -->

As part of an effort to make React Native Storybook easier to use we've started working on dedicated documentation that will explain the nuances of running Storybook on React Native.

If you have something you want to be documented help us build out the docs by submitting a pull request.
9 changes: 9 additions & 0 deletions docs/blog/authors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dannyhw:
name: Danny Williams
title: Senior Software Engineer
url: https://github.com/dannyhw
image_url: https://github.com/dannyhw.png
page: true
socials:
x: Danny_H_W
github: dannyhw
9 changes: 9 additions & 0 deletions docs/blog/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
releases:
label: Releases
permalink: /releases
description: Release posts

guides:
label: Guides
permalink: /guides
description: Guide posts
Loading