- **Storage**: Removed redundant storage implementation files from `/storage` directory while retaining necessary `baseStorage.ts`. Verified no impact on functionality with passing tests. - **Documentation**: Consolidated multiple overlapping `.md` files into a single `statistics.md` file. Added structured sections for easier reference. Applied markdown naming conventions for clarity. - **Project**: Introduced `CHANGES_SUMMARY.md` and `MARKDOWN_CONVENTIONS.md` to document changes and naming guidelines, improving project organization. Updated `demo.md` file naming for consistency. **Purpose**: Simplify the codebase by removing duplicates, enhance maintainability through consolidated and structured documentation, and improve developer experience with clear guidelines and better organization.
1.8 KiB
Running the Brainy Demo
The Brainy interactive demo showcases the library's features in a web browser. Follow these steps to run it:
Prerequisites
- Make sure you have Node.js installed (version 24.4.0 or higher)
- Ensure the project is built (run both
npm run buildandnpm run build:browser)
Running the Demo
Option 1: Using the npm script (recommended)
Run the following command from the project root:
npm run demo
This will start an HTTP server and automatically open the demo in your default browser.
Option 2: Manual setup
- Start an HTTP server in the project root:
npx http-server
- Open your browser and navigate to: http://localhost:8080/demo/index.html
Troubleshooting
If you see the error "Could not load Brainy library. Please ensure the project is built and served over HTTP", check the following:
- Make sure you've built the project with
npm run build && npm run build:browser - Ensure you're accessing the demo through HTTP (not by opening the file directly)
- Check your browser's console for additional error messages
If issues persist, try clearing your browser cache or using a private/incognito window.
Build Process
The Brainy library uses a two-step build process:
npm run build- Compiles TypeScript files to JavaScript (used for Node.js environments)npm run build:browser- Creates a browser-compatible bundle using Rollup
You can run both steps together with:
npm run build && npm run build:browser
Or simply use the demo script which does this for you:
npm run demo
The browser bundle is created from src/unified.ts, which provides environment detection and adapts to browser,
Node.js, or serverless environments. This unified approach ensures that the library works correctly across all
environments.