# Building checkout assets

The release includes readable PHP, CSS and classic JavaScript, plus Blocks source in `src/` and the build script in `scripts/build.js`. No runtime Composer packages or separate React runtime are required.

Use Node.js 18 or newer and npm. In the extracted plugin directory run:

```
npm ci
npm run build
```

`package-lock.json` pins esbuild 0.28.2. The build produces `assets/build/editor.js`, `frontend.js`, their `.asset.php` dependency/version files and `block.json`. Keep all generated files together. WordPress and WooCommerce supply the external packages listed by the dependency files. Do not enqueue a separate React runtime. The classic scripts and styles require no build.

For translation extraction, with WP-CLI's i18n command available, build first and run:

```
wp i18n make-pot . languages/code-crafters-order-bumps-for-woocommerce.pot --slug=code-crafters-order-bumps-for-woocommerce --domain=code-crafters-order-bumps-for-woocommerce --exclude=vendor,node_modules,tests,docs,src,scripts,.test-env,dist
```

Strings are extracted from compiled Blocks assets so translation references match the registered script paths. Translators can use the POT to produce MO files for PHP and WordPress JSON catalogs for scripts. The ZIP includes no translated language packs.

For a local Windows ZIP, run `powershell -NoProfile -File scripts/package.ps1` after rebuilding assets and refreshing the POT. This uses an explicit file allowlist, checks release versions and refuses to overwrite an existing ZIP. It creates `dist/code-crafters-order-bumps-for-woocommerce-VERSION.zip` with exactly one plugin directory, readable source and build instructions. It excludes development dependencies, tests, disposable sites, editor instructions and credentials. Packaging does not publish the plugin or validate a release on WordPress.

To preserve an earlier candidate, add `-OutputDirectory dist/submission-YYYY-MM-DD`. The output directory must stay inside the plugin workspace. The package version is read from the plugin header and must match the readme and build manifests. Unpublished candidates are preserved in separate directories.
