-
Notifications
You must be signed in to change notification settings - Fork 41
Build all examples #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alexwarren
merged 14 commits into
textadventures:main
from
alexwarren:claude/link-packaged-examples-qJS9J
Jan 15, 2026
Merged
Build all examples #151
alexwarren
merged 14 commits into
textadventures:main
from
alexwarren:claude/link-packaged-examples-qJS9J
Jan 15, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Created site/scripts/build-examples.ts to automatically package all .squiffy examples using the packager
- Added build:examples script to site package.json that runs before main build
- Added dependencies: tsx, glob, and @textadventures/squiffy-packager to site
- Updated examples.mdx to include "Play" links that open packaged versions in new tabs
- Examples are output to site/public/examples/{name}/ as standalone HTML/JS/CSS
- Build script handles errors gracefully, continuing if individual examples fail
- 23 of 24 examples successfully packaged (animate example missing ui.js dependency)
- Fixed externalFiles.getContent() to resolve relative paths against basePath - This fixes the animate example which uses @ui ui.js (relative path) - All 24 examples now build successfully (was 23/24, now 24/24) - Added examples/README.md explaining how to play examples online and locally - README links to squiffystory.com/examples for easy access to built versions
- Created cli/src/index.ts to export externalFiles and other utilities - Updated CLI package.json to export library functions via main/exports fields - Fixed externalFiles.getContent() to resolve relative paths in CLI package - Updated site build script to import externalFiles from @textadventures/squiffy-cli - Removed duplicated externalFiles implementation from site/scripts/build-examples.ts - All 24 examples build successfully with shared implementation This eliminates code duplication and ensures consistent behavior across the CLI and site build processes.
- Modified packageExample() to extract and return story title using getUiInfo() - Added generateIndexPage() function to create a clean HTML index of all examples - Index page features: - Responsive card layout with hover effects - Shows story title and folder path for each example - Alphabetically sorted examples - Links to squiffystory.com and documentation - Examples are now browsable at /examples/ with links to each story - Index page is automatically regenerated on each build
- Deduplicate examples by directory name before generating index
(fixes issue where directories with multiple .squiffy files appeared twice)
- Changed all links to use explicit index.html paths instead of directory paths
(fixes issue in dev mode where directory-only links don't work)
- Index now shows 22 unique examples instead of 24 with duplicates
- Links work correctly in both npm run dev and production builds
Changes:
- site/scripts/build-examples.ts: Filter unique examples before generating index
- site/scripts/build-examples.ts: Use ${ex.name}/index.html in href
- site/src/content/docs/examples.mdx: Update play links to use index.html
- Created examples/examples.json to explicitly list which examples to build - Excludes test examples (warnings/) that aren't meant to be playable - Handles multi-file examples correctly (import/test.squiffy is entry point) - Build script now reads manifest instead of globbing for all .squiffy files - Reduced from 24 builds (with duplicates) to 20 unique examples - Updated examples/README.md to document the configuration approach Benefits: - Explicit control over published examples - No more duplicates from multi-file directories - Can add metadata (descriptions, featured flag) for future use - Clear entry point for examples with multiple .squiffy files
- Added public/ to tsconfig.json exclude list - Prevents astro check from checking generated example .js files - Reduces build warnings from hundreds to just a few - Generated files in public/examples/ are build artifacts, not source code This eliminates the TypeScript warnings about the packaged example files during the site build process.
The astro check command was consuming excessive memory (~4GB) when analyzing the generated JavaScript files in public/examples/, causing the build to crash. TypeScript errors are still caught during development by the IDE and Astro dev server. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Sort examples with featured items at top, then alphabetically - Display description from examples.json for each example card - Add visual styling for featured examples (orange border, badge) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove visual distinction for featured examples (keep sort order only) - Add "Play" and "View Source" links to each example card - Source links point to GitHub examples directory Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR builds all the Squiffy example files and makes them available via the website.