@brightsideoy/kama 0.1.0-alpha.151 ā 0.1.0-alpha.153
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/bin/cli.js +26 -12
- package/dist/assets/index-Dro0smRn.js +164 -0
- package/dist/assets/index-EaDn3OUJ.css +1 -0
- package/dist/{dist-DvbQty0F.js ā dist-C-WAK7EF.js} +4 -2
- package/dist/index.html +2 -2
- package/dist/index.js +4 -2
- package/dist/schema-compiler.js +1 -1
- package/package.json +1 -1
- package/dist/assets/index-BJ80E0Sz.css +0 -1
- package/dist/assets/index-DknACOqv.js +0 -162
package/bin/cli.js
CHANGED
|
@@ -311,7 +311,7 @@ export default {
|
|
|
311
311
|
"schema:remote": `wrangler d1 execute ${dbName} --remote --file=../node_modules/@brightsideoy/kama/schema.sql`,
|
|
312
312
|
"seed:local": `wrangler d1 execute ${dbName} --local --file=seed.sql > /dev/null 2>&1`,
|
|
313
313
|
"seed:remote": `wrangler d1 execute ${dbName} --remote --file=seed.sql`,
|
|
314
|
-
"dev": "npm run schema:local && npm run seed:local && wrangler dev --
|
|
314
|
+
"dev": "npm run schema:local && npm run seed:local && wrangler dev --port 8787 --inspector-port 9239",
|
|
315
315
|
"deploy": "npm run schema:remote && npm run seed:remote && wrangler deploy"
|
|
316
316
|
},
|
|
317
317
|
dependencies: {
|
|
@@ -359,7 +359,14 @@ export default {
|
|
|
359
359
|
};
|
|
360
360
|
|
|
361
361
|
writeFileSync(join(cmsDir, 'wrangler.json'), JSON.stringify(cmsWranglerConfig, null, 2));
|
|
362
|
-
|
|
362
|
+
|
|
363
|
+
writeFileSync(join(cmsDir, '.dev.vars'), `# Cloudflare Edge Cache Purging Secrets
|
|
364
|
+
CLOUDFLARE_API_TOKEN=cfut_YOUR_CUSTOM_PURGE_TOKEN
|
|
365
|
+
|
|
366
|
+
# Local Development Overrides (Takes precedence over wrangler.json vars during local dev)
|
|
367
|
+
CDN_DOMAIN=http://localhost:8787
|
|
368
|
+
PUBLIC_FRONTEND_URL=http://localhost:4321
|
|
369
|
+
`);
|
|
363
370
|
} else {
|
|
364
371
|
const nodeServerContent = `import { serve } from '@hono/node-server';
|
|
365
372
|
import { serveStatic } from '@hono/node-server/serve-static';
|
|
@@ -408,11 +415,13 @@ if (distPath) {
|
|
|
408
415
|
});
|
|
409
416
|
}
|
|
410
417
|
|
|
411
|
-
const port = process.env.PORT
|
|
412
|
-
console.log(\`š„ Kama Node Server & Admin UI running on http://localhost:\${port}\`);
|
|
413
|
-
if (distPath) console.log(\`š Serving Admin UI from: \${distPath}\`);
|
|
418
|
+
const port = process.env.PORT ? parseInt(process.env.PORT, 10) : 8787;
|
|
414
419
|
|
|
415
|
-
serve({ fetch: kamaApp.fetch, port })
|
|
420
|
+
serve({ fetch: kamaApp.fetch, port }, (info) => {
|
|
421
|
+
console.log(\`\\nš„ KAMA CMS Node Server is running!\`);
|
|
422
|
+
console.log(\`ā Local http://localhost:\${info.port}/\`);
|
|
423
|
+
if (distPath) console.log(\`ā Admin UI Serving from: \${distPath}\\n\`);
|
|
424
|
+
});
|
|
416
425
|
`;
|
|
417
426
|
writeFileSync(join(cmsDir, 'server.js'), nodeServerContent);
|
|
418
427
|
|
|
@@ -441,13 +450,14 @@ serve({ fetch: kamaApp.fetch, port });
|
|
|
441
450
|
}, null, 2)
|
|
442
451
|
);
|
|
443
452
|
|
|
453
|
+
// For Node mode, localhost is explicitly used
|
|
444
454
|
writeFileSync(join(cmsDir, '.env'), `PORT=8787
|
|
445
455
|
KAMA_RUNTIME=node
|
|
446
456
|
DB_PATH=./kama.db
|
|
447
457
|
LOCAL_MEDIA_PATH=./public/media
|
|
448
|
-
PUBLIC_CMS_URL
|
|
449
|
-
PUBLIC_API_URL
|
|
450
|
-
PUBLIC_FRONTEND_URL
|
|
458
|
+
PUBLIC_CMS_URL=http://localhost:8787
|
|
459
|
+
PUBLIC_API_URL=http://localhost:8787
|
|
460
|
+
PUBLIC_FRONTEND_URL=http://localhost:4321
|
|
451
461
|
`);
|
|
452
462
|
}
|
|
453
463
|
|
|
@@ -692,6 +702,7 @@ async function generateAstroSite(rootDir, siteFolder, siteDomain, cmsFullUrl, wo
|
|
|
692
702
|
run_worker_first: true
|
|
693
703
|
};
|
|
694
704
|
|
|
705
|
+
// These are production variables used on Cloudflare!
|
|
695
706
|
configObj.vars = configObj.vars || {};
|
|
696
707
|
configObj.vars.PUBLIC_CMS_URL = cmsFullUrl;
|
|
697
708
|
configObj.vars.PUBLIC_API_URL = cmsFullUrl;
|
|
@@ -720,6 +731,7 @@ async function generateAstroSite(rootDir, siteFolder, siteDomain, cmsFullUrl, wo
|
|
|
720
731
|
const channelKey = siteFolder.replace(/[^a-z0-9_-]/gi, '-').toLowerCase();
|
|
721
732
|
const treeKey = 'main-tree';
|
|
722
733
|
|
|
734
|
+
// šÆ FIX: 'navigation' is properly set as the treeType so it resolves correctly
|
|
723
735
|
const seedSql = `
|
|
724
736
|
-- Seed data for site: ${safeSiteLabel}
|
|
725
737
|
|
|
@@ -729,7 +741,7 @@ VALUES ('${channelKey}', '${safeSiteLabel}', 'website', 'en', 0, '{}');
|
|
|
729
741
|
|
|
730
742
|
-- 2. Create the Tree and link it to the Channel
|
|
731
743
|
INSERT OR IGNORE INTO trees (key, label, treeType, channelId, isHidden, dataJson)
|
|
732
|
-
VALUES ('${treeKey}', 'Main Tree', '
|
|
744
|
+
VALUES ('${treeKey}', 'Main Tree', 'navigation', (SELECT id FROM channels WHERE key = '${channelKey}'), 0, '{}');
|
|
733
745
|
|
|
734
746
|
INSERT OR IGNORE INTO channel_trees (channelId, treeId, key)
|
|
735
747
|
VALUES ((SELECT id FROM channels WHERE key = '${channelKey}'), (SELECT id FROM trees WHERE key = '${treeKey}'), 'main');
|
|
@@ -762,9 +774,11 @@ VALUES (
|
|
|
762
774
|
appendFileSync(seedPath, seedSql);
|
|
763
775
|
}
|
|
764
776
|
|
|
777
|
+
// Local Development Overrides
|
|
765
778
|
const envContent = [
|
|
766
|
-
|
|
767
|
-
`
|
|
779
|
+
`# Local Development Overrides (Production uses wrangler.json vars)`,
|
|
780
|
+
`PUBLIC_CMS_URL="http://localhost:8787"`,
|
|
781
|
+
`PUBLIC_API_URL="http://localhost:8787"`,
|
|
768
782
|
`PUBLIC_CHANNEL_ID="${channelKey}"`,
|
|
769
783
|
`PUBLIC_TREE_ID="${treeKey}"`,
|
|
770
784
|
`PUBLIC_HOME_SLUG="home"`,
|