create-avocado-site 0.11.0 → 0.11.2
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 +21 -4
- package/dist/templates/demo-app.js +32 -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,29 @@ 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
|
+
|
|
181
198
|
# Any long random string; this one was generated for you. Without it draft mode
|
|
182
199
|
# does not work, and the editor quietly renders the published page instead of
|
|
183
200
|
# your edits.
|
|
@@ -174,6 +174,23 @@ 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
|
+
|
|
177
194
|
# This site's public origin. It is the only thing a page cannot work out from
|
|
178
195
|
# its own content, and three tags need it: <link rel="canonical">, og:url, and
|
|
179
196
|
# an og:image resolved to an absolute URL — a relative one is legal in the
|
|
@@ -427,6 +444,21 @@ const handler = createOrchestrator({
|
|
|
427
444
|
writeOnPublish: true,
|
|
428
445
|
}),
|
|
429
446
|
previewUrl: "http://localhost:${config.sitePort}",
|
|
447
|
+
// Where the editor lives, so this route may answer it.
|
|
448
|
+
//
|
|
449
|
+
// Unset means "reflect the caller's origin in development, send no CORS
|
|
450
|
+
// headers in production", which is the right default for a route nobody has
|
|
451
|
+
// told where its editor is. It is also the shape of a defect two clean-room
|
|
452
|
+
// runs found: in production every route here answered 200 to curl and the
|
|
453
|
+
// editor showed "Cannot reach the orchestrator", because a response with no
|
|
454
|
+
// \`access-control-allow-origin\` is one the browser fetches and discards.
|
|
455
|
+
//
|
|
456
|
+
// This is the same variable the SDK reads for CORS on /api/editor/* and for
|
|
457
|
+
// \`frame-ancestors\` on the preview, so the three places that must agree
|
|
458
|
+
// about the editor's origin are set from one line in .env.local.
|
|
459
|
+
corsOrigins: process.env.EDITOR_CORS_ORIGINS?.split(",")
|
|
460
|
+
.map((origin) => origin.trim())
|
|
461
|
+
.filter(Boolean),
|
|
430
462
|
})
|
|
431
463
|
|
|
432
464
|
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.2";
|
|
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.2";
|
|
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.2",
|
|
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/shared": "0.11.
|
|
38
|
-
"@avocadostudio-ai/site-sdk": "0.11.
|
|
37
|
+
"@avocadostudio-ai/shared": "0.11.2",
|
|
38
|
+
"@avocadostudio-ai/site-sdk": "0.11.2"
|
|
39
39
|
},
|
|
40
40
|
"license": "Apache-2.0",
|
|
41
41
|
"homepage": "https://docs.avocadostudio.dev",
|