mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-16 04:37:55 -04:00
Fix up GitHub files related to TypeScript SDK (#2943)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
|
||||
"changelog": [
|
||||
"@changesets/changelog-github",
|
||||
{ "repo": "clockworklabs/spacetimedb-typescript-sdk" }
|
||||
{ "repo": "clockworklabs/SpacetimeDB" }
|
||||
],
|
||||
"commit": false,
|
||||
"fixed": [],
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
## Description of Changes
|
||||
|
||||
_Describe what has been changed, any new features or bug fixes_
|
||||
|
||||
## API
|
||||
|
||||
- [ ] This is an API breaking change to the SDK
|
||||
|
||||
_If the API is breaking, please state below what will break_
|
||||
|
||||
## Requires SpacetimeDB PRs
|
||||
|
||||
_List any PRs here that are required for this SDK change to work_
|
||||
|
||||
## Testing
|
||||
|
||||
_Write instructions for a test that you performed for this PR_
|
||||
|
||||
- [ ] Describe a test for this PR that you have completed
|
||||
@@ -1 +0,0 @@
|
||||
master
|
||||
@@ -1,41 +0,0 @@
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.7
|
||||
run_install: true
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v4
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Lint
|
||||
run: pnpm lint
|
||||
@@ -1,146 +0,0 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
compile-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.7
|
||||
run_install: true
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v4
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Compile
|
||||
run: pnpm compile
|
||||
|
||||
- name: Run sdk tests
|
||||
working-directory: packages/sdk
|
||||
run: pnpm test
|
||||
|
||||
# - name: Extract SpacetimeDB branch name from file
|
||||
# id: extract-branch
|
||||
# run: |
|
||||
# # Define the path to the branch file
|
||||
# BRANCH_FILE=".github/spacetimedb-branch.txt"
|
||||
|
||||
# # Default to master if file doesn't exist
|
||||
# if [ ! -f "$BRANCH_FILE" ]; then
|
||||
# echo "::notice::No SpacetimeDB branch file found, using 'master'"
|
||||
# echo "branch=master" >> $GITHUB_OUTPUT
|
||||
# exit 0
|
||||
# fi
|
||||
|
||||
# # Read and trim whitespace from the file
|
||||
# branch=$(cat "$BRANCH_FILE" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
|
||||
# # Fallback to master if empty
|
||||
# if [ -z "$branch" ]; then
|
||||
# echo "::warning::SpacetimeDB branch file is empty, using 'master'"
|
||||
# branch="master"
|
||||
# fi
|
||||
|
||||
# echo "branch=$branch" >> $GITHUB_OUTPUT
|
||||
# echo "Using SpacetimeDB branch from file: $branch"
|
||||
|
||||
- name: Checkout SpacetimeDB
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: clockworklabs/SpacetimeDB
|
||||
# ref: ${{ steps.extract-branch.outputs.branch }}
|
||||
path: SpacetimeDB
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Cache Rust dependencies
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: SpacetimeDB/modules/quickstart-chat
|
||||
shared-key: quickstart-chat-test
|
||||
|
||||
- name: Install SpacetimeDB CLI from the local checkout
|
||||
run: |
|
||||
cargo install --force --path SpacetimeDB/crates/cli --locked --message-format=short
|
||||
cargo install --force --path SpacetimeDB/crates/standalone --locked --message-format=short
|
||||
# Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules).
|
||||
rm -f $HOME/.cargo/bin/spacetime
|
||||
ln -s $HOME/.cargo/bin/spacetimedb-cli $HOME/.cargo/bin/spacetime
|
||||
# Clear any existing information
|
||||
spacetime server clear -y
|
||||
env:
|
||||
# Share the target directory with our local project to avoid rebuilding same SpacetimeDB crates twice.
|
||||
CARGO_TARGET_DIR: SpacetimeDB/modules/quickstart-chat/target
|
||||
|
||||
- name: Generate client bindings
|
||||
working-directory: SpacetimeDB/modules/quickstart-chat
|
||||
run: |
|
||||
spacetime generate --lang typescript --out-dir ../../../examples/quickstart-chat/src/module_bindings
|
||||
pnpm lint --write
|
||||
|
||||
- name: Check for changes
|
||||
run: |
|
||||
# This was copied from SpacetimeDB/tools/check-diff.sh.
|
||||
# It's required because `spacetime generate` creates lines with the SpacetimeDB commit
|
||||
# version, which would make this `git diff` check very brittle if included.
|
||||
PATTERN='^// This was generated using spacetimedb cli version.*'
|
||||
if ! git diff --exit-code --ignore-matching-lines="$PATTERN" -- examples/quickstart-chat/src/module_bindings; then
|
||||
echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# - name: Start SpacetimeDB
|
||||
# run: |
|
||||
# spacetime start &
|
||||
# disown
|
||||
|
||||
# - name: Publish module to SpacetimeDB
|
||||
# working-directory: SpacetimeDB/modules/quickstart-chat
|
||||
# run: |
|
||||
# spacetime logout && spacetime login --server-issued-login local
|
||||
# spacetime publish -s local quickstart-chat -c -y
|
||||
|
||||
# - name: Publish module to SpacetimeDB
|
||||
# working-directory: SpacetimeDB/modules/quickstart-chat
|
||||
# run: |
|
||||
# spacetime logs quickstart-chat
|
||||
|
||||
- name: Check that quickstart-chat builds
|
||||
working-directory: examples/quickstart-chat
|
||||
run: pnpm build
|
||||
|
||||
# - name: Run quickstart-chat tests
|
||||
# working-directory: examples/quickstart-chat
|
||||
# run: pnpm test
|
||||
#
|
||||
# # Run this step always, even if the previous steps fail
|
||||
# - name: Print rows in the user table
|
||||
# if: always()
|
||||
# run: spacetime sql quickstart-chat "SELECT * FROM user"
|
||||
@@ -1,3 +1,7 @@
|
||||
# Migration note
|
||||
|
||||
We are in the process of moving from the `spacetimedb-typescript-sdk` repo to the `sdks/typescript` subdirectory of [SpacetimeDB](https://github.com/clockworklabs/SpacetimeDB). **Any new changes should be made there**. The `spacetimedb-typescript-sdk` repo will only be updated on release. Apologies in advance for any sharp edges while the migration is in progress.
|
||||
|
||||
# Notes for maintainers
|
||||
|
||||
The directory `packages/sdk/src/client_api` is generated from [the SpacetimeDB client-api-messages](https://github.com/clockworklabs/SpacetimeDB/tree/master/crates/client-api-messages).
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
`@clockworklabs/spacetimedb-sdk` is a TypeScript SDK for SpacetimeDB.
|
||||
|
||||
Source code can be found here on [GitHub](https://github.com/clockworklabs/spacetimedb-typescript-sdk/blob/main/packages/sdk).
|
||||
Source code can be found here on [GitHub](https://github.com/clockworklabs/SpacetimeDB/blob/master/sdks/typescript/packages/sdk).
|
||||
|
||||
Reference in New Issue
Block a user