StoryWeaver
Overview
StoryWeaver sets up a React environment with Storybook for component-driven development and testing. It includes an integrated FastAPI server to mock API responses using user-generated JSON files. The setup script automates Storybook configuration, story generation for React components, and optional FastAPI mock server startup, enhancing the development workflow.
Features
- Storybook Integration: Automatically configures Storybook for your React project.
- Story Generation: Generates story files for each React component.
- API Mocking: Uses FastAPI to mock API responses from user-provided JSON files.
Installation
-
Clone the Repository
git clone https://github.com/yourusername/storyweaver.git
cd storyweaver
-
Install Dependencies
Using Poetry:
poetry install
-
Initialize Your React Project
If you haven't already, set up your React project and install Storybook:
npx create-react-app my-project
cd my-project
npx sb init
Usage
-
Setup Storybook and Generate Stories
poetry run python setup_storybook.py path/to/components
-
Optionally, Start the FastAPI Mock Server
poetry run python setup_storybook.py path/to/components --mock
-
Run Storybook
npm run storybook
Project Structure
- setup_storybook.py: Script to configure Storybook and generate stories.
- mock_api.py: FastAPI server script to mock API responses.
- mock_api: Directory containing user-generated JSON files for API responses.
Contributing
Contributions are welcome! Please open an issue or submit a pull request with your changes.
License
This project is licensed under the MIT License. See the LICENSE file for details.