create-avocado-site 0.11.1 → 0.11.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/dist/templates/common.js +37 -4
- package/dist/templates/demo-app.js +48 -0
- package/dist/versions.d.ts +1 -1
- package/dist/versions.js +1 -1
- package/package.json +3 -3
package/dist/templates/common.js
CHANGED
|
@@ -172,12 +172,45 @@ export function envExample(config) {
|
|
|
172
172
|
# service to start — this must name this app's own origin, not port 4200.
|
|
173
173
|
ORCHESTRATOR_URL=http://localhost:${config.sitePort}/api/avocado
|
|
174
174
|
|
|
175
|
-
# Where the editor is served from. Named
|
|
176
|
-
# editor API
|
|
177
|
-
#
|
|
178
|
-
#
|
|
175
|
+
# Where the editor is served from. Named three times on every request — CORS on
|
|
176
|
+
# the editor API, \`frame-ancestors\` on the preview, and \`corsOrigins\` on the
|
|
177
|
+
# orchestrator route you mount — and \`withAvocado\` derives the first two from
|
|
178
|
+
# this one variable. Get it wrong and the site reads as offline while the
|
|
179
|
+
# preview stays a blank rectangle, neither of which mentions a port.
|
|
180
|
+
#
|
|
181
|
+
# The third is yours to pass. \`createOrchestrator\` with \`corsOrigins\` unset
|
|
182
|
+
# sends no CORS headers under NODE_ENV=production — the right default for a
|
|
183
|
+
# route nobody has told where its editor is, and the reason a production editor
|
|
184
|
+
# can show "Cannot reach the orchestrator" while every route it names answers
|
|
185
|
+
# 200 to curl. Pass it:
|
|
186
|
+
#
|
|
187
|
+
# corsOrigins: process.env.EDITOR_CORS_ORIGINS?.split(",")
|
|
188
|
+
# .map((o) => o.trim()).filter(Boolean),
|
|
179
189
|
EDITOR_CORS_ORIGINS=http://localhost:${config.editorPort}
|
|
180
190
|
|
|
191
|
+
# The same origin again, for the half that reads a different name. The
|
|
192
|
+
# allowlist deciding which origin may drive inline edits over postMessage, and
|
|
193
|
+
# which may be trusted when it arrives in a URL, reads only this and
|
|
194
|
+
# AVOCADO_EDITOR_ORIGINS — never EDITOR_CORS_ORIGINS. Unset in production, the
|
|
195
|
+
# SDK warns on the first editor API request. Set both to the same origin.
|
|
196
|
+
NEXT_PUBLIC_EDITOR_ORIGIN=http://localhost:${config.editorPort}
|
|
197
|
+
|
|
198
|
+
# Which loopback origins the orchestrator may fetch server-side.
|
|
199
|
+
#
|
|
200
|
+
# In the standalone and Docker deployments this is the orchestrator's CORS
|
|
201
|
+
# allowlist, which is what the deployment docs describe. In library mode CORS
|
|
202
|
+
# comes from \`corsOrigins\` on the route above, so here the variable has exactly
|
|
203
|
+
# one remaining job: \`publish/diff\` fetches the site's published pages from
|
|
204
|
+
# \`siteOrigin\`, and a private address is refused under NODE_ENV=production
|
|
205
|
+
# unless it is listed here. That check is right — an unchecked loopback value
|
|
206
|
+
# would turn the orchestrator into a proxy onto its own host — but with nothing
|
|
207
|
+
# listed, the production Publish panel answers
|
|
208
|
+
# \`400 siteOrigin is not an allowed URL\` for this site's own origin.
|
|
209
|
+
#
|
|
210
|
+
# On a real deployment the site origin is public and passes without this. It is
|
|
211
|
+
# here because \`npm run build && npm start\` on your own machine is not.
|
|
212
|
+
ORCHESTRATOR_CORS_ORIGINS=http://localhost:${config.sitePort}
|
|
213
|
+
|
|
181
214
|
# Any long random string; this one was generated for you. Without it draft mode
|
|
182
215
|
# does not work, and the editor quietly renders the published page instead of
|
|
183
216
|
# your edits.
|
|
@@ -174,6 +174,39 @@ ORCHESTRATOR_URL=http://localhost:${config.sitePort}/api/avocado
|
|
|
174
174
|
# mentions a port, CORS, or CSP.
|
|
175
175
|
EDITOR_CORS_ORIGINS=http://localhost:${config.editorPort}
|
|
176
176
|
|
|
177
|
+
# The same origin again, for the half that reads a different name.
|
|
178
|
+
#
|
|
179
|
+
# Three things need to know where the editor lives and they do not share a
|
|
180
|
+
# variable. EDITOR_CORS_ORIGINS above feeds CORS on /api/editor/* and
|
|
181
|
+
# \`frame-ancestors\` on the preview, and the orchestrator route reads it for
|
|
182
|
+
# its own CORS. This one feeds the allowlist that decides which origin may
|
|
183
|
+
# drive inline edits over postMessage and which may be trusted from a URL —
|
|
184
|
+
# a different question, asked by different code, which reads only this name
|
|
185
|
+
# and AVOCADO_EDITOR_ORIGINS.
|
|
186
|
+
#
|
|
187
|
+
# Until this line existed the scaffold wrote the first and not the second, so
|
|
188
|
+
# every generated project warned about its own generated config on every
|
|
189
|
+
# production boot — and the variable the warning named was not the one that
|
|
190
|
+
# fixed the symptom people were chasing. Set both to the same origin; add
|
|
191
|
+
# AVOCADO_EDITOR_ORIGINS only if you run more than one editor deployment.
|
|
192
|
+
NEXT_PUBLIC_EDITOR_ORIGIN=http://localhost:${config.editorPort}
|
|
193
|
+
|
|
194
|
+
# Which loopback origins the orchestrator may fetch server-side.
|
|
195
|
+
#
|
|
196
|
+
# In the standalone and Docker deployments this is the orchestrator's CORS
|
|
197
|
+
# allowlist, which is what the deployment docs describe. In library mode CORS
|
|
198
|
+
# comes from \`corsOrigins\` on the route above, so here the variable has exactly
|
|
199
|
+
# one remaining job: \`publish/diff\` fetches the site's published pages from
|
|
200
|
+
# \`siteOrigin\`, and a private address is refused under NODE_ENV=production
|
|
201
|
+
# unless it is listed here. That check is right — an unchecked loopback value
|
|
202
|
+
# would turn the orchestrator into a proxy onto its own host — but with nothing
|
|
203
|
+
# listed, the production Publish panel answers
|
|
204
|
+
# \`400 siteOrigin is not an allowed URL\` for this site's own origin.
|
|
205
|
+
#
|
|
206
|
+
# On a real deployment the site origin is public and passes without this. It is
|
|
207
|
+
# here because \`npm run build && npm start\` on your own machine is not.
|
|
208
|
+
ORCHESTRATOR_CORS_ORIGINS=http://localhost:${config.sitePort}
|
|
209
|
+
|
|
177
210
|
# This site's public origin. It is the only thing a page cannot work out from
|
|
178
211
|
# its own content, and three tags need it: <link rel="canonical">, og:url, and
|
|
179
212
|
# an og:image resolved to an absolute URL — a relative one is legal in the
|
|
@@ -427,6 +460,21 @@ const handler = createOrchestrator({
|
|
|
427
460
|
writeOnPublish: true,
|
|
428
461
|
}),
|
|
429
462
|
previewUrl: "http://localhost:${config.sitePort}",
|
|
463
|
+
// Where the editor lives, so this route may answer it.
|
|
464
|
+
//
|
|
465
|
+
// Unset means "reflect the caller's origin in development, send no CORS
|
|
466
|
+
// headers in production", which is the right default for a route nobody has
|
|
467
|
+
// told where its editor is. It is also the shape of a defect two clean-room
|
|
468
|
+
// runs found: in production every route here answered 200 to curl and the
|
|
469
|
+
// editor showed "Cannot reach the orchestrator", because a response with no
|
|
470
|
+
// \`access-control-allow-origin\` is one the browser fetches and discards.
|
|
471
|
+
//
|
|
472
|
+
// This is the same variable the SDK reads for CORS on /api/editor/* and for
|
|
473
|
+
// \`frame-ancestors\` on the preview, so the three places that must agree
|
|
474
|
+
// about the editor's origin are set from one line in .env.local.
|
|
475
|
+
corsOrigins: process.env.EDITOR_CORS_ORIGINS?.split(",")
|
|
476
|
+
.map((origin) => origin.trim())
|
|
477
|
+
.filter(Boolean),
|
|
430
478
|
})
|
|
431
479
|
|
|
432
480
|
export const GET = handler
|
package/dist/versions.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* `@avocadostudio-ai/orchestrator-core`, already pinned there; naming it again
|
|
18
18
|
* here is how a project ends up with two.
|
|
19
19
|
*/
|
|
20
|
-
export declare const AVOCADO = "0.11.
|
|
20
|
+
export declare const AVOCADO = "0.11.3";
|
|
21
21
|
/**
|
|
22
22
|
* Next 15.5.15 rather than 16, because that is the version every example app
|
|
23
23
|
* and the demo site in this repository build and test against. The SDK
|
package/dist/versions.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* `@avocadostudio-ai/orchestrator-core`, already pinned there; naming it again
|
|
18
18
|
* here is how a project ends up with two.
|
|
19
19
|
*/
|
|
20
|
-
export const AVOCADO = "0.11.
|
|
20
|
+
export const AVOCADO = "0.11.3";
|
|
21
21
|
/**
|
|
22
22
|
* Next 15.5.15 rather than 16, because that is the version every example app
|
|
23
23
|
* and the demo site in this repository build and test against. The SDK
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-avocado-site",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"description": "Bootstrap a runnable Avocado Studio demo site, or wire Avocado into an existing Next.js project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@types/node": "^22.13.10",
|
|
35
35
|
"tsx": "^4.19.0",
|
|
36
36
|
"typescript": "^5.7.3",
|
|
37
|
-
"@avocadostudio-ai/site-sdk": "0.11.
|
|
38
|
-
"@avocadostudio-ai/shared": "0.11.
|
|
37
|
+
"@avocadostudio-ai/site-sdk": "0.11.3",
|
|
38
|
+
"@avocadostudio-ai/shared": "0.11.3"
|
|
39
39
|
},
|
|
40
40
|
"license": "Apache-2.0",
|
|
41
41
|
"homepage": "https://docs.avocadostudio.dev",
|