Skip to content

Commit 45fec2d

Browse files
authored
Merge pull request #1006 from SonicJs-Org/lane711/sonicjs-dev-sdk
feat(sdk+demo): SonicJS SDK, demo site fixes, cold-start perf
2 parents 05f0c55 + 6a56f34 commit 45fec2d

92 files changed

Lines changed: 7758 additions & 410 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-demo.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Deploy SDK Demo
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'demos/employee-directory/**'
9+
- 'packages/sdk/src/**'
10+
- '.github/workflows/deploy-demo.yml'
11+
workflow_dispatch:
12+
13+
jobs:
14+
deploy:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 15
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20'
26+
cache: 'npm'
27+
28+
- name: Install root dependencies (for SDK workspace)
29+
run: npm ci
30+
31+
- name: Build SDK
32+
run: cd packages/sdk && npm run build
33+
34+
- name: Install demo dependencies
35+
run: cd demos/employee-directory && npm ci
36+
37+
- name: Build demo
38+
run: cd demos/employee-directory && npm run build
39+
env:
40+
VITE_CMS_URL: ${{ secrets.DEMO_CMS_URL }}
41+
42+
- name: Deploy to Cloudflare Pages
43+
run: npx wrangler pages deploy demos/employee-directory/dist --project-name sonicjs-sdk-demo
44+
env:
45+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
46+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

.github/workflows/publish.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
- name: Build core
3636
run: npm run build:core
3737

38+
- name: Build SDK
39+
run: npm run build --workspace=@sonicjs-cms/sdk
40+
3841
- name: Type check
3942
run: npm run type-check
4043

@@ -48,6 +51,16 @@ jobs:
4851
npm publish --workspace=@sonicjs-cms/core --provenance --access public
4952
fi
5053
54+
- name: Publish @sonicjs-cms/sdk
55+
env:
56+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
57+
run: |
58+
if [ "${{ inputs.dry_run }}" = "true" ]; then
59+
npm publish --workspace=@sonicjs-cms/sdk --provenance --access public --dry-run
60+
else
61+
npm publish --workspace=@sonicjs-cms/sdk --provenance --access public
62+
fi
63+
5164
- name: Publish create-sonicjs
5265
env:
5366
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ coverage/
4747
# Claude Code — local settings are per-developer, not shared
4848
.claude/settings.local.json
4949

50+
# Production wrangler config (contains secrets)
51+
wrangler-demo.toml
52+
5053
# IDE
5154
.vscode/settings.json
5255
.idea/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Point to a real SonicJS instance to use live data.
2+
# Leave unset to use built-in mock data.
3+
VITE_CMS_URL=https://cms.example.com
4+
VITE_API_KEY=sk_your_key_here
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
dist/
3+
.env
4+
.env.local
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>SonicJS SDK Demo — Employee Directory</title>
7+
<script src="https://cdn.tailwindcss.com"></script>
8+
<script>
9+
tailwind.config = {
10+
theme: {
11+
extend: {
12+
colors: {
13+
sonic: { DEFAULT: '#34d399', dark: '#059669' }
14+
}
15+
}
16+
}
17+
}
18+
</script>
19+
</head>
20+
<body class="bg-slate-950 text-white antialiased">
21+
<div id="root"></div>
22+
<script type="module" src="/src/main.tsx"></script>
23+
</body>
24+
</html>

0 commit comments

Comments
 (0)