diff --git a/Justfile b/Justfile index b393567..f714edb 100644 --- a/Justfile +++ b/Justfile @@ -30,10 +30,29 @@ build-server: build-web: bun run --filter @crate/web build +# Run all generate operations +generate: generate-lexicons generate-api +publish: publish-lexicons + # Generate only the ATProto Lexicons from Rust. generate-lexicons: cargo run --locked --quiet -p crate-protocol --bin export-lexicons -- lexicons +# Publish generated schemas with the signed-in Goat account (use create for first publication). +publish-lexicons operation="update": generate-lexicons + #!/usr/bin/env bash + set -euo pipefail + case "$1" in create|update) ;; *) echo 'Expected create or update' >&2; exit 1 ;; esac + command -v goat >/dev/null + command -v jq >/dev/null + record=$(mktemp) + trap 'rm -f "$record"' EXIT + for schema in lexicons/network/crate/*.json; do + id=$(jq -er '.id' "$schema") + jq '. + {"$type": "com.atproto.lexicon.schema"}' "$schema" > "$record" + goat record "$1" --no-validate --rkey "$id" "$record" + done + # Generate Lexicons, OpenAPI, and TypeScript/Swift clients. generate-api: bun scripts/generate-api.ts diff --git a/README.md b/README.md index bc8efdf..3ee37dc 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,12 @@ just generate-api just check-contracts ``` +Publish the generated schemas with `just publish-lexicons` after signing into +Goat as the schema publisher. This requires Goat and jq, regenerates the Lexicons, +and updates their public records. Use `just publish-lexicons create` for first +publication. It uses Goat's generic record command with `--no-validate` because +`goat lex publish` does not yet support the alpha Space schema. + Full contract generation/checking requires Swift 6.1 or newer. Generators and their dependencies are pinned. Generated clients are checked in as source, so web builds and root TypeScript checks do not require prebuilding package types. The running Rust server exposes its API documentation at [API docs](http://127.0.0.1:3030/docs). ## Verification and Jujutsu diff --git a/infra/Pulumi.prod.yaml b/infra/Pulumi.prod.yaml index 9e05f16..677648d 100644 --- a/infra/Pulumi.prod.yaml +++ b/infra/Pulumi.prod.yaml @@ -1,2 +1,4 @@ +config: + did: did:plc:hogkukbuqypodrkdgyvrw2ru environment: - main diff --git a/infra/Pulumi.yaml b/infra/Pulumi.yaml index 6275fdf..e894b58 100644 --- a/infra/Pulumi.yaml +++ b/infra/Pulumi.yaml @@ -2,4 +2,3 @@ name: crate runtime: bun config: cloudflareZoneId: 1cf8953d2af7de48fa376ee70b36d88b - did: did:plc:hogkukbuqypodrkdgyvrw2ru