npm.io
0.1.16 • Published 5d agoCLI

esa-pcg-cli

Licence
MIT
Version
0.1.16
Deps
3
Size
477 kB
Vulns
0
Weekly
1.0K

esa-pcg-cli

CLI for building and deploying Next.js apps onto pages-cache-gateway (PCG) — an OpenNext-based deployment target that proxies incremental cache, tag cache, and <Image> optimization through a single self-hosted gateway.

esa-pcg-cli wraps @opennextjs/aws and injects PCG's wrapper / converter / incrementalCache / tagCache overrides automatically, so most projects don't need a hand-written open-next.config.ts.

Install

npm install --save-dev esa-pcg-cli
# or
pnpm add -D esa-pcg-cli

@opennextjs/aws is bundled as a regular dependency, so you don't need to add it yourself.

Quick start

Most projects need zero next.config changes — <Image> continues to use Next's built-in /_next/image route and the wrapper transparently signs the request to the gateway.

npx pcg build --dir .
npx pcg deploy --dir .       # or --local-dev for local-gateway mode

Declare image hosts as usual via next.config.images.{remotePatterns,domains}; the wrapper reuses that config to allow / reject incoming url= values, matching the semantics of next dev.

Commands

Command What it does
pcg build Runs OpenNext build with PCG overrides auto-injected. Generates .open-next/.
pcg deploy Uploads cache artifacts to OSS (via gateway-issued STS or local mode).
pcg serve Local dev server backed by the built .open-next/ (assets + spawned server function).
pcg upload-cache / upload-assets Lower-level upload primitives.
pcg purge Invalidates cached entries by tag / path.

Run pcg <cmd> --help for full option lists.

How it integrates with Next.js

Concern Handled by
ISR / on-demand revalidation PCG incrementalCache override talks to the gateway, which proxies OSS.
revalidateTag PCG tagCache override (Next.js nextMode) talks to the gateway's TableStore-backed tag store.
<Image> optimization The wrapper intercepts Next's built-in /_next/image?... route and forwards it to the gateway's signed /image/* endpoint. No next.config changes required.

License

MIT. See LICENSE.

Keywords