Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

303 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

paranext-extension-sneeze-board

A Platform.Bible extension that connects to the SIL Sneeze Board server.

WARNING: This extension is entirely AI-generated based on SneezeBoardClient with essentially zero code oversight. There may be lots of less-than-best practices and examples you do not want to follow.

Architecture

The extension uses three artifacts that work together:

  • Extension main (src/main.ts) runs in the Platform.Bible extension host (a sandboxed Node environment with restricted module access). It owns command registration, the sneezeBoard.state PAPI Network Object, and the React web view provider.
  • Bridge (src/bridge/index.ts, built to dist/assets/bridge/index.js) runs as a Node child process spawned via papi.elevatedPrivileges.createProcess.fork. It owns the TCP socket to the SneezeBoardServer, implements the NetworkComms.Net binary framing, and handles XML payload codecs. It is intentionally outside the sandbox.
  • Web view (src/web-views/sneeze-board.web-view.tsx) is a React component bundled inline into the extension main. It subscribes to the state Network Object and dispatches commands via PAPI.

See docs/superpowers/specs/2026-05-14-sneeze-board-design.md for the full design spec.

Develop

npm install
npm run build
npm run start    # runs Platform.Bible with the extension loaded

Test

npm test                              # unit tests
RUN_INTEGRATION=1 npm test -- integration   # also runs integration tests against a local
                                            # SneezeBoardServer.exe (must be running)

npm run typecheck runs tsc --noEmit with skipLibCheck.

Build / package

npm run package    # produces release/paranext-extension-sneeze-board_<ver>.zip

Known limitations (v0.1)

  • The NetworkComms.Net wire format codec was implemented from documentation rather than from captured byte fixtures (the C# build toolchain was not available when this was first written). Real-server bytes still flow through the same codec; if any framing assumption is wrong, the integration test (Phase 10) is the first place to look. See test/fixtures/wire/README.md for how to capture canonical fixtures with scripts/tcp-tee.mjs.
  • No system tray / notify-icon (Platform.Bible has no extension analog).
  • English-only; localization keys are declared in contributions/localizedStrings.json but the web view strings are inline.

Summary

The general file structure for an extension is as follows:

  • package.json contains information about this extension's npm package. It is required for Platform.Bible to use the extension properly. It is copied into the build folder
  • manifest.json is the manifest file that defines the extension and important properties for Platform.Bible. It is copied into the build folder
  • src/ contains the source code for the extension
    • src/main.ts is the main entry file for the extension
    • src/types/paranext-extension-sneeze-board.d.ts is this extension's types file that defines how other extensions can use this extension through the papi. It is copied into the build folder
    • *.web-view.tsx files will be treated as React WebViews
    • *.web-view.html files are a conventional way to provide HTML WebViews (no special functionality)
  • assets/ contains asset files the extension and its WebViews can retrieve using the papi-extension: protocol, as well as textual descriptions in various languages. It is copied into the build folder
    • assets/displayData.json contains (optionally) a path to the extension's icon file as well as text for the extension's display name, short summary, and path to the full description file
    • assets/descriptions/ contains textual descriptions of the extension in various languages
      • assets/descriptions/description-<locale>.md contains a brief description of the extension in the language specified by <locale>
  • contributions/ contains JSON files the platform uses to extend data structures for things like menus and settings. The JSON files are referenced from the manifest
  • public/ contains other static files that are copied into the build folder
  • .github/ contains files to facilitate integration with GitHub
  • dist/ is a generated folder containing the built extension files
  • release/ is a generated folder containing a zip of the built extension files

See the Extension Anatomy wiki page for more information about the various files that comprise an extension and their relationships to each other.

To install

Install dependencies:

  1. Follow the instructions to install paranext-core. We recommend you clone paranext-core in the same parent directory in which you cloned this repository so you do not have to reconfigure paths to paranext-core.
  2. In this repo, run npm install to install local and published dependencies

Configure paths to paranext-core repo

If you cloned paranext-core anywhere other than in the same parent directory in which you cloned this repository, update the paths to paranext-core in this repository's package.json to point to the correct paranext-core directory.

To run

Running Platform.Bible with this extension

To run Platform.Bible with this extension:

npm start

Note: The built extension will be in the dist folder. In order for Platform.Bible to run this extension, you must provide the directory to this built extension to Platform.Bible via a command-line argument. This command-line argument is already provided in this package.json's start script. If you want to start Platform.Bible and use this extension any other way, you must provide this command-line argument or put the dist folder into Platform.Bible's extensions folder.

Building this extension independently

To watch extension files (in src) for changes:

npm run watch

To build the extension once:

npm run build

To package for distribution

To package this extension into a zip file for distribution:

npm run package

Publishing

These steps will walk you through releasing a version on GitHub and bumping the version to a new version so future changes apply to the new in-progress version.

  1. Make sure the versions in this repo are on the version number you want to release. If they are not, manually dispatch the Bump Versions workflow or run the bump-versions npm script to set the versions to what you want to release on the branch you want to release from.

  2. Manually dispatch the Publish workflow in GitHub Actions targeting the branch you want to release from. This workflow creates a new pre-release for the version you intend to release and creates a new bump-versions-<next_version> branch to bump the version after the release so future changes apply to a new in-progress version instead of to the already released version. This workflow has the following inputs:

    • version: Enter the version you intend to publish (e.g. 0.2.0). This is simply for verification to make sure you release the code that you intend to release. It is compared to the version in the code, and the workflow will fail if they do not match.
    • newVersionAfterPublishing: Enter the version you want to bump to after releasing (e.g. 0.3.0-alpha.0). Future changes will apply to this new version instead of to the version that was already released. Leave blank if you don't want to bump.
    • bumpRef: Enter the Git ref you want to create the bump versions branch from, e.g. main. Leave blank if you want to use the branch selected for the workflow run. For example, if you release from a stable branch named release-prep, you may want to bump the version on main so future development work happens on the new version, then you can rebase release-prep onto main when you are ready to start preparing the next stable release.
    [Optional] Create a new pre-release and bump versions branch manually

    Manually create a new pre-release and bump versions branch

    Alternatively, you can create a new pre-release manually:

    npm run package
    # Create a new pre-release in GitHub on tag `v<version>`
    # Copy `.github/assets/release-body.md` into the release body
    # Press the "Generate release notes" button in the release creation page to generate a changelog
    # Attach contents of `release` folder to the release

    Then bump versions by running the following:

    npm run bump-versions <next_version>

    Or bump versions manually:

    git checkout -b bump-versions-<next_version>
    npm version <next_version> --git-tag-version false
    # Change version in the extension's `manifest.json`
    git commit -a -m "Bumped versions to <next_version>"; git push -u origin HEAD
  3. In GitHub, adjust the new draft release's body and other metadata as desired, then publish the release.

  4. Open a PR and merge the newly created bump-versions-<next_version> branch.

Bumping version without publishing a release

Sometimes, it may be useful to change the version without publishing a release.

To bump versions without publishing a release, manually dispatch the Bump Versions workflow in GitHub Actions targeting the branch on which you want to change versions. Alternatively, you can run the bump-versions npm script. This workflow will create a branch named bump-versions-<version> from the target branch (or, if running the script, your current head) with the needed changes. Open a PR and merge that new branch into the branch on which you want to change versions.

This workflow has the following inputs:

  • newVersion: enter the version you want to bump to (e.g. 0.3.0-alpha.0). Future changes will apply to this new version instead of to the version.

For example, to bump branch my-branch to version 0.2.0, run the following:

git checkout my-branch
npm run bump-versions -- 0.2.0

Then create a PR and merge the bump-versions-0.2.0 branch into my-branch. my-branch is now ready for release.

Publishing problems

Following are some problems you may encounter while publishing and steps to solve them.

@swc/core Failed to load native binding

If you see the following error in the GitHub Actions workflow logs while packaging:

Module build failed (from ./node_modules/swc-loader/src/index.js):
Error: Failed to load native binding

Please see "Failed to load native binding" in the Troubleshooting guide for how to solve this problem.

To update this extension from the template

This extension project is forked from paranext-extension-template, which is updated periodically and will sometimes receive updates that help with breaking changes on paranext-core. We recommend you periodically update your extension by merging the latest template updates into your extension.

To set up this extension to be updated from the template, run the following command once after cloning this repo:

git remote add template https://github.com/paranext/paranext-extension-template

To update this extension from the template, make sure your repo has no working changes. Then run the following commands:

git fetch template
git merge template/main --allow-unrelated-histories

For more information, read the instructions on the wiki.

Note: The merge/squash commits created when updating this repo from the template are important; Git uses them to compare the files for future updates. If you edit this repo's Git history, please preserve these commits (do not squash them, for example) to avoid duplicated merge conflicts in the future.

Special features in this project

This project has special features and specific configuration to make building an extension for Platform.Bible easier. Rather than duplicating the full explanation here, please refer to the Special Features in this project section of the multi-extension template README for details on these features.

About

Example Paranext extension to display a sneeze board

Resources

Stars

0 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages