Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature Request
about: Suggest a new feature or improvement for the TypeScript SDK for Zerobus.
title: "[FEATURE] "
labels: ''
assignees: ''

---

**Problem Statement**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Proposed Solution**
A clear and concise description of what you want to happen.

**Additional Context**
Add any other context, references or screenshots about the feature request here.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: SDK Issue
about: Use this to report an issue with the TypeScript SDK for Zerobus.
title: "[ISSUE] "
labels: ''
assignees: ''

---

**Description**
A clear and concise description of what the bug is.

**Reproduction**
A minimal code sample demonstrating the bug.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Is it a regression?**
Did this work in a previous version of the SDK? If so, which versions did you try?

**Debug Logs**
Include any error messages or stack traces here.

**Other Information**
- OS: [e.g. macOS, Linux, Windows]
- Node.js Version: [e.g. 18.x, 20.x]
- SDK Version: [e.g. 0.0.1]

**Additional context**
Add any other context about the problem here.
28 changes: 28 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## What changes are proposed in this pull request?

Provide the readers and reviewers with the information they need to understand
this PR in a comprehensive manner.

Specifically, try to answer the two following questions:

- **WHAT** changes are being made in the PR? This should be a summary of the
major changes to allow the reader to quickly understand the PR without having
to look at the code.
- **WHY** are these changes needed? This should provide the context that the
reader might be missing. For example, were there any decisions behind the
change that are not reflected in the code itself?

The "why part" is the most important of the two as it usually cannot be
inferred from the code itself. A well-written PR description will help future
developers (including your future self) to know how to interact and update your
code.

## How is this tested?

Describe any tests you have done; especially if test tests are not part of
the unit tests (e.g. local tests).

**ALWAYS ANSWER THIS QUESTION:** Answer with "N/A" if tests are not applicable
to your PR (e.g. if the PR only modifies comments). Do not be afraid of
answering "Not tested" if the PR has not been tested. Being clear about what
has been done and not done provides important context to the reviewers.
111 changes: 111 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: CI

on:
push:
branches:
- main
- develop
pull_request:

jobs:
build:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
build: npm run build --target x86_64-apple-darwin
- host: macos-latest
target: aarch64-apple-darwin
build: npm run build --target aarch64-apple-darwin
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
build: npm run build --target x86_64-unknown-linux-gnu
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
build: npm run build --target x86_64-unknown-linux-musl
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
build: npm run build --target aarch64-unknown-linux-gnu
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
build: npm run build --target aarch64-unknown-linux-musl
- host: windows-latest
target: x86_64-pc-windows-msvc
build: npm run build --target x86_64-pc-windows-msvc
- host: windows-latest
target: aarch64-pc-windows-msvc
build: npm run build --target aarch64-pc-windows-msvc

name: Build - ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.settings.target }}

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.settings.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install dependencies
run: npm ci

- name: Build
run: ${{ matrix.settings.build }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: '*.node'
if-no-files-found: error

test:
name: Test Node.js ${{ matrix.node }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: ['16', '18', '20']

steps:
- uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build:debug

- name: Test
run: npm test
if: matrix.os != 'windows-latest'
92 changes: 92 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Publish

on:
release:
types: [published]

jobs:
build:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
- host: macos-latest
target: aarch64-apple-darwin
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: windows-latest
target: aarch64-pc-windows-msvc

name: Build - ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.settings.target }}

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build --target ${{ matrix.settings.target }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: '*.node'
if-no-files-found: error

publish:
name: Publish to NPM
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Move artifacts
run: npm run artifacts

- name: List packages
run: ls -R ./npm

- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Build artifacts
target/
*.node
index.js
index.d.ts

# Dependencies
node_modules/
package-lock.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Environment
.env
.env.local
.env.*.local

# Distribution
dist/
*.tgz

# Test coverage
coverage/
.nyc_output/

# Temporary files
*.tmp
*.temp
.env

# Generated files
examples/generated/
schemas/*.pb
schemas/*.b64
48 changes: 48 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Development files
.github/
.vscode/
.idea/
*.swp
*.swo

# Git
.git/
.gitignore

# CI/CD
.travis.yml
.circleci/

# Build artifacts not needed in published package
target/

# Development config
tsconfig.json

# Documentation (except README, LICENSE, CHANGELOG, NEXT_CHANGELOG, and SECURITY)
docs/
*.md
!README.md
!CHANGELOG.md
!NEXT_CHANGELOG.md
!SECURITY.md
!LICENSE

# Test files
test/
tests/
*.test.ts
*.test.js
*.spec.ts
*.spec.js

# Environment
.env*

# OS
.DS_Store
Thumbs.db

# Temporary files
*.tmp
*.temp
Loading