# Build CommentMate 1.0.9

Readable frontend source is included in `assets/src`; PHP source is in `includes`.
Use Node.js 22.12 or later and npm 10 or later in a separate copy of the unpacked
plugin, never in a running site's installed plugin directory.

```sh
npm ci
npm run typecheck
npm run build
```

The locked npm dependencies are fetched from the public npm registry. Vite builds
`assets/build/commentmate.js` and its local App, composer and screenshot chunks from
`assets/src/boot.tsx` using `vite.config.ts`. The source and lockfile supplied in this package reproduce the
frontend build without any private repository, workspace helper or API key.
WordPress core's wp-i18n is an external script dependency; it is not bundled.
The separately enqueued assets/styles/bridge.css contains the document layout
and cursor rules. Visual review styles remain scoped to the Shadow DOM.
Tests and internal release tooling are not distributed; the build does not need
them. Do not upload node_modules, .git, caches or development/test files to a site.
See third-party-notices.txt for upstream source package names and MIT notices.

Translation catalog

`languages/commentmate.pot` contains PHP and frontend messages with their
original TypeScript/TSX source references. WP-CLI alone does not scan these
frontend extensions. After installing the locked build dependencies, regenerate
the merged catalog with local WP-CLI available on PATH:

```sh
node languages/generate-pot.mjs
```

For a local WP-CLI PHAR, set `WP_CLI_PHAR` to its path and `PHP_BINARY` to the
local PHP executable. The generator transpiles the frontend into disposable
staging under the adjacent `_runtime/commentmate-i18n-extraction` directory,
remaps references to the original source, adds the placeholder explanations from
`languages/frontend-notes.json`, and merges frontend strings with PHP extraction.
The source files and translator notes remain authoritative.

To turn an approved translated PO into the JSON catalog used by the review
script, preserve the PO and map all frontend references to the built script:

```sh
wp i18n make-json languages/commentmate-de_DE.po languages --no-purge \
  --extensions=ts,tsx --use-map=languages/frontend-map.json
```

Replace `de_DE` with the translation's locale. WordPress loads the resulting
`commentmate-LOCALE-MD5.json` from `languages` through the registered script
translations; the hash is for `assets/build/commentmate.js`. PHP translations
also require the locale's compiled MO file. The package includes the POT and
source-to-build mapping, without incomplete test translations.

Review App and rich text composer load as separate modules after the classic entry and WordPress catalog. Source translation mapping continues to target assets/build/commentmate.js.
