How alx/react-bounding-box works
Main components
A. Source Layer (blue)
• src/tests/index.js – Mocha test suite for unit/regression tests
• stories/ – Storybook stories (.stories.js) plus static JSON & CSS assets for interactive examples
B. Build & Packaging Layer (green)
• Babel (.babelrc) & ESLint (.eslintrc) – transpile + linting
• Webpack (webpack.config.js & .storybook/webpack.config.js) – bundle source into dist and Storybook dev server
• Custom scripts (.scripts/) – mocha_runner.js, prepublish.sh, publish_storybook.sh, etc.
C. Distribution Layer (orange)
• public/ – static demo assets (JSON segmentation files, images) for Storybook & GitHub Pages
• NPM Registry & GitHub Pages – final hosting targets
D. Runtime Environment (purple)
• Consumer Application (any React app) – imports the published bundle
• HTML Canvas & Image Loader – at runtime, the component
1. Loads an image (via URL or local asset)
Relationships & Data Flows
1. Developer writes code & stories →
runs linter/tests (npm test using .scripts/mocha_runner.js) →
compiles/transpiles via Babel → bundles via Webpack →
outputs dist/ artifacts.
2. npm publish (with prepublish.sh) pushes the bundle to the npm registry.
3. publish_storybook.sh deploys the Storybook static site (using public/ assets) to GitHub Pages.
component loads in browser →
Architectural Patterns & Principles
• Single Responsibility: separate folders for source code, tests, stories, and build scripts
• Modular Bundling: UMD/ESM output so the component can be consumed in multiple module systems
• Demo Isolation: Storybook harness isolates examples, static assets, and interactive use cases
• CI/CD Hooks: Scripts folder encapsulates build, test, publish, and demo-deploy steps