# Rebuilding the distributed plugin

This archive includes the editable source and build tools so no private repository access is required. Normal WordPress installation does not require running these commands.

## JavaScript

Use Node.js 22 and npm. From the plugin directory:

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

The entry point is `resources/editor.js`; esbuild bundles its imported modules and npm dependencies into `assets/editor.js`. Hand-maintained CSS, fonts and branding live in `assets/`. Exact dependency versions are in `package-lock.json`. Complete dependency copyright notices are in `THIRD-PARTY-LICENSES.txt`.

## PHP PDF runtime

Use PHP 8.1+ with mbstring, Composer 2 and Python 3:

```sh
composer install
python3 tools/build-vendor.py
```

`composer.lock` pins TCPDF and the development-only PHP-Scoper tool. `tools/scoper.php` scopes TCPDF under `PrintRelayVendor`; the builder includes the required font metrics and enables exception handling. Output goes to `vendor-prefixed/tcpdf`. The plugin loads that directory through `autoload.php`; it does not load the root development vendor directory.

When distributing a rebuilt copy, exclude root `vendor/` and `node_modules/` while retaining source files, lockfiles, these instructions, the two PHP-runtime build files and all licence notices. Test changes on staging before installing them on a live store.
