# Source and build

Yaxii Smart Form Lite ships ready to use. Building is **not required** to install or run the plugin — the generated `assets/build/admin/` and `assets/build/storefront/` output in this ZIP is already what the plugin loads.

This file exists so a WordPress.org reviewer (or anyone else) can confirm the generated/minified assets in this package were produced from the human-readable source also included in this package, and can reproduce them exactly.

## Where the source lives in this ZIP

| Generated output | Human-readable source | Build config |
|---|---|---|
| `assets/build/admin/index.js`, `index.css`, `index-rtl.css` | `app/yaxii-smart-forms/src/**` (React/TypeScript) | `webpack.config.js`, `tsconfig.json`, `app/yaxii-smart-forms/tsconfig.json`, `app/yaxii-smart-forms/components.json` |
| `assets/build/storefront/form.css`, `form.js` | `assets/src/storefront/**` (plain CSS/JS) | `tools/build-storefront-assets.mjs`, `postcss.config.cjs`, `tailwind.storefront.config.cjs` |
| WordPress.org language packs (not bundled) | PHP and React/TypeScript gettext calls plus `languages/yaxii-smart-form-lite.pot` | WordPress.org translation tooling; the admin handle registers `wp_set_script_translations()` |
| `vendor/autoload.php`, `vendor/composer/*` | `composer.json` (also included) | `composer install` / `composer dump-autoload` — see below |

Dependency manifests: `package.json` and `package-lock.json` (npm workspace root, exact pinned versions) and `app/yaxii-smart-forms/package.json` (the admin app's own dependency list, resolved through the root lockfile).

## Requirements

- Node.js `>=22 <23` and npm `>=10` (declared in `package.json` → `engines`).
- PHP `>=7.4` and Composer, for the PSR-4 autoloader only (the plugin has no third-party PHP runtime dependency).

## Exact install command

```
npm install
```

Run from the plugin root. This installs the root workspace and the `app/yaxii-smart-forms` workspace together (npm workspaces).

## Exact build commands

Admin (React) interface:

```
node node_modules/@wordpress/scripts/bin/wp-scripts.js build
```

This runs `@wordpress/scripts build` against `webpack.config.js`, which compiles `app/yaxii-smart-forms/src/index.tsx` and its imports into `assets/build/admin/index.js`, `index.css`, and `index-rtl.css`.

Storefront assets:

```
node tools/build-storefront-assets.mjs
```

This processes `assets/src/storefront/form.css` and `shipping-preview.css` through PostCSS/Tailwind and concatenates the storefront JS modules (`quote-client.js`, `form-view.js`, `order-submission.js`, `form.js`) into `assets/build/storefront/form.css` and `form.js`.

(The plugin's own `npm run build` script additionally runs a repository-internal architecture assertion, `tools/assert-frontend-architecture.mjs`, before these two steps. That assertion is development QA tooling — not part of the build — and is intentionally not included in this package; the two commands above are the exact, complete, and sufficient build. Both were run against this package's own source during release verification and produced byte-identical output to the `assets/build/` files already in this ZIP.)

PHP autoloader (only needed if `vendor/` is regenerated from source):

```
composer install --no-dev
composer dump-autoload --no-dev --classmap-authoritative
```

## Expected output directories

- `assets/build/admin/`
- `assets/build/storefront/`
- `vendor/` (autoloader only; no third-party PHP package is installed)

## What is not included

Development-only tooling not required to reproduce the shipped output is intentionally left out of this package to keep it minimal: test suites (`tests/`), the PHP/JS QA and architecture-assertion scripts under `tools/` other than the one storefront build script above, linting configuration, and internal `.agents` process records. None of that is needed to build or run the plugin; it exists in the plugin's public source repository for contributors.
