Files
ipal-kit/README.md
T
Radosław SmolińskiandClaude Opus 5.5 ab51027617 Payload 3.94.1, dependency updates, overrides re-checked
- payload and every @payloadcms/* 3.94.1 in the plugin's dev dependencies, the
  reference site and the starter (peer range unchanged: ^3.90.2); react/react-dom
  19.3.1; reference engines node >=22.23.5 <23 (Payload 3.94's minimum).
- Overrides re-checked: dompurify and happy-dom still needed; mongoose (3.90–3.93)
  and undici (3.90–3.91) only on an older Payload; graphql-scalars no longer needed
  (GHSA-x8rm-f576-gq67 covers 1.24.1–2.0.0; Payload pins 1.22.2). Reference keeps
  dompurify + happy-dom; plugin root drops graphql-scalars.
- ipal-doctor transitive-min: the mongoose fix names the Payload upgrade first.
- nodemailer 10.6.1; dev: playwright 1.65.1, vitest 5.1.1, prettier 3.10.1,
  @swc/cli 0.8, rimraf 6 (clean uses --glob), cross-env 10, open 11,
  sort-package-json 4, @swc-node/register 1.12.1, vite-tsconfig-paths 6.1.1;
  reference tailwind 4.3.5, postcss 8.5.33.
- Kept back: typescript 7, eslint 10, graphql 17, @types/node 26, lucide-react 1.x.
- AGENT.md §4 item 12, ipal-setup, ipal-upgrade, README, PROGRAMISTA §1, forms.md,
  doctor.md; reference skills copy; CHANGELOG Unreleased.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 15:18:58 +01:00

201 lines
9.3 KiB
Markdown

# @intecion/ipal-kit
Intecion Payload Advanced Library — a plugin for Payload CMS 3.
Provides internationalization (per-locale routing, hreflang, language switcher),
SEO (metadata, canonical, sitemap, robots), forms (Turnstile, rate limiting,
validation), consent management (consent mode), analytics (GA4/GTM), and a
blog/archive system (collections under an archive page, listing, pagination).
**Principle:** ipal-kit helps projects, never limits them — every module can be
turned off on its own, every default (access, fields, hooks, labels, routes,
collections, globals) can be overridden and the project's config wins, and the
building blocks are exported, not only the finished features. Where the code
doesn't meet this yet, the module's doc says so.
**Repository:** https://git.intecion.net/IntecionSoftware/ipal-kit
---
## Installation
The plugin is published to a **public package registry** on the company Gitea.
Installing it needs no token — just point the `@intecion` scope at the registry.
**1. Point the scope at the registry.** Add this line to an `.npmrc` file in your
project (or to `~/.npmrc` to apply it everywhere):
```
@intecion:registry=https://git.intecion.net/api/packages/IntecionSoftware/npm/
```
Only packages starting with `@intecion/` go to Gitea. Everything else
(`react`, `next`, `@payloadcms/*`, …) still comes from the public npm registry —
this line is a scoped override, not a change of your default registry. The file
holds no secret, so you can commit it (and you should — your deployment needs it
too).
**2. Install:**
```bash
pnpm add @intecion/ipal-kit
```
That's it. No token, no login — the registry is public for reads.
### Why the registry, not a git install
You *can* install straight from the repo
(`pnpm add git+https://git.intecion.net/IntecionSoftware/ipal-kit.git`), and for a
quick throwaway test it works. But prefer the registry for real projects:
- **Client components resolve correctly.** A git install unpacks into a
commit-hashed path (`.pnpm/@intecion+ipal-kit@git+https…#hash/…`) that breaks
Next.js's React Client Manifest — the consent banner, analytics, and Turnstile
components fail at runtime with "Could not find the module … in the React
Client Manifest". The registry unpacks to a clean `node_modules/@intecion/…`
path, so this doesn't happen.
- **Versioning.** `pnpm` sees a real version number, so a version bump cleanly
replaces the old one — no cache-clearing dance.
Keep the git install only for pulling a specific unreleased commit during
plugin development.
### A new site in one command
```bash
pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create intecion.com
```
Asks the architecture questions (or reads `--answers answers.json`), generates the site from the reference
site with every team convention, installs it from a shipped lockfile and makes the first commit. Needs the
`@intecion` registry line in `~/.npmrc`. Details: [docs/project-starter.md](./docs/project-starter.md).
---
## Finish setting up your project
`nodemailer`, `lucide-react`, `slugify` and `server-only` are regular
`dependencies` of the plugin — they install with it; don't add them yourself.
The plugin's `nodemailer` 10 needs **Node.js 20 or later**; Payload 3.94 itself needs **Node.js 22.23.5 or later**
on the 22 line.
What you provide are the **peer dependencies** — packages the plugin shares with
your project — in a version matching your Payload. The plugin accepts Payload `^3.90.2`; the reference site and the starter use
**3.94.1** (with `react` / `react-dom` 19.3.1, which Payload 3.94 requires):
| Peer | Range | Notes |
|---|---|---|
| `payload`, `@payloadcms/next`, `@payloadcms/ui`, `@payloadcms/richtext-lexical` | `^3.90.2` | already in a `create-payload-app` project |
| `next`, `react` | `>=15`, `^19.0.0` | already in a `create-payload-app` project |
| `@payloadcms/plugin-seo`, `@payloadcms/plugin-form-builder` | `^3.90.2` | **add these** |
| `@clocklimited/payload-2fa` | `^3.0.0-0` | optional peer, but **needed by default**: 2FA is enforced and `ipalKit()` throws at startup unless you pass `twoFactor: { issuer, plugin: payloadTotp }` (or opt out with `twoFactor: false`) |
| `@payloadcms/storage-s3` | `^3.90.2` | optional — only when media go to Cloudflare R2 ([docs/storage.md](./docs/storage.md)) |
```bash
pnpm add @payloadcms/[email protected] @payloadcms/[email protected] \
@clocklimited/payload-2fa
pnpm add @payloadcms/[email protected] # only with R2 media
```
Keep every `@payloadcms/*` at exactly the same version as `payload`
(`pnpm.overrides` — see PROGRAMISTA.md §1). Then run `pnpm audit --prod`: even
Payload 3.94.1 brings a vulnerable `happy-dom` (via Lexical) and `dompurify` — add
the two overrides from [AGENT.md §4 item 12](./docs/agent/AGENT.md); an older Payload
also needs the `mongoose` (MongoDB adapter, up to 3.93) and `undici` (up to 3.91)
ones listed there (recommended, not required by the plugin). Upload optimization and image
placeholders also use the `sharp` you pass to `buildConfig({ sharp })`
(standard in a `create-payload-app` project).
> **`lucide-react` comes with the plugin, at `^0.400.0`.** For a `0.x` version
> the caret means **`0.400.x` only** — not "0.400 or newer". If your project also
> uses `lucide-react` at another version (e.g. `0.5xx` or `1.x`), you end up with two
> copies and confusing type errors. Pin your project to `~0.400.0` too.
**Working with an AI agent?** Run this right after installing (and after every upgrade):
```bash
pnpm exec ipal-skills
```
It copies the `ipal-*` agent skills into `.agents/skills/` and adds a marked
`<!-- ipal-kit:start -->` block to `AGENTS.md` (plus a `CLAUDE.md` that imports it, if you
have none) pointing the agent at the full guide: `AGENT.md`, the `ipal-reference` skill
(every option, env var, route and export) and the `ipal-setup` skill. Only the text between
the markers is ever rewritten. `--no-pointer` skips that step. There is no `postinstall` script.
`pnpm exec ipal-skills --external` also adds a few well-known third-party skills as `ext-*` folders — Vercel's
React best practices and composition patterns, Addy Osmani's accessibility skill, Anthropic's frontend-design
skill and the official Payload 3 skill. They are vendored into the package at pinned commits (text only, each
with its licence and source), so nothing is downloaded, and each starts with a note that ipal-kit's rules win.
Pick some with `--external ext-accessibility,ext-payload`.
*Updating the pins (plugin maintainers):* change the commit in `scripts/vendor-external-skills.mjs`, run
`node scripts/vendor-external-skills.mjs`, review `git diff docs/agent/external`, and run
`pnpm vitest run test/externalSkills.test.ts`.
From here, the guide takes over: **[docs/dev/PROGRAMISTA.md](./docs/dev/PROGRAMISTA.md)** —
from an empty project to a working site.
---
## Publishing a new version
This section applies only if you develop the plugin itself. Publishing (unlike
installing) **does** need a token, with the `write:package` scope.
In `~/.npmrc` (path differs per OS — see the table below):
```
//git.intecion.net/api/packages/IntecionSoftware/npm/:_authToken=${GITEA_TOKEN}
```
Generate the token in Gitea → **Settings → Applications → Generate New Token**,
scope `write:package`. Put it in the `GITEA_TOKEN` env var.
| System | Global `.npmrc` path |
|---|---|
| macOS | `~/.npmrc` |
| Linux / Ubuntu | `~/.npmrc` |
| Windows | `%USERPROFILE%\.npmrc` |
Then version and publish (commit your changes first — `npm version` needs a
clean working tree):
```bash
npm version patch # 1.0.0 → 1.0.1 (commit + tag)
npm publish # prepublishOnly runs: pnpm clean && pnpm build && pnpm test:int
git push && git push --tags
```
`publishConfig.registry` in `package.json` already points at the Gitea registry,
so `npm publish` needs no `--registry` flag. A failing build or test aborts the
publish.
Full checklist and troubleshooting: **[docs/dev/PROGRAMISTA.md §8](./docs/dev/PROGRAMISTA.md)**.
---
## Documentation
Everything lives in the **[docs/](./docs)** directory. To get started:
- **[AGENT.md](./docs/agent/AGENT.md)** — rules for AI agents
- **[PROGRAMISTA.md](./docs/dev/PROGRAMISTA.md)** — setup, deployment, upgrades, releasing
- **[README.md](./docs/README.md)** — index of the plugin's modules
- **[CHANGELOG.md](./docs/CHANGELOG.md)** — what changed per version and what projects must update
---
## Something not working?
| What you see | What's wrong |
|---|---|
| `404` on `pnpm add @intecion/...` | the `@intecion:registry` line is missing from `.npmrc` — the install went to public npm instead of Gitea |
| `Could not find the module … in the React Client Manifest` | installed from git, not the registry — reinstall from the registry (clean path) |
| two versions of `lucide-react` | your project uses a `lucide-react` outside the plugin's `^0.400.0` (= `0.400.x`) — align them |
| `[ipal] 2FA is enforced but no 2FA plugin was injected` | install `@clocklimited/payload-2fa` and pass `twoFactor: { issuer, plugin: payloadTotp }` |
| `missing secret key … to secure Payload` | `PAYLOAD_SECRET` isn't set in the runtime environment (not a plugin issue) |
If you get stuck, see **[docs/dev/PROGRAMISTA.md](./docs/dev/PROGRAMISTA.md)** or message the
team that maintains the plugin.