Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# When merging changes under these paths to `production`, require review from the
# Dashboard team.
/javascript/ @browserbase/dashboard
/scripts/fetch-playground-typescript-dirs.mjs @browserbase/dashboard
/scripts/validate-playground-templates.mjs @browserbase/dashboard
/scripts/playground-ci.mjs @browserbase/dashboard
/scripts/lib/playground-checks.mjs @browserbase/dashboard
/.github/workflows/playground-production.yml @browserbase/dashboard
60 changes: 60 additions & 0 deletions .github/workflows/playground-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Validates TypeScript → JavaScript builds for templates exposed by the public
# templates API (playgroundRunnable). Intended for the `production` branch workflow
# described in https://github.com/browserbase/templates (branch protection: require
# this check + Dashboard team review before merge).
#
# Set TEMPLATES_API_URL to override the default public endpoint (e.g. staging).

name: Playground templates (production)

on:
pull_request:
branches:
- production
push:
branches:
- production
workflow_dispatch:

permissions:
contents: write

jobs:
playground-templates:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Clean javascript output directory
run: rm -rf javascript && mkdir -p javascript

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build and validate playground TypeScript templates
env:
TEMPLATES_API_URL: ${{ vars.TEMPLATES_API_URL }}
run: pnpm run ci:playground

- name: Commit and push playground javascript (push to production only)
if: github.event_name == 'push'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A javascript/
if git diff --staged --quiet; then
echo "No javascript changes to commit."
else
git commit -m "chore: regenerate playground javascript templates"
git push
fi
60 changes: 60 additions & 0 deletions .github/workflows/playground-test-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Validates TypeScript → JavaScript builds for templates exposed by the public
# templates API (playgroundRunnable). Intended for the `test-production` branch workflow
# described in https://github.com/browserbase/templates (branch protection: require
# this check + Dashboard team review before merge).
#
# Set TEMPLATES_API_URL to override the default public endpoint (e.g. staging).

name: Playground templates (test production)

on:
pull_request:
branches:
- test-production
push:
branches:
- test-production
workflow_dispatch:

permissions:
contents: write

jobs:
playground-templates:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Clean javascript output directory
run: rm -rf javascript && mkdir -p javascript

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build and validate playground TypeScript templates
env:
TEMPLATES_API_URL: ${{ vars.TEMPLATES_API_URL }}
run: pnpm run ci:playground

- name: Commit and push playground javascript (push to test-production only)
if: github.event_name == 'push'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A javascript/
if git diff --staged --quiet; then
echo "No javascript changes to commit."
else
git commit -m "chore: regenerate playground javascript templates"
git push
fi
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ Templates use the Model Gateway to route LLM requests -- you only need your `BRO

Each template's README contains detailed installation steps, environment variable requirements, and troubleshooting guides.

### TypeScript and generated JavaScript

- **Source of truth:** edit templates under `typescript/`. The `javascript/` tree is generated output, not authored by hand for day-to-day changes.
- **Local only:** run `pnpm run build:javascript` when you want a full mirror of `typescript/` into `javascript/` on your machine (for example to smoke-test the transpiler or compare JS output). There is **no** GitHub Actions workflow that builds the full tree into the repo anymore.
- **Playground releases:** the `production` branch is updated by CI (`.github/workflows/playground-production.yml`), which builds and commits **only** templates that are playground-runnable per the public templates API, then validates them.

## Resources

### Documentation
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"private": true,
"type": "module",
"scripts": {
"build:javascript": "node scripts/build-javascript.mjs",
"ci:playground": "node scripts/playground-ci.mjs",
"validate:playground": "node scripts/validate-playground-templates.mjs",
"check:readme-template-index": "node scripts/check-readme-template-index.mjs",
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md,yml,yaml}\"",
"format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,json,md,yml,yaml}\"",
Expand All @@ -25,6 +28,7 @@
"husky": "^9.1.7",
"lint-staged": "^16.2.7",
"prettier": "^3.2.5",
"typescript": "^5.9.3",
"typescript-eslint": "^8.50.1"
},
"packageManager": "pnpm@9.0.0",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading