cd aitrace_viewer
yarn build
This will compile the viewer and output to docs/app/ ready for GitHub Pages.
main (or your default)/docsYour site will be live at: https://<username>.github.io/<repository>/app/
mytrace/
├── aitrace_viewer/ # Source code (Preact + Vite)
│ ├── src/
│ ├── public/samples/ # Sample JSONL files
│ ├── vite.config.ts # Build configuration
│ └── package.json
│
├── docs/ # GitHub Pages root
│ ├── app/ # Built application (generated)
│ │ ├── index.html
│ │ ├── assets/ # Bundled JS/CSS
│ │ └── samples/ # Copied from public/
│ ├── .nojekyll # Prevents Jekyll processing
│ └── README.md # GitHub Pages documentation
│
└── aitrace/ # Python tracing library
The build is configured in aitrace_viewer/vite.config.ts:
{
base: './', // Relative paths for flexibility
build: {
outDir: resolve(__dirname, '../docs/app'), // Output to docs/app/
emptyOutDir: true, // Clean before build
}
}
If deploying to a subdirectory, update the base in vite.config.ts:
// For: https://example.com/mytrace/app/
base: "/mytrace/app/";
// For: https://example.com/ (root)
base: "/";
// For: Flexible hosting (default)
base: "./";
To add new sample traces:
.jsonl or .ndjson file to aitrace_viewer/public/samples/aitrace_viewer/public/samples/config.json:{
"samples": [
{
"id": "my-sample",
"name": "My Sample Trace",
"description": "Description shown in UI",
"filename": "my-sample.jsonl",
"icon": "bi-diagram-3"
}
]
}
cd aitrace_viewer && yarn buildcd aitrace_viewer
yarn dev
Opens at http://localhost:5173 with hot reload.
cd aitrace_viewer
yarn build
yarn preview
Opens at http://localhost:4173 serving the built version.
For automatic deployment, add a GitHub Action:
# .github/workflows/deploy.yml
name: Deploy to GitHub Pages
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: cd aitrace_viewer && yarn install
- run: cd aitrace_viewer && yarn build
- uses: actions/upload-pages-artifact@v2
with:
path: docs/app
- uses: actions/deploy-pages@v2
base setting in vite.config.ts.nojekyll exists in docs/aitrace_viewer/public/samples/config.json is valid JSON