Skip to main content

Build And Release

The current package is @plato/pc-printer.

Scripts

ScriptCommandPurpose
cleannode scripts/clean.jsRemoves build artifacts, output, logs, zip, and dump.rdb.
buildesbuild src/index.ts src/scripts/*.ts --bundle --platform=node --target=node12 --outdir=distBundles runtime code.
startnode dist/index.jsStarts the built driver.
pkgpkg dist/index.js -t node12-win-x64 -o output/plato-printer.exe --config package.jsonCreates Windows executable.
bundleversion bump, build, Redis prep, pkg, zipProduces plato-printer.zip.
stressnode scripts/stress-test.jsRuns mock-printer load test.

Build Locally

pnpm --filter @plato/pc-printer clean
pnpm --filter @plato/pc-printer build
pnpm --filter @plato/pc-printer start

Create Release Zip

pnpm --filter @plato/pc-printer bundle
The bundle script:
  1. Increments src/version.ts.
  2. Builds the driver into dist.
  3. Prepares the configured Windows Redis binary.
  4. Builds output/plato-printer.exe.
  5. Copies config.json.
  6. Copies Caddy assets.
  7. Copies certificates.
  8. Copies redis-binaries/<redis.version>.
  9. Creates plato-printer.zip.

Release Contents

plato-printer.exe
config.json
assets/
  caddy/
  certs/
redis-binaries/

Versioning

src/version.ts contains:
export const BUILD_VERSION = 66;
The build version is returned by GET /health and printed in the startup banner. Do not edit this file manually; scripts/increment-version.js updates it during pnpm bundle.

Caddy Preparation

Caddy is pinned to 2.6.4. To download Caddy into assets/caddy before bundling:
pnpm --filter @plato/pc-printer exec node scripts/download-caddy.js
If assets/caddy/caddy.exe exists, runtime setup can copy it instead of downloading Caddy on the customer machine.

Redis Binary Preparation

scripts/prepare-redis-binaries.js reads config.json and downloads the configured Windows Redis release if missing. The expected path is:
redis-binaries/<version>/Redis-<version>-Windows-x64-msys2/redis-server.exe

Stress Test

The stress test starts mock TCP printers and sends many /print requests.
pnpm --filter @plato/pc-printer stress
Useful options:
node scripts/stress-test.js \
  --host http://127.0.0.1:8080 \
  --printers 5 \
  --jobs 100 \
  --base-port 9200 \
  --poll-ms 500 \
  --timeout-ms 60000
The test passes when all target queues drain.

Release Checklist

  1. Confirm config.json is correct for the release.
  2. Confirm Caddy assets exist if HTTPS should work offline.
  3. Run pnpm --filter @plato/pc-printer clean.
  4. Run pnpm --filter @plato/pc-printer bundle.
  5. Run the executable from output/.
  6. Check GET /health.
  7. Run a real test print.
  8. Verify plato-printer.zip contains the expected files.