@jsonpages/cli 3.0.51 β†’ 3.0.53

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.
@@ -78,7 +78,11 @@ function App() {
78
78
  .then((list: LibraryImageEntry[]) => setAssetsManifest(Array.isArray(list) ? list : []))
79
79
  .catch(() => setAssetsManifest([]));
80
80
  }, []);
81
-
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
+ });
82
86
  const config: JsonPagesConfig = {
83
87
  tenantId: TENANT_ID,
84
88
  registry: ComponentRegistry as JsonPagesConfig['registry'],
@@ -91,7 +95,34 @@ function App() {
91
95
  addSection: addSectionConfig,
92
96
  persistence: {
93
97
  async saveToFile(state: ProjectState, slug: string): Promise<void> {
94
- // Local only (cloud uses saveToFileStream and Core’s SaveProgressDrawer)
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)
95
126
  console.log(`πŸ’» Saving ${slug} to Local Filesystem...`);
96
127
  const res = await fetch('/api/save-to-file', {
97
128
  method: 'POST',
@@ -102,25 +133,6 @@ function App() {
102
133
  const body = (await res.json().catch(() => ({}))) as { error?: string };
103
134
  if (!res.ok) throw new Error(body.error ?? `Save to file failed: ${res.status}`);
104
135
  },
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
- : {}),
124
136
  },
125
137
  assets: {
126
138
  assetsBaseUrl: '/assets',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonpages/cli",
3
- "version": "3.0.51",
3
+ "version": "3.0.53",
4
4
  "description": "The Sovereign CLI Engine for JsonPages.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,8 +8,7 @@
8
8
  },
9
9
  "files": [
10
10
  "src",
11
- "assets/src_tenant_alpha.sh",
12
- "assets/vercel.json"
11
+ "assets/src_tenant_alpha.sh"
13
12
  ],
14
13
  "author": "JsonPages Team",
15
14
  "license": "MIT",
package/src/index.js CHANGED
@@ -335,12 +335,6 @@ async function injectInfraFiles(targetDir, name) {
335
335
  }
336
336
  };
337
337
  await fs.writeJson(path.join(targetDir, 'components.json'), shadcnConfig, { spaces: 2 });
338
-
339
- // Vercel deploy config (SPA rewrites + asset cache)
340
- const vercelJsonPath = path.resolve(__dirname, '../assets/vercel.json');
341
- if (fs.existsSync(vercelJsonPath)) {
342
- await fs.copy(vercelJsonPath, path.join(targetDir, 'vercel.json'));
343
- }
344
338
  }
345
339
 
346
340
  program.parse();
@@ -1 +0,0 @@
1
- {"rewrites":[{"source":"/(.*)","destination":"/index.html"}],"headers":[{"source":"/assets/(.*)","headers":[{"key":"Cache-Control","value":"public, max-age=31536000, immutable"}]}]}