Thanks for helping improve @ebuildy/docusaurus-plugin-gitlab! This guide gets you from clone to a green build.
- Node 22 or 24 (≥22.13 — required by pnpm 11) and pnpm 11.
With mise,
mise installsets up both (frommise.toml); otherwisecorepack enableactivates the pnpm version pinned inpackage.json'spackageManager, ornpm install -g pnpm@11. - A GitLab token is not required for development (the tests mock the API).
- Optionally, a Dev Container (
.devcontainer/) — open the repo in a container with nvm preloaded with Node 22/24; switch withnvm use 24.
git clone <repo-url>
cd mdx-gitlab-set
pnpm install # installs the workspace (package + example sites) and the git pre-commit hook (via husky)
pnpm run build # bundle the package into dist/| Command | What it does |
|---|---|
pnpm test |
Run all tests (unit + e2e) with Vitest |
pnpm exec vitest run --exclude '**/test/e2e/**' |
Unit tests only (fast) |
pnpm exec vitest run test/e2e/build.test.ts |
End-to-end only (builds a real Docusaurus site; ~1 min) |
pnpm run typecheck |
tsc --noEmit |
pnpm run lint |
ESLint + markdownlint |
pnpm run lint:fix |
Auto-fix lint issues |
pnpm run build |
Compile with tsc (ESM-only + types) |
All of these are also exposed as mise tasks (mise tasks to list):
mise run setup | lint | lint:fix | typecheck | test | build | release.
The example sites have their own READMEs:
examples/site (mocked, drives the e2e) and
examples/gitlab (live gitlab.com data).
They have mise tasks too — each rebuilds the plugin's dist/ first:
| Task | What it does |
|---|---|
mise run gitlab:build / gitlab:start |
Build / serve the showcase site (examples/gitlab, live gitlab.com data) |
mise run site:build / site:start |
Build / serve the e2e fixture site (examples/site) — its stub projects 404 against real gitlab.com, so site:build needs GITLAB_HOST pointing at an instance that has them (the e2e test provides a stub); site:start works in dev (failed fetches render the Fallback) |
Both sites read GITLAB_TOKEN / GITLAB_HOST from the environment.
- TDD: write the failing test first, then the implementation.
- ESM: intra-package imports use explicit
.jsextensions (e.g.import { Fallback } from "./Fallback.js"). - Pure components: React components render from a
data/errorprop only — no fetching, no hooks. - Anything rendered via
dangerouslySetInnerHTMLmust go throughrenderMarkdown(which sanitizes). Never feed raw API text to it. - See
CLAUDE.mdfor the full architecture, module map, gotchas, and a step-by-step recipe for adding a new component.
pnpm install sets up a husky pre-commit hook that runs lint-staged:
ESLint --fix on staged TS/JS and markdownlint on the root docs. If the hook
blocks your commit, run pnpm run lint:fix and re-stage.
Before opening a PR, make sure these pass:
pnpm run lint && pnpm run typecheck && pnpm testKeep changes focused, and add/adjust tests for any behavior you change.
Releases are automated with release-please and published to npm with provenance via OIDC trusted publishing.
- Land changes on
mainusing conventional commits (feat:,fix:,chore:, …).feat:bumps the minor version,fix:the patch version. - release-please opens/maintains a release PR (
chore: release x.y.z) that bumpspackage.json+.release-please-manifest.jsonand updates the changelog. - Merge the release PR. The
Releaseworkflow tags the release and thepublishjob runsnpm publish --provenance --access public. No npm token is stored — publishing authenticates via GitHub OIDC.
mise run release runs the full gate locally (frozen install, lint, typecheck,
test, build) and then shows the pending release PR — it never publishes.
- On npmjs.com, add
ebuildy/docusaurus-plugin-gitlab+.github/workflows/release.ymlas a trusted publisher for@ebuildy/docusaurus-plugin-gitlab. - First publish only: because the package name does not yet exist on npm, the
very first publish may need to be bootstrapped manually from a clean checkout:
pnpm install --frozen-lockfile && pnpm run build && npm publish --access public(without--provenance, which requires CI/OIDC). Subsequent releases publish automatically.
This repo is set up to be worked on with Claude Code, Anthropic's CLI coding agent.
-
Install the CLI (once):
npm install -g @anthropic-ai/claude-code
-
Run it from the repo root:
claude
-
Project context is automatic. Claude Code reads
CLAUDE.mdon start — it describes the architecture, conventions (TDD, ESM.jsimports, pure components), security rules (markdown sanitization), and how to add a component. KeepCLAUDE.mdupdated when you change how the project works; it's the agent's source of truth. -
Repo helpers. Project-scoped slash commands and skills live under
.claude/. Claude Code discovers them automatically.
Other agents (Copilot CLI, Gemini CLI, etc.) can also use CLAUDE.md as their
project brief. If you add agent-specific config, document it here.