Shared Docusaurus core for jsPsych-ecosystem documentation sites: one brand (palette, typography, components, code-block behavior), an ecosystem switcher that links the family of sites together, and shared search — while each site stays an independent repo.
| Package | What it is |
|---|---|
@jspsych/docusaurus-theme |
Docusaurus theme: brand CSS + self-hosted fonts, swizzled components (navbar dot-brain logo, runnable code fences, doc metadata row, branded 404, ecosystem switcher), and MDX-importable components (PluginExample, Citation, JspsychBrain). |
@jspsych/docusaurus-preset |
defineJspsychConfig() — a config factory that wires @docusaurus/preset-classic + the theme and fills in every shared default (navbar assembly, footer skeleton, shared Algolia search, prism themes, future.v4), leaving only per-site facts to you. |
The examples/site workspace is the development sandbox: every
shared feature has a page there that exercises it.
Setting up a new ecosystem docs site? Follow NEW_SITE.md — the complete walkthrough with the minimal file set, required version pins, deploy workflow, and how to join the ecosystem switcher + shared search. The short version:
-
npm install @jspsych/docusaurus-preset @jspsych/docusaurus-theme -
docusaurus.config.ts:import {defineJspsychConfig} from '@jspsych/docusaurus-preset'; export default defineJspsychConfig({ title: 'My jsPsych Tool', url: 'https://jspsych.github.io', baseUrl: '/my-tool/', organizationName: 'jspsych', projectName: 'my-tool', githubUrl: 'https://github.com/jspsych/my-tool', navbar: { title: 'My Tool', items: [{type: 'docSidebar', sidebarId: 'docs', position: 'left', label: 'Docs'}], }, docs: {sidebarPath: './sidebars.ts'}, footerLinks: [ {title: 'Docs', items: [{label: 'Get Started', to: '/docs/intro'}]}, ], });
-
Write docs. Live plugin demos: import
PluginExamplefrom@jspsych/docusaurus-theme/componentsin MDX. Runnable experiment listings: tag a fence```html runnable. -
Deploy: copy
templates/publish-docs.ymlinto.github/workflows/and adjust the working directory. -
Join the family: PR this repo to add your site to
packages/theme/src/sites.ts(the ecosystem switcher) and tocrawler/config.json(shared search). Both ship to every site on its next rebuild.
npm install
npm run build # theme + preset + example site
npm run start:example # dev-serve the example sitenpm run watch in packages/theme recompiles on change while the example
site dev server runs.
Versioned with changesets, same
flow as the other jspsych repos: add a changeset with your PR
(npx changeset). On merge to main, the release workflow opens/updates a
"Version Packages" PR; merging that PR triggers publish.yml, which publishes
to npm via trusted publishing
(OIDC, no token) with provenance.
One-time bootstrap per package (already-published packages skip this): a
maintainer runs npm publish manually once, then configures the package's
Trusted Publisher on npmjs.com (GitHub Actions, repository
jspsych/jspsych-docs-theme, workflow .github/workflows/publish.yml).
Docusaurus upgrades are treated as theme releases — the swizzled components
track @docusaurus/theme-classic internals (currently pinned to 3.9.x).