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 .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

This repo uses [changesets](https://github.com/changesets/changesets) for `@syncro/sdk` and `@syncro/shared`.

1. After changing a publishable package, run `npx changeset` and commit the file under `.changeset/`.
2. PRs that touch `sdk/` or `shared/` without a changeset fail CI.
3. Version bumps and changelog entries are generated on the release workflow — do not edit package versions or `CHANGELOG.md` by hand for those packages.
4. Publishing happens only from CI (`CI=true`) with npm provenance. Local `npm publish` is rejected.
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@syncro/backend", "@syncro/client", "@syncro/contracts"]
}
6 changes: 6 additions & 0 deletions .changeset/v2-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@syncro/sdk": minor
"@syncro/shared": minor
---

Dual ESM/CJS SDK builds with subpath exports, generated database and contract types, and changeset-driven releases.
27 changes: 27 additions & 0 deletions .github/workflows/changeset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Changeset

on:
pull_request:
branches: [main, develop]

jobs:
check:
name: Require changeset for sdk/shared
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/setup-node@v7
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci --legacy-peer-deps --ignore-scripts || npm install --legacy-peer-deps --ignore-scripts

- name: Fail when a publishable package changes without a changeset
env:
CHANGESET_BASE: origin/${{ github.base_ref }}
run: npm run check:changeset
33 changes: 33 additions & 0 deletions .github/workflows/generated-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Generated types

on:
pull_request:
branches: [main, develop]
push:
branches: [main]
paths:
- 'supabase/migrations/**'
- 'shared/src/generated/**'
- 'sdk/src/generated/**'
- 'contracts/**'
- 'scripts/generate-db-types.mjs'
- 'scripts/generate-contract-types.mjs'
- 'scripts/check-generated-types.mjs'

jobs:
check-generated:
name: Stale generated types
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci --legacy-peer-deps --ignore-scripts || npm install --legacy-peer-deps --ignore-scripts

- name: Fail if generated types are stale
run: npm run check:generated
75 changes: 75 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Release

on:
push:
branches: [main]
tags:
- "@syncro/sdk@*"
- "@syncro/shared@*"
- "v*"
workflow_dispatch:

concurrency: release-${{ github.ref }}

permissions:
contents: write
id-token: write
pull-requests: write

jobs:
version:
name: Version packages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/setup-node@v7
with:
node-version: "20"
cache: "npm"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci --legacy-peer-deps --ignore-scripts || npm install --legacy-peer-deps --ignore-scripts

- name: Create Version Packages PR
uses: changesets/action@v1
with:
version: npm run version-packages
title: Version packages
commit: Version packages
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish:
name: Publish tagged release
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: "20"
cache: "npm"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci --legacy-peer-deps --ignore-scripts || npm install --legacy-peer-deps --ignore-scripts

- name: Build publishable packages
run: |
npm run generate -w shared
npm run build -w shared
npm run build -w sdk

- name: Publish with provenance
env:
CI: "true"
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: "true"
run: npm run release
55 changes: 55 additions & 0 deletions .github/workflows/sdk-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: SDK package

on:
pull_request:
paths:
- 'sdk/**'
- 'shared/**'
- 'package.json'
- 'package-lock.json'
push:
branches: [main]
paths:
- 'sdk/**'
- 'shared/**'

jobs:
layout:
name: Dual build · publint · tree-shake · size
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci --legacy-peer-deps --ignore-scripts || npm install --legacy-peer-deps --ignore-scripts

- name: Generate types and build SDK
run: |
npm run generate -w shared
npm run build -w shared
npm run build -w sdk

- name: Package layout (publint + ESM/CJS/bundler/node16)
run: npm run check:layout -w sdk

- name: Tree-shake fixture
run: npm run check:tree-shake -w sdk

- name: Published size budget
run: npm run check:size -w sdk

- name: Record size in job summary
if: always()
run: |
{
echo "## @syncro/sdk package size"
echo ""
echo '```'
npm run check:size -w sdk --silent || true
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
78 changes: 78 additions & 0 deletions .github/workflows/turbo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Turbo

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:

permissions:
contents: read
actions: write

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_REMOTE_CACHE_SIGNATURE_KEY: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}

jobs:
turbo:
name: Task graph
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Fetch base branch
if: github.event_name == 'pull_request'
run: git fetch origin ${{ github.base_ref }} --depth=1

- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci --legacy-peer-deps --ignore-scripts || npm install --legacy-peer-deps --ignore-scripts

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
workspaces: contracts

- name: Cache Turbo
uses: actions/cache@v4
with:
path: .turbo
key: turbo-${{ runner.os }}-${{ github.sha }}
restore-keys: |
turbo-${{ runner.os }}-

- name: Run affected tasks (PR)
if: github.event_name == 'pull_request'
run: |
npx turbo run build typecheck test lint \
--filter="...[origin/${{ github.base_ref }}]" \
--summarize \
--cache-dir=.turbo

- name: Run full graph (main)
if: github.event_name != 'pull_request'
run: |
npx turbo run build typecheck test lint \
--summarize \
--cache-dir=.turbo

- name: Report cache hit rate
if: always()
run: node scripts/turbo-cache-summary.mjs
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ Thumbs.db
.cache
.parcel-cache

# Turbo
.turbo
**/.turbo


# Next.js (if used)
.next/
out/
Expand Down
12 changes: 12 additions & 0 deletions contracts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@syncro/contracts",
"version": "1.0.0",
"private": true,
"description": "Soroban contracts workspace wrapper for the monorepo task graph",
"scripts": {
"build": "node ../scripts/run-cargo.mjs build --target wasm32-unknown-unknown --release",
"test": "node ../scripts/run-cargo.mjs test",
"typecheck": "node ../scripts/run-cargo.mjs check --target wasm32-unknown-unknown",
"lint": "node ../scripts/run-cargo.mjs fmt --all -- --check"
}
}
Loading
Loading