Sets up React with Storybook for component-driven development, including a FastAPI server to mock API responses from user-generated JSON files. Automates Storybook configuration, story generation, and optional mock server startup.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file storyweaver-0.1.0.tar.gz.
File metadata
- Download URL: storyweaver-0.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.146.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f51d89f9988cb7fedc95c2083a5a7dd0f625d11231624d480927863593127806
|
|
| MD5 |
59d3ad4f97bc1663ef8ab7cb0dd14a43
|
|
| BLAKE2b-256 |
84e834a6cdf9b9105eae581b65c99502a73d06b6a95285bc3e456cf13c9cfeb1
|
File details
Details for the file storyweaver-0.1.0-py3-none-any.whl.
File metadata
- Download URL: storyweaver-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.15.146.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7715e976da58883de96beb391cfbe7f83fe294d2224055b2b306b3511fda891d
|
|
| MD5 |
bfbbcaa71c2bd317712b93c5c5d8184a
|
|
| BLAKE2b-256 |
4ea1425b78ab4ff38d062d845b2e95e05014ad5c27a3253638d5f88491cee52e
|