**feat(demo): add GitHub Pages demo script and update deployment workflow**

### Changes:
- **`demo/simplified-augmentations-gh-pages.js`**:
  - Added a new demo script showcasing simplified augmentations for GitHub Pages.
  - Includes examples for static and streaming data processing, WebSocket support, and dynamic augmentation loading.

- **`README.md`**:
  - Updated the demo link to point directly to `https://soulcraft-research.github.io/brainy/`.

- **`.github/workflows/deploy-demo.yml`**:
  - Enhanced the deployment workflow to include the `simplified-augmentations-gh-pages.js` file as the GitHub Pages demo entry point.
  - Added steps to copy and prepare required `dist` files during the build process.

- **`demo/index.html`**:
  - Dynamically adjusted the import path for the Brainy library to support both local and CDN environments.
  - Reformatted code for readability and alignment with deployment needs.

### Purpose:
Introduced a tailored demonstration script for GitHub Pages to highlight Brainy's streamlined augmentation features. Enhanced the deployment pipeline for better integration and seamless live demo experience.
This commit is contained in:
David Snelling 2025-06-23 11:26:11 -07:00
parent 3e8281a2c9
commit efababe397
4 changed files with 412 additions and 8 deletions

View file

@ -1091,8 +1091,15 @@ await db.init()
</div>
<script type="module">
// Import Brainy library directly as a module
import { BrainyData, NounType, VerbType } from 'https://cdn.jsdelivr.net/npm/@soulcraft/brainy/dist/unified.js'
// Dynamically determine the import path based on the environment
// If running on GitHub Pages, use the local files, otherwise use the CDN
const isGitHubPages = window.location.hostname.includes('github.io')
const importPath = isGitHubPages
? './dist/unified.js'
: 'https://cdn.jsdelivr.net/npm/@soulcraft/brainy/dist/unified.js'
// Dynamic import to handle different environments
const { BrainyData, NounType, VerbType } = await import(importPath)
// Make BrainyData and types available globally
window.BrainyData = BrainyData
@ -3363,7 +3370,7 @@ await db.init()
function updateSearchVisualization(results) {
// This function is now disabled as per requirements to remove the visual graph
return;
return
// Create SVG container
const svg = d3.select(graphContainer)
@ -3417,8 +3424,8 @@ await db.init()
const currentTransform = d3.zoomTransform(svg.node())
svg.transition()
.duration(300)
.call(zoomBehavior.transform,
d3.zoomIdentity.translate(currentTransform.x, currentTransform.y).scale(currentTransform.k * 1.3))
.call(zoomBehavior.transform,
d3.zoomIdentity.translate(currentTransform.x, currentTransform.y).scale(currentTransform.k * 1.3))
})
}
@ -3427,8 +3434,8 @@ await db.init()
const currentTransform = d3.zoomTransform(svg.node())
svg.transition()
.duration(300)
.call(zoomBehavior.transform,
d3.zoomIdentity.translate(currentTransform.x, currentTransform.y).scale(currentTransform.k / 1.3))
.call(zoomBehavior.transform,
d3.zoomIdentity.translate(currentTransform.x, currentTransform.y).scale(currentTransform.k / 1.3))
})
}