@jsonpages/cli 3.0.50 β 3.0.51
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/assets/src_tenant_alpha.sh +21 -33
- package/package.json +1 -1
|
@@ -78,11 +78,7 @@ function App() {
|
|
|
78
78
|
.then((list: LibraryImageEntry[]) => setAssetsManifest(Array.isArray(list) ? list : []))
|
|
79
79
|
.catch(() => setAssetsManifest([]));
|
|
80
80
|
}, []);
|
|
81
|
-
|
|
82
|
-
console.log("π DEBUG ENV:", {
|
|
83
|
-
URL: import.meta.env.VITE_JSONPAGES_CLOUD_URL,
|
|
84
|
-
KEY: import.meta.env.VITE_JSONPAGES_API_KEY ? "PRESENT" : "MISSING"
|
|
85
|
-
});
|
|
81
|
+
|
|
86
82
|
const config: JsonPagesConfig = {
|
|
87
83
|
tenantId: TENANT_ID,
|
|
88
84
|
registry: ComponentRegistry as JsonPagesConfig['registry'],
|
|
@@ -95,34 +91,7 @@ console.log("π DEBUG ENV:", {
|
|
|
95
91
|
addSection: addSectionConfig,
|
|
96
92
|
persistence: {
|
|
97
93
|
async saveToFile(state: ProjectState, slug: string): Promise<void> {
|
|
98
|
-
|
|
99
|
-
// βοΈ SCENARIO A: CLOUD BRIDGE (Production)
|
|
100
|
-
if (CLOUD_API_URL && CLOUD_API_KEY) {
|
|
101
|
-
console.log(`βοΈ Saving ${slug} via Cloud Bridge...`);
|
|
102
|
-
|
|
103
|
-
const res = await fetch(`${CLOUD_API_URL}/save`, {
|
|
104
|
-
method: 'POST',
|
|
105
|
-
headers: {
|
|
106
|
-
'Content-Type': 'application/json',
|
|
107
|
-
'Authorization': `Bearer ${CLOUD_API_KEY}`
|
|
108
|
-
},
|
|
109
|
-
body: JSON.stringify({
|
|
110
|
-
// Mapping logical slug to physical path in repo
|
|
111
|
-
path: `src/data/pages/${slug}.json`,
|
|
112
|
-
// We save the page config specifically
|
|
113
|
-
content: state.page,
|
|
114
|
-
message: `Content update for ${slug} via Visual Editor`
|
|
115
|
-
}),
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
if (!res.ok) {
|
|
119
|
-
const err = await res.json().catch(() => ({}));
|
|
120
|
-
throw new Error(err.error || `Cloud save failed: ${res.status}`);
|
|
121
|
-
}
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// π» SCENARIO B: LOCAL FILESYSTEM (Development)
|
|
94
|
+
// Local only (cloud uses saveToFileStream and Coreβs SaveProgressDrawer)
|
|
126
95
|
console.log(`π» Saving ${slug} to Local Filesystem...`);
|
|
127
96
|
const res = await fetch('/api/save-to-file', {
|
|
128
97
|
method: 'POST',
|
|
@@ -133,6 +102,25 @@ console.log("π DEBUG ENV:", {
|
|
|
133
102
|
const body = (await res.json().catch(() => ({}))) as { error?: string };
|
|
134
103
|
if (!res.ok) throw new Error(body.error ?? `Save to file failed: ${res.status}`);
|
|
135
104
|
},
|
|
105
|
+
...(CLOUD_API_URL && CLOUD_API_KEY
|
|
106
|
+
? {
|
|
107
|
+
saveToFileStream: async (state: ProjectState, slug: string): Promise<Response> => {
|
|
108
|
+
const res = await fetch(`${CLOUD_API_URL}/save-stream`, {
|
|
109
|
+
method: 'POST',
|
|
110
|
+
headers: {
|
|
111
|
+
'Content-Type': 'application/json',
|
|
112
|
+
Authorization: `Bearer ${CLOUD_API_KEY}`,
|
|
113
|
+
},
|
|
114
|
+
body: JSON.stringify({
|
|
115
|
+
path: `src/data/pages/${slug}.json`,
|
|
116
|
+
content: state.page,
|
|
117
|
+
message: `Content update for ${slug} via Visual Editor`,
|
|
118
|
+
}),
|
|
119
|
+
});
|
|
120
|
+
return res;
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
: {}),
|
|
136
124
|
},
|
|
137
125
|
assets: {
|
|
138
126
|
assetsBaseUrl: '/assets',
|