esa-pcg-cli 0.1.23-beta.2 → 0.1.23-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -2
- package/dist/_inline-overrides.js +4 -4
- package/dist/adapters/wrappers/node-server.js +2 -2
- package/dist/astro-runtime/cache-provider.mjs +2 -2
- package/dist/bin/cli.js +5 -1
- package/dist/build/prepared-project.d.ts +17 -0
- package/dist/build/prepared-project.js +152 -0
- package/dist/commands/build-astro.d.ts +10 -0
- package/dist/commands/build-astro.js +14 -3
- package/dist/commands/build-next.d.ts +13 -0
- package/dist/commands/build-next.js +90 -73
- package/dist/commands/build-nuxt.d.ts +11 -0
- package/dist/commands/build-nuxt.js +8 -5
- package/dist/commands/build.d.ts +1 -0
- package/dist/commands/build.js +3 -2
- package/dist/commands/package.d.ts +9 -0
- package/dist/commands/package.js +170 -0
- package/dist/commands/prepare.d.ts +11 -0
- package/dist/commands/prepare.js +232 -0
- package/dist/config/default-open-next-config.js +6 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -2
- package/dist/runtime/cdn-purge.d.ts +1 -1
- package/dist/runtime/cdn-purge.js +3 -3
- package/dist/runtime/edge-context.d.ts +1 -1
- package/dist/runtime/edge-context.js +3 -3
- package/dist/runtime/efc-observability.cjs +11 -1
- package/dist/runtime/efc-observability.d.cts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,50 @@ contract is `node start.mjs`, `process.env.PORT || 3000`, and host `0.0.0.0`.
|
|
|
36
36
|
Relative `--out-dir` values are resolved from `--dir`. The default is
|
|
37
37
|
`.pcg/output`.
|
|
38
38
|
|
|
39
|
+
## Separate CI steps
|
|
40
|
+
|
|
41
|
+
Use a disposable CI working copy to run PCG injection, the project's build
|
|
42
|
+
script, and artifact packaging as separate steps:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx pcg prepare --framework nextjs --dir .
|
|
46
|
+
npm run build
|
|
47
|
+
npx pcg package --dir . --out-dir .pcg/output
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The same sequence supports `--framework astro` and `--framework nuxt`.
|
|
51
|
+
`package` reads the framework saved by `prepare`; an explicit `--framework`
|
|
52
|
+
must match. All commands must use the same project directory. Install the
|
|
53
|
+
project dependencies and the CLI before preparing, and keep that installation
|
|
54
|
+
available until packaging completes.
|
|
55
|
+
|
|
56
|
+
`prepare` does not build. It writes PCG configuration/runtime files and replaces
|
|
57
|
+
`scripts.build` with a generated runner, preserving the original build command
|
|
58
|
+
in `.pcg/prepared.json`. Next.js runs that command through OpenNext; a custom
|
|
59
|
+
OpenNext `buildCommand` remains authoritative. Astro keeps its original build
|
|
60
|
+
command and loads PCG's config overlay through the project config. Nuxt keeps
|
|
61
|
+
its original command with `NITRO_PRESET=esa-nitro-preset`. The runner supplies
|
|
62
|
+
the framework's required environment variables. npm `prebuild`/`postbuild`
|
|
63
|
+
hooks remain on the outer build script.
|
|
64
|
+
|
|
65
|
+
`prepare` accepts `--config` for Next.js/Astro, `--debug`, and
|
|
66
|
+
`--force-unsupported-next`. For a custom Astro config, pass the same config
|
|
67
|
+
path used by the original build script. The original script must build the
|
|
68
|
+
selected framework; PCG/OpenNext orchestration scripts are rejected to prevent
|
|
69
|
+
recursive builds. Repeating `prepare` with the same options is a no-op;
|
|
70
|
+
different options require a fresh working copy.
|
|
71
|
+
|
|
72
|
+
`package` requires a successful prepared build, performs the existing runtime
|
|
73
|
+
patches, dependency tracing and cache conversion, and validates the complete
|
|
74
|
+
`assets/`, `fc/`, `isr-cache/` layout before replacing the previous artifact.
|
|
75
|
+
It never runs a framework build. Astro packaging still needs the installed
|
|
76
|
+
project dependencies for tracing. Packaging can be repeated without rebuilding.
|
|
77
|
+
|
|
78
|
+
Injection files and modified configuration stay in the supplied CI working
|
|
79
|
+
copy until it is discarded. Do not commit them back to the source repository.
|
|
80
|
+
The existing `pcg build` command remains the one-command build/package flow
|
|
81
|
+
and does not require `prepare`.
|
|
82
|
+
|
|
39
83
|
## Local preview
|
|
40
84
|
|
|
41
85
|
```bash
|
|
@@ -89,7 +133,7 @@ contract as `esa-pcg-cli@0.1.17`.
|
|
|
89
133
|
ESA CDN cache. `PCG_CDN_PURGE_MODE=path` (the default) uses the embedded
|
|
90
134
|
OpenNext tag-to-path manifest and refreshes both route and `/_next/data` URLs;
|
|
91
135
|
`PCG_CDN_PURGE_MODE=tag` sends `cacheTags` directly. The inbound request must
|
|
92
|
-
carry `host` and `
|
|
136
|
+
carry `host` and `ali-esa-origin-site-id`, which the wrapper keeps in request-local
|
|
93
137
|
context. Next.js 16 `use cache` is routed through the composable-cache handler.
|
|
94
138
|
|
|
95
139
|
## Astro integration
|
|
@@ -101,7 +145,7 @@ Route Cache during build, so `isr-cache/` is empty.
|
|
|
101
145
|
|
|
102
146
|
Explicit `Astro.cache.invalidate()` / `context.cache.invalidate()` calls write
|
|
103
147
|
the tag invalidation and call Gateway `/cache/refresh` with the current
|
|
104
|
-
request's `host` and `
|
|
148
|
+
request's `host` and `ali-esa-origin-site-id`. Normal TTL/SWR expiry refreshes the
|
|
105
149
|
runtime object and does not issue an extra purge request. For the injected PCG
|
|
106
150
|
provider, the certified Astro 6/7 artifact patch preserves
|
|
107
151
|
`CDN-Cache-Control` and `Cache-Tag` through the Node adapter so ESA can build
|