Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0f86a3b
inteoduce crossws to support cf workers
mickmister Aug 12, 2025
713ad82
cf worker works but craps out due to CPU time
mickmister Aug 12, 2025
1b580cc
remove buildServer function from build.ts
mickmister Aug 12, 2025
0eb2539
fix cf worker entrypoint to do more initialization before fetch function
mickmister Aug 12, 2025
d171a49
add PUBLIC_USE_WEBSOCKETS_FOR_RPC build var and introduce import.meta…
mickmister Aug 13, 2025
6c8426d
remove claude local settings file
mickmister Aug 16, 2025
cb06666
cf workers is mostly working. websockets are giving some more trouble…
mickmister Aug 16, 2025
954b259
make sure server module callback is called after engine is initialized
mickmister Aug 21, 2025
6906cf3
use partyserver in cf-workers entrypoint
mickmister Sep 17, 2025
9ab8259
Merge branch 'main' into refactor-springboard-server
mickmister Sep 17, 2025
474e554
fix workflow
mickmister Sep 17, 2025
17bf810
change how we invoke sb cli in workflow
mickmister Sep 17, 2025
f2a8d4e
fix tauri build
mickmister Sep 17, 2025
44702ac
fix cf workflow
mickmister Sep 17, 2025
065590e
fix tauri build
mickmister Sep 17, 2025
15cb513
fix browser platform entrypoint path
mickmister Sep 17, 2025
7f60de9
fix pkg binary path for tauri
mickmister Sep 17, 2025
c978a20
remove mock pr preview comment
mickmister Sep 17, 2025
118e0c3
remove partykit library
mickmister Sep 17, 2025
7040a23
try cf deploy in ci
mickmister Sep 17, 2025
4b62074
try again
mickmister Sep 17, 2025
e2391e5
make ci job say dry run in name
mickmister Sep 23, 2025
e4fc6fa
fix middleware and add middleware example to tic-tac-toe app
mickmister Sep 23, 2025
45b6738
ignore empty interface
mickmister Sep 24, 2025
50ced6f
fix createActions types
mickmister Sep 24, 2025
3d36ac2
fix deps
mickmister Sep 24, 2025
04224fc
fix createAction passing of middleware results
mickmister Sep 24, 2025
a527a84
add crypto library alias
mickmister Sep 25, 2025
3f7ceb3
Address review feedback: clean up code and fix structure
claude[bot] Sep 25, 2025
52f19fa
fix cf workers deployment by using `party: 'my-server'`
mickmister Nov 19, 2025
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
101 changes: 101 additions & 0 deletions .github/workflows/deploy-cf-worker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Build Cloudflare Workers

on:
workflow_dispatch:
inputs:
deploy:
description: 'Deploy to production (true) or dry run (false)'
required: true
type: boolean
default: false
site_url:
description: 'Deployment URL'
required: true
type: string
default: 'https://app.jam.tools'
pull_request:
branches: [main]
push:
branches: [main]

env:
NODE_VERSION: '20'

jobs:
determine-mode:
runs-on: ubuntu-latest
outputs:
mode: ${{ steps.deploy-mode.outputs.mode }}
job-name: ${{ steps.deploy-mode.outputs.job-name }}
steps:
- name: Determine deployment mode
id: deploy-mode
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ "${{ github.event.inputs.deploy }}" == "true" ]]; then
echo "mode=deploy" >> $GITHUB_OUTPUT
echo "job-name=Build and Deploy" >> $GITHUB_OUTPUT
else
echo "mode=dry-run" >> $GITHUB_OUTPUT
echo "job-name=Build (dry run)" >> $GITHUB_OUTPUT
fi
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "mode=deploy" >> $GITHUB_OUTPUT
echo "job-name=Build and Deploy" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "mode=deploy" >> $GITHUB_OUTPUT
echo "job-name=Build and Deploy" >> $GITHUB_OUTPUT
fi

build-and-deploy:
needs: determine-mode
runs-on: ubuntu-latest
name: ${{ needs.determine-mode.outputs.job-name }}

steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.13.2
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install modules
run: pnpm i

- name: Build application
run: |
export PUBLIC_SITE_URL="${{ secrets.CLOUDFLARE_DEPLOYMENT_URL }}"
cd apps/jamtools
npx tsx ../../packages/springboard/cli/src/cli.ts build ./modules/index.ts --platforms cf-workers
env:
PUBLIC_SITE_URL: ${{ secrets.CLOUDFLARE_DEPLOYMENT_URL }}

- name: Deploy (Dry Run)
if: needs.determine-mode.outputs.mode == 'dry-run'
run: |
cd apps/jamtools/dist/cf-workers
npx wrangler deploy --dry-run

- name: Deploy (Production)
if: needs.determine-mode.outputs.mode == 'deploy'
run: |
cd apps/jamtools/dist/cf-workers
npx wrangler deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}

- name: Upload build artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: cf-workers-build-${{ github.sha }}
path: |
dist/cf-workers/
!dist/cf-workers/node_modules
retention-days: 7
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ esbuild_meta.json
stats.html
games
platform-examples

.claude/settings.local.json
1 change: 1 addition & 0 deletions apps/jamtools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.wrangler
15 changes: 10 additions & 5 deletions apps/jamtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@
"name": "jamtools",
"version": "1.0.0",
"main": "index.js",
"scripts": {},
"scripts": {
"build-cf": "rm -rf dist && PUBLIC_USE_WEBSOCKETS_FOR_RPC=true npx tsx ../../packages/springboard/cli/src/cli.ts build ./modules/index.ts --platforms cf-workers,main",
"deploy-cf": "npm run build-cf && npx wrangler deploy"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"react-router-dom": "catalog:",
"springboard": "workspace:*",
"@jamtools/core": "workspace:*",
"@jamtools/features": "workspace:*",
"@springboardjs/platforms-browser": "workspace:*",
"@springboardjs/platforms-node": "workspace:*",
"@springboardjs/shoelace": "workspace:*"
"@springboardjs/shoelace": "workspace:*",
"react-router-dom": "catalog:",
"springboard": "workspace:*"
},
"devDependencies": {
"springboard-cli": "workspace:*"
"@types/node": "catalog:",
"springboard-cli": "workspace:*",
"wrangler": "4.10.0"
}
}
6 changes: 5 additions & 1 deletion apps/small_apps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@
"version": "0.0.1-autogenerated",
"main": "index.js",
"scripts": {
"dev": "sb dev ./tic_tac_toe/tic_tac_toe.tsx",
"check-types": "tsc --noEmit"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"springboard": "workspace:*",
"@jamtools/core": "workspace:*",
"@jamtools/features": "workspace:*",
"@springboardjs/platforms-browser": "workspace:*",
"@springboardjs/platforms-node": "workspace:*",
"hono": "catalog:",
"react": "catalog:",
"react-dom": "catalog:",
"springboard": "workspace:*",
"springboard-cli": "workspace:*"
},
"devDependencies": {
"@types/node": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:"
}
Expand Down
36 changes: 35 additions & 1 deletion apps/small_apps/tic_tac_toe/tic_tac_toe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,38 @@ import React from 'react';
import springboard from 'springboard';

import './tic_tac_toe.css';
import serverRegistry from 'springboard-server';

type MiddlewareValue = {
user_id: string;
}

declare module 'springboard/engine/module_api' {
interface RpcMiddlewareResults {
user_id: string;
}
}

// @platform "node"
serverRegistry.registerServerModule(async (api) => {
const {setCookie, getCookie} = await import('hono/cookie');

api.hooks.registerRpcMiddleware(async (c): Promise<MiddlewareValue> => {
const cookie = getCookie(c);
if (cookie.user_id) {
return {
user_id: cookie.user_id,
};
}

const newUserId = Math.random().toString().substring(2);
setCookie(c, 'user_id', newUserId);
return {
user_id: newUserId,
};
});
});
// @platform end

type Cell = 'X' | 'O' | null;
type Board = Cell[][];
Expand Down Expand Up @@ -58,7 +90,9 @@ springboard.registerModule('TicTacToe', {}, async (moduleAPI) => {
const scoreState = await moduleAPI.statesAPI.createPersistentState<Score>('score', {X: 0, O: 0, stalemate: 0});

const actions = moduleAPI.createActions({
clickedCell: async (args: {row: number, column: number}) => {
clickedCell: async (args: {row: number, column: number}, c) => {
console.log('in action', c);
console.log(c?.user_id.length);
if (winnerState.getState()) {
return;
}
Expand Down
9 changes: 9 additions & 0 deletions apps/small_apps/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": {
// "~/*": ["../../packages/jamtools/*"],
},
"baseUrl": "."
}
}
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,20 @@
"fix": "TURBO_NO_UPDATE_NOTIFIER=true turbo run fix",
"ci": "NODE_MODULES_PARENT_FOLDER=$PWD TURBO_NO_UPDATE_NOTIFIER=true turbo run lint check-types build test",
"heroku-postbuild": "NODE_ENV=production npm run build-saas",
"splash-screen-app": "npx tsx packages/springboard/cli/src/cli.ts dev ./apps/small_apps/app_with_splash_screen/app_with_splash_screen.tsx",
"jamtools": "npx tsx packages/springboard/cli/src/cli.ts dev ./apps/jamtools/modules/index.ts",
"jamtools-cf": "npx tsx packages/springboard/cli/src/cli.ts build ./apps/jamtools/modules/index.ts --platforms cf-workers",
"build-desktop": "RUN_SIDECAR_FROM_WEBVIEW=true npx tsx packages/springboard/cli/src/cli.ts build ./apps/jamtools/modules/index.ts --platforms desktop",
"build-all": "RUN_SIDECAR_FROM_WEBVIEW=true npx tsx packages/springboard/cli/src/cli.ts build ./apps/small_apps/empty_app/index.ts --platforms all",
"splash-screen-app": "npx tsx packages/springboard/cli/src/cli.ts dev ./apps/small_apps/app_with_splash_screen/app_with_splash_screen.tsx"
"build-all": "RUN_SIDECAR_FROM_WEBVIEW=true npx tsx packages/springboard/cli/src/cli.ts build ./apps/small_apps/empty_app/index.ts --platforms all"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@jamtools/core": "workspace:*",
"@springboardjs/platforms-browser": "workspace:*",
"@springboardjs/platforms-cf-workers": "workspace:*",
"@springboardjs/platforms-node": "workspace:*",
"@springboardjs/platforms-partykit": "workspace:*",
"@springboardjs/platforms-tauri": "workspace:*",
"@springboardjs/plugin-svelte": "workspace:*",
"@testing-library/jest-dom": "^6.4.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export class MacroModule implements Module<MacroConfigState> {

initialize = async () => {
const registeredMacroCallbacks = (macroTypeRegistry.registerMacroType as unknown as {calls: CapturedRegisterMacroTypeCall[]}).calls || [];
macroTypeRegistry.registerMacroType = this.registerMacroType;

for (const macroType of registeredMacroCallbacks) {
this.registerMacroType(...macroType);
Expand Down
2 changes: 2 additions & 0 deletions packages/jamtools/features/components/QRCode.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';

// @platform "browser"
import QRCodeLibrary from 'qrcode';
// @platform end

type Props = {
url: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';

// @platform "browser"
import QRCode from 'qrcode';
// @platform end

export const UltimateGuitarQRCode = () => {
React.useEffect(() => {
Expand Down
1 change: 0 additions & 1 deletion packages/springboard/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"build-empty-jamtools-app": "npx tsx src/cli.ts build ../../../apps/small_apps/empty_jamtools_app/index.ts --platforms browser_offline",
"build-empty-jamtools-app-desktop": "npx tsx src/cli.ts build ../../../apps/small_apps/empty_jamtools_app/index.ts --platforms desktop",
"build-empty-jamtools-app-all": "npx tsx src/cli.ts build ../../../apps/small_apps/empty_jamtools_app/index.ts --platforms all",
"build-partykit": "ESBUILD_OUT_DIR=../platforms/partykit/dist npx tsx src/cli.ts build ../../../apps/small_apps/handraiser/index.ts --platforms partykit",
"dev": "npm run build -- --watch",
"dev-dev": "npx tsx src/cli.ts dev ../../../apps/small_apps/handraiser/index.ts",
"clean": "rm -rf dist",
Expand Down
Loading