SimpleBLE

Extras

Contributor notes for SimpleBLE, covering how to build and preview this documentation site and the checklist for preparing, tagging and publishing a release.

Building documentation

The documentation for SimpleBLE is built using Fumadocs, a Next.js-based documentation framework.

Prerequisites

  • Node.js 20.9+ or Bun
  • npm, pnpm, or bun package manager

Installation

First, install the dependencies:

cd <path-to-repository>/docs
npm install
# or
bun install

Development

To run the documentation site in development mode with hot reload:

npm run dev
# or
bun dev

The documentation will be available at http://localhost:3000.

Building for Production

To build the documentation for production:

npm run build
# or
bun run build

To preview the production build locally:

npm run start
# or
bun start

Content Structure

  • Content files: Located in docs/content/docs/
  • Components: Located in docs/src/components/
  • API documentation: Generated using custom React components in docs/src/components/api/

Documentation is written in MDX (Markdown with JSX), allowing you to use React components within your documentation.

Release checklist

The tag of a published GitHub release sets the version of every package that release publishes. Between releases, VERSION names the next release with a -dev suffix, such as 1.3.1-dev, so local builds never carry a published version. CI builds replace the suffix with -dev.N, where N counts the commits since the last tag.

Perform the following steps in order.

Prepare the release

  1. Ensure content parity between all readmes and the documentation.

    • README.rst
    • LICENSE.md
    • simpleaible/README.md
    • simpledartble/README.md
    • simpledelphible/README.md
    • simplefltble/README.md
    • simpledroidble/README.md
    • simplegoble/README.md
    • simplejavable/README.md
    • simplejsble/README.md
    • simplektble/README.md
    • simplepyble/README.md
    • simplernble/README.md
    • simplersble/README.md
    • simplesharpble/README.md
    • simpleswiftble/README.md
  2. Set the release version:

    • Remove the -dev suffix in VERSION, Cargo.toml, Cargo.lock, simpleaible/pyproject.toml, simpledartble/pubspec.yaml, and simplefltble/pubspec.yaml, including its simpledartble dependency.
    • In docs/content/docs/changelog.mdx, give the release's section its version and date.

    For a minor or major release, such as 1.4.0 while these files name 1.3.1-dev, use its version instead, and search the repository for the previous version with git grep to catch references such as migration guides.

  3. Run the Hardware In The Loop tests listed below.

  4. Run the pre-release checks from the repository root:

    ./scripts/check_version.sh
    cargo build
    (cd docs && npm run types:check && npm run build)
  5. Commit and push the release changes, and wait for the branch-triggered CI Main workflow to finish successfully. Like every main push, it publishes development packages: X.Y.Z-dev.N to crates.io, Maven Central, and NuGet, X.Y.Z.devN to PyPI, X.Y.Z-dev.N to npm under the dev tag, and vX.Y.Z-dev.N tags to simpleble/simpleswiftble, simpleble/simplegoble, and simpleble/simpledelphible.

    gh run list -R simpleble/simpleble --workflow ci_main.yml --event push --commit <commit>
    gh run watch <run-id> -R simpleble/simpleble --interval 60 --exit-status

    Every publish job waits for every build job, so one failed build skips all publication. If a job fails for a reason unrelated to the release, such as an interrupted Android SDK download, an error pulling a manylinux image, or a timeout uploading an artifact, use Re-run failed jobs on that run, or gh run rerun <run-id> -R simpleble/simpleble --failed. It also runs the jobs the failure skipped.

Publish the release

  1. Copy the version's changelog section, from its ## [X.Y.Z] heading up to the previous version's, into a file outside the repository. The release notes are that copy and nothing else. Then create and publish a stable GitHub release whose new tag vX.Y.Z points at that commit:

    gh release create vX.Y.Z -R simpleble/simpleble --target <commit> --title "SimpleBLE vX.Y.Z" --notes-file <notes>

    A draft does not trigger publication, and the release must not be marked as a prerelease. The command creates the tag, so don't push it beforehand: a tag push starts no workflow, and --target is ignored for an existing tag.

  2. Wait for the release-triggered CI Main workflow to finish. It builds every package from the tag, attaches the artifacts to the release, and publishes the stable packages. Its publish-simpledartble job runs Publish SimpleDartBLE on the tag, as pub.dev only accepts uploads from runs on a tag, and waits for it to upload SimpleDartBLE and SimpleFltBLE.

    gh run list -R simpleble/simpleble --workflow ci_main.yml --event release --limit 1
    gh run watch <run-id> -R simpleble/simpleble --interval 60 --exit-status
    gh run view <run-id> -R simpleble/simpleble --log-failed
    • Do not cancel it, unpublish and republish the release, or run CI Main manually on the tag. Runs for the tag cancel each other. Editing the release notes is safe.
    • If a job fails, use Re-run failed jobs, never Re-run all jobs. PyPI, NuGet, npm, and pub.dev skip versions that already exist, and the SimpleGoBLE, SimpleSwiftBLE, and SimpleDelphiBLE jobs skip tags that already exist, but crates.io and Maven Central reject an existing version, so repeating their publish jobs after they succeeded fails.
    • If only the pub.dev upload failed, run gh workflow run publish_simpledartble.yml -R simpleble/simpleble --ref vX.Y.Z.
  3. Verify the published release by running the following in bash with its version. Every line should name X.Y.Z, with the GitHub release neither a draft nor a prerelease and without development filenames, crates.io yanked=false, Maven Central HTTP 200, and npm's latest tag on the release:

    V=X.Y.Z
    gh release view "v$V" -R simpleble/simpleble --json isDraft,isPrerelease,assets --jq '"GitHub release: draft=\(.isDraft) prerelease=\(.isPrerelease) assets=\(.assets | length) dev-named=\([.assets[].name | select(test("dev"))] | length)"'
    for p in simplepyble simpleaible; do echo "PyPI $p: $(curl -s https://pypi.org/pypi/$p/$V/json | jq -r '"\(.info.version // "missing") (\(.urls | length) files)"')"; done
    echo "crates.io simplersble: $(curl -s -A simpleble-release-check https://crates.io/api/v1/crates/simplersble/$V | jq -r '.version | "\(.num // "missing") yanked=\(.yanked)"')"
    for a in simplejavable simpledroidble simpledroidbridge simplektble; do echo "Maven Central $a: HTTP $(curl -s -o /dev/null -w '%{http_code}' https://repo1.maven.org/maven2/org/simpleble/$a/$V/)"; done
    echo "NuGet SimpleSharpBLE: $(curl -s https://api.nuget.org/v3-flatcontainer/simplesharpble/index.json | jq -r --arg v "$V" 'if (.versions | index($v)) then $v else "not listed yet" end')"
    for p in simplejsble simplernble; do echo "npm $p: $(curl -s https://registry.npmjs.org/$p | jq -r '."dist-tags" | "latest=\(.latest) dev=\(.dev)"')"; done
    echo "Go proxy simplegoble: $(curl -s https://proxy.golang.org/github.com/simpleble/simplegoble/@v/v$V.info)"
    for r in simpleswiftble simpledelphible; do echo "$r: $(gh api repos/simpleble/$r/releases/tags/v$V --jq '"\(.tag_name) prerelease=\(.prerelease) assets=\([.assets[].name] | join(","))"')"; done
    for p in simpledartble simplefltble; do echo "pub.dev $p: $(curl -s https://pub.dev/api/packages/$p/versions/$V | jq -r '.version // "missing"')"; done

    Maven Central and NuGet can take 15 minutes or more to list a new version after its publish job succeeds. Check again later rather than rerunning the job.

  4. Replace references to development builds outside this repository now that the stable packages are available, such as the SimplePyBLE version pinned by the Dongl quickstart on simpleble.org. Search sibling checkouts for .devN, -dev.N, and -devN pins, and deploy any site that changes.

  5. Start the next version: set the files from step 2 to the next patch version with a -dev suffix, such as 1.3.1-dev, add an empty section for it to the changelog, check them with ./scripts/check_version.sh, and commit and push them. Until then, CI Main fails on every new commit, as VERSION still names a released version.

  6. From the documentation root, run berth app deploy to deploy the documentation, as pushing to main doesn't update it. berth app status shows the running image. Berth builds a linux/amd64 image with Docker, which on an Apple silicon Mac needs 32 GB of memory for Docker's VM: with Docker Desktop's default of about 8 GB, the build fails with loader timeouts.

  • Attempt connecting while already connected.
  • Attempt disconnecting while not connected.

Documentation Structure Guide

When adding documentation for new components or language bindings, follow this standardized structure to ensure consistency and a high-quality onboarding experience:

  1. Usage: Detail installation, system requirements, and how to include the library in a project (CMake, package managers, etc.).
  2. Platform Notes: Document OS-specific behaviors, limitations, and quirks. This is critical for Bluetooth-related components.
  3. Tutorial: Provide a narrative, step-by-step guide that takes the user from a basic "Hello World" (e.g., listing adapters) to more advanced interactions (scanning, connecting, reading/writing).
  4. API Reference: Use the <ApiSection>, <ApiClass>, and <ApiMethod> components to provide technical details for every public class and method.
  5. Examples: Provide a curated list of use-cases with descriptions and direct links to the source code in the repository.
  6. FAQ: Address common questions, troubleshooting steps, and platform-specific nuances that don't fit in the tutorial.

On this page