maximseshuk

payload plugin tooling

by maximseshuk
Testing & developer experience
v4
>=4.0.0-beta.0 <4.0.0-canary.0 || >=4.0.0
MIT

Overview

Summary generated from the README

A dev-only dependency that bundles shared configuration for building Payload plugins: oxlint, oxfmt, TypeScript, tsdown and Vitest presets, plus an in-memory test database helper. It also provides reusable GitHub CI and release workflows and helpers for inserting fields and reporting anonymous telemetry. The build bundles its runtime modules into the plugin, so it is not a runtime dependency.

Features

  • Preset configs for oxlint, oxfmt, TypeScript, tsdown and Vitest
  • Test database helper for in-memory SQLite, PGlite Postgres or MongoDB
  • Field helpers to insert fields at a position and find field paths
  • Opt-out anonymous telemetry reporter bundled into the plugin build
  • Reusable GitHub workflows for CI and npm releases with changelog generation
  • Reference editor and Claude Code settings with a release skill

Use cases

  • Standardize lint, format and build setup across several Payload plugin repositories
  • Run integration tests against SQLite, Postgres or MongoDB without external servers
  • Automate plugin releases with changelogs and npm trusted publishing

From the author

Shared lint, format, TypeScript, build and test config for the @maximseshuk Payload plugins

Installation

npm i @seshuk/payload-plugin-tooling

0

Stars

0

Forks

3

Open Issues

Today

Last Updated

37

Weekly Downloads

v0.2.4

npm Version

34.7 KB

Unpacked Size

0

Dependencies

GitHub stars

00 since Sep 27

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 20260
Dec 4, 20260
Dec 3, 20260
Dec 2, 20260
Dec 1, 20260
Nov 30, 20260
Nov 29, 20260
Nov 28, 20260
Nov 27, 20260
Nov 26, 20260
Nov 25, 20260
Nov 24, 20260
Nov 23, 20260
Nov 22, 20260
Nov 21, 20260
Nov 20, 20260
Nov 19, 20260
Nov 18, 20260
Nov 17, 20260
Nov 16, 20260
Nov 15, 20260
Nov 14, 20260
Nov 13, 20260
Nov 12, 20260
Nov 11, 20260
Nov 10, 20260
Nov 9, 20260
Nov 8, 20260
Nov 7, 20260
Nov 6, 20260
Nov 5, 20260
Nov 4, 20260
Nov 3, 20260
Nov 2, 20260
Nov 1, 20260
Oct 31, 20260
Oct 30, 20260
Oct 29, 20260
Oct 28, 20260
Oct 27, 20260
Oct 26, 20260
Oct 25, 20260
Oct 24, 20260
Oct 23, 20260
Oct 22, 20260
Oct 21, 20260
Oct 20, 20260
Oct 19, 20260
Oct 18, 20260
Oct 17, 20260
Oct 16, 20260
Oct 15, 20260
Oct 14, 20260
Oct 13, 20260
Oct 12, 20260
Oct 11, 20260
Oct 10, 20260
Oct 9, 20260
Oct 8, 20260
Oct 7, 20260
Oct 6, 20260
Oct 5, 20260
Oct 4, 20260
Oct 3, 20260
Oct 2, 20260
Oct 1, 20260
Sep 30, 20260
Sep 29, 20260
Sep 28, 20260
Sep 27, 20260
npm weekly downloads

38−59 since Oct 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 202638
Dec 4, 202645
Dec 3, 202642
Dec 2, 202641
Dec 1, 202637
Nov 30, 202643
Nov 29, 202640
Nov 28, 202641
Nov 27, 202637
Nov 26, 202641
Nov 25, 202637
Nov 24, 202638
Nov 23, 202630
Nov 22, 202634
Nov 21, 202629
Nov 20, 202633
Nov 19, 202631
Nov 18, 202629
Nov 17, 202630
Nov 16, 202631
Nov 15, 202630
Nov 14, 202635
Nov 13, 202632
Nov 12, 202631
Nov 11, 202633
Nov 10, 202637
Nov 9, 202642
Nov 8, 202643
Nov 7, 202642
Nov 6, 202643
Nov 5, 202669
Nov 4, 202667
Nov 3, 202663
Nov 2, 202663
Nov 1, 202659
Oct 31, 202679
Oct 30, 202680
Oct 29, 202649
Oct 28, 202648
Oct 27, 202656
Oct 26, 202654
Oct 25, 202660
Oct 24, 202650
Oct 23, 202640
Oct 22, 202653
Oct 21, 202667
Oct 20, 202684
Oct 19, 2026234
Oct 18, 2026255
Oct 17, 2026435
Oct 16, 2026465
Oct 15, 2026951
Oct 14, 2026951
Oct 13, 2026939
Oct 12, 2026881
Oct 11, 2026854
Oct 10, 2026659
Oct 9, 2026629
Oct 8, 2026130
Oct 7, 2026116
Oct 6, 202697

Each point is npm's rolling 7-day download count.

Health Score

60/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1403180109-root.svg)](https://payloaddirectory.dev/plugins/1403180109-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1403180109-root"><img src="https://payloaddirectory.dev/badge/1403180109-root.svg" alt="Payload Directory"></a>
Updated Dec 5, 2026Created Oct 3, 2026Published Oct 10, 2026

README

@seshuk/payload-plugin-tooling

Shared dev config for the @seshuk Payload plugins: lint, format, TypeScript, build, test database, telemetry, field placement, changelog and GitHub workflows. Install it as a dev dependency only. Plugins never import it at runtime: the build bundles the telemetry and fields modules into the plugin.

pnpm add -D @seshuk/payload-plugin-tooling

oxlint

// oxlint.config.ts
import { oxlintBase } from '@seshuk/payload-plugin-tooling/oxlint'
import { defineConfig } from 'oxlint'

export default defineConfig({
  ...oxlintBase,
  overrides: [...oxlintBase.overrides /* plugin rules */],
})

oxfmt

// oxfmt.config.ts
import { oxfmtBase } from '@seshuk/payload-plugin-tooling/oxfmt'
import { defineConfig } from 'oxfmt'

export default defineConfig(oxfmtBase)

TypeScript

// tsconfig.json
{
  "extends": "@seshuk/payload-plugin-tooling/tsconfig.json",
  "compilerOptions": { "rootDir": "./", "paths": { "@/*": ["./src/*"] } },
  "include": ["./src/**/*.ts", "./src/**/*.tsx", "./tests/**/*.ts"],
}

The build reads tsconfig.build.json, which extends tsconfig.json and sets rootDir: ./src, outDir: ./dist and jsx: react-jsx.

tsdown

// tsdown.config.ts
import { pluginBuild } from '@seshuk/payload-plugin-tooling/tsdown'
import { defineConfig } from 'tsdown'

export default defineConfig(pluginBuild())

The build keeps the src file layout in dist, copies src/**/*.css and never bundles npm packages, except this package (see Telemetry and Fields). Pass copy for more files, for example pluginBuild({ copy: ['src/**/*.edge.js'] }).

Vitest

// tests/vitest.config.ts
import { vitestBase } from '@seshuk/payload-plugin-tooling/vitest'
import { defineConfig } from 'vitest/config'

export default defineConfig({ ...vitestBase, test: { include: ['tests/**/*.spec.ts'] } })

vitestBase maps the @/ alias to src/, the same as paths in tsconfig.json. Run Vitest from the plugin root.

Test database

import { testDatabase } from '@seshuk/payload-plugin-tooling/test-database'

export default buildConfig({ db: await testDatabase() /* … */ })

TEST_DB picks an in-memory database: sqlite (default), postgres (PGlite) or mongodb (mongodb-memory-server). Install only the packages for the databases you test:

TEST_DBPackages
sqlite@payloadcms/db-sqlite
postgres@payloadcms/db-postgres, @electric-sql/pglite, @electric-sql/pglite-socket
mongodb@payloadcms/db-mongodb, mongodb-memory-server

Telemetry

Anonymous usage telemetry, shared by all plugins. Once a day per project, it sends the plugin, Payload and Node versions, the OS, a hashed project ID and the features the plugin passes. It never sends secrets, IPs, keys or names. On the first run, it logs a notice with the opt-outs.

Telemetry is off when any of these is set:

  • telemetry: false in the Payload config or in the plugin options;
  • DO_NOT_TRACK=1 or the plugin's own variable, for example BUNNY_TELEMETRY_DISABLED=1;
  • CI or NODE_ENV=test.

Call reportTelemetry in onInit and do not wait for it. It never throws. Features are booleans only, never names or values:

import { reportTelemetry, type TelemetryOption } from '@seshuk/payload-plugin-tooling/telemetry'

export type MyPluginConfig = { telemetry?: TelemetryOption /* … */ }

config.onInit = async (payload) => {
  await existingOnInit?.(payload)
  void reportTelemetry({
    disableEnv: 'BUNNY_TELEMETRY_DISABLED',
    docsUrl: 'https://payload-storage-bunny.seshuk.im/v4/configuration/telemetry',
    features: { signedUrls: Boolean(pluginConfig.signedUrls) },
    option: pluginConfig.telemetry,
    packageName: '@seshuk/payload-storage-bunny',
    payload,
    product: 'payload-storage-bunny',
  })
}

pluginBuild() bundles this module into the plugin's dist/_tooling/, so it is never a runtime dependency. Any other npm package that ends up in the bundle fails the build. telemetry: { url } sends to another collector. The server accepts only known products: add a new product slug on the server first.

Fields

import { findFieldPaths, insertField, type InsertPosition } from '@seshuk/payload-plugin-tooling/fields'

collection.fields = insertField(collection.fields, { after: 'meta.title' }, myField)
const paths = findFieldPaths(collection.fields, (field) => Boolean(field.custom?.myPlugin))

insertField(fields, position, field) returns a new field list. position is an InsertPosition: 'first', 'last', 'sidebar' (appends the field with admin.position: 'sidebar'), { after: path } or { before: path }. A path names fields by dots through groups, arrays and named tabs; rows, collapsibles, unnamed groups and unnamed tabs add no segment. A path that does not match from the top is also looked up inside every group and tab, so { after: 'title' } finds meta.title. When that finds the name in more than one place, it throws Field path "<path>" is ambiguous, use the full path: a.x, b.x. An unknown path throws Field path "<path>" not found.

findFieldPaths(fields, predicate) returns the paths of the named fields that match, with the same naming rules, for example ['slug', 'meta.description', 'seo.image'].

Both only import types from payload and work with Payload 3 and 4. pluginBuild() bundles the module into the plugin's dist/_tooling/.

GitHub workflows

Both workflows run the scripts lint, format:check, typecheck, test:unit, test:int and build. Every plugin must define them. test:unit runs tests without a database or network; test:int runs the database tests.

# .github/workflows/ci.yml
name: CI
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
jobs:
  ci:
    uses: maximseshuk/payload-plugin-tooling/.github/workflows/[email protected]
    with:
      node-versions: '["24"]'
# .github/workflows/release.yml
name: Release
on:
  push:
    tags: ['v*.*.*']
permissions:
  contents: read
jobs:
  release:
    uses: maximseshuk/payload-plugin-tooling/.github/workflows/[email protected]
    permissions:
      contents: write
      id-token: write
    secrets:
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

The release workflow:

  • builds the changelog with git-cliff from the plugin's cliff.toml, or from the shared one in this package when the plugin has none, and takes the repository for links from GITHUB_REPO;
  • puts .github/releases/vX.Y.Z.md under the version heading and above the commit list when the file exists;
  • sets the npm dist-tag: beta for X.Y.Z-beta.N, latest for the newest major, latest-N for an older major;
  • publishes with npm trusted publishing (OIDC), or with the NPM_TOKEN secret for the first release of a new package.

Release notes

To add text under the version heading and above the commit list, such as a short intro or breaking changes, commit .github/releases/vX.Y.Z.md with the release. Keep it to a few lines and link to the upgrade guide in the docs for the details.

<!-- .github/releases/v4.0.0.md -->

Payload 4 support. Upgrade guide: https://example.com/v4/upgrade-guide

## ⚠️ Breaking changes

- Node.js 24.15+ is required.

The file is optional, except for a new major (vX.0.0) and its first prerelease (vX.0.0-beta.1). Without it, those releases fail before anything is published.

npm trusted publishing

npm can add a trusted publisher only to a package that already exists. For a new package:

  1. Add an npm granular access token with publish rights as the NPM_TOKEN repository secret.
  2. Push the first release tag. The workflow publishes with the token.
  3. On npmjs.com, add a trusted publisher to the package: the plugin repository and the workflow file release.yml (the caller, not the file in this repository).
  4. Delete the NPM_TOKEN secret and revoke the token. Later releases use OIDC.

Editor settings

.zed/settings.json and .vscode/ in this repository are the reference editor settings. Copy them to each plugin: editors cannot read settings from a package. They format with oxfmt on save, fix oxlint issues and use the TypeScript 7 language server.

  • Zed: install the extensions Oxc and TypeScript Language Server.
  • VS Code: install the recommended extensions from .vscode/extensions.json.

Claude Code settings

.claude/settings.json is the reference project settings for Claude Code. Copy it to each plugin and add the plugin's own entries, such as MCP servers. It:

  • allows read-only git and GitHub commands and the package scripts without a prompt;
  • always asks before a push, a tag, a pull request, a release, a publish or a gh api call, also in auto mode;
  • blocks reading .env files;
  • turns off co-author lines in commits and pull requests;
  • enables the official payload plugin and the payload-plugin plugin from this repository.

The payload-plugin plugin

This repository is also a Claude Code plugin marketplace (.claude-plugin/marketplace.json). The plugin in claude/ has:

  • a hook that runs oxlint --fix and oxfmt on every file Claude edits, and shows the remaining lint errors to Claude. It needs jq;
  • the /payload-plugin:release skill, which prepares a release: version, release notes, checks, release commit and tag. It never pushes.

Plugins get changes to the hook and the skill without copying files.

License

MIT

Similar plugins