mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 19:47:46 -07:00
- Replace the custom Node packaging script with a flat inline step (cp the .proto glob, cp the static files, npm version) so the workflow speaks the same shell idiom as the other workflows. - Promote package.json and README.md to static files under libcockatrice_protocol/npm/ so contributors edit them in-place. - Re-format libcockatrice_protocol/CMakeLists.txt per .cmake-format.json. - Add workflow_dispatch (manual run; optional version input) and timeout-minutes: 10. - Drop --provenance from npm publish: GitHub Packages doesn't attest Sigstore provenance.
30 lines
1 KiB
Markdown
30 lines
1 KiB
Markdown
# @cockatrice/protocol
|
|
|
|
Network protocol artifacts for [Cockatrice](https://github.com/Cockatrice/Cockatrice): the `.proto`
|
|
definitions used by the desktop client, Servatrice, and the webclient, plus the
|
|
authoritative protocol version constant they all share.
|
|
|
|
## Install
|
|
|
|
```sh
|
|
npm install @cockatrice/protocol
|
|
```
|
|
|
|
The package is published to GitHub Packages under the `@cockatrice` scope; consumers
|
|
need an `.npmrc` entry pointing the scope at `https://npm.pkg.github.com` and a
|
|
`GITHUB_TOKEN` with `read:packages`.
|
|
|
|
## Contents
|
|
|
|
- `pb/*.proto` — every protobuf schema file from `libcockatrice_protocol`.
|
|
- `protocol_version.json` — `{ "protocolVersion": <int> }`. Identical to the file
|
|
the C++ build reads via `configure_file()`.
|
|
|
|
## Usage (TypeScript)
|
|
|
|
```ts
|
|
import protocolVersionInfo from "@cockatrice/protocol/protocol_version.json" with { type: "json" };
|
|
export const PROTOCOL_VERSION = protocolVersionInfo.protocolVersion;
|
|
```
|
|
|
|
Point your protobuf code-generator (e.g. buf) at `node_modules/@cockatrice/protocol/pb`.
|