@brightsideoy/kama 0.1.0-alpha.109 → 0.1.0-alpha.111
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/README.md +1 -1
- package/bin/cli.js +32 -21
- package/dist/assets/{index-BpvZVMBP.js → index-DDVVGU8N.js} +1 -1
- package/dist/index.html +1 -1
- package/kama-worker/bundled-definitions.js +2394 -0
- package/kama-worker/bundled-definitions.ts +2395 -0
- package/package.json +1 -1
- package/scripts/bundle-definitions.js +10 -2
package/README.md
CHANGED
|
@@ -134,7 +134,7 @@ my-kama-workspace/
|
|
|
134
134
|
│ ├── nodes/ # e.g., page.yaml, product.yaml
|
|
135
135
|
│ ├── blocks/ # e.g., hero.yaml, image_card.yaml
|
|
136
136
|
│ └── node-layouts/ # e.g., two-column.yaml
|
|
137
|
-
├──
|
|
137
|
+
├── kama-worker/ # 👉 BACKEND PIPELINE
|
|
138
138
|
│ ├── index.js # Worker entrypoint (ES Module)
|
|
139
139
|
│ ├── wrangler.json # Bindings (D1, R2, Vars)
|
|
140
140
|
│ └── package.json
|
package/bin/cli.js
CHANGED
|
@@ -28,7 +28,7 @@ async function main() {
|
|
|
28
28
|
console.log('\n🔥 --- KAMA SITE GENERATOR --- 🔥\n');
|
|
29
29
|
|
|
30
30
|
console.log('Select mode:');
|
|
31
|
-
console.log(' 1) Kickstart new Kama Monorepo (CMS +
|
|
31
|
+
console.log(' 1) Kickstart new Kama Monorepo (CMS + Optional Site)');
|
|
32
32
|
console.log(' 2) Add a new Astro Site to current workspace (sites/)');
|
|
33
33
|
|
|
34
34
|
const choice = await rl.question('\nChoice [1/2]: ');
|
|
@@ -54,13 +54,19 @@ async function createFullWorkspace() {
|
|
|
54
54
|
const envChoice = await rl.question('\nChoice [1/2]: ');
|
|
55
55
|
const isCloudflare = envChoice.trim() === '2';
|
|
56
56
|
|
|
57
|
+
// 🎯 Ask if user wants an Astro frontend site scaffolded
|
|
58
|
+
const createSiteInput = await rl.question('\n🚀 Do you want to scaffold an initial Astro frontend site? (y/n) [y]: ');
|
|
59
|
+
const shouldCreateSite = createSiteInput.trim().toLowerCase() !== 'n';
|
|
60
|
+
|
|
57
61
|
let cmsDomain = 'localhost:8787';
|
|
58
62
|
let siteDomain = 'localhost:4321';
|
|
59
63
|
|
|
60
64
|
// Only ask for domains if deploying to Cloudflare Edge
|
|
61
65
|
if (isCloudflare) {
|
|
62
66
|
cmsDomain = (await rl.question('\nCMS Admin Domain (e.g., admin.t3cloud.eu): ')) || 'admin.t3cloud.eu';
|
|
63
|
-
|
|
67
|
+
if (shouldCreateSite) {
|
|
68
|
+
siteDomain = (await rl.question('First Website Domain (e.g., kama.t3cloud.eu): ')) || 'kama.t3cloud.eu';
|
|
69
|
+
}
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
// Standardize scheme for localhost vs custom edge domains
|
|
@@ -83,9 +89,10 @@ async function createFullWorkspace() {
|
|
|
83
89
|
`node_modules/
|
|
84
90
|
.env
|
|
85
91
|
.DS_Store
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
kama-worker/.dev.vars
|
|
93
|
+
kama-worker/bundled-definitions.js
|
|
94
|
+
kama-worker/bundled-definitions.ts
|
|
95
|
+
kama-worker/.wrangler/
|
|
89
96
|
sites/*/.env
|
|
90
97
|
sites/*/.astro/
|
|
91
98
|
sites/*/dist/
|
|
@@ -184,18 +191,18 @@ sites/*/dist/
|
|
|
184
191
|
}
|
|
185
192
|
// ------------------------------
|
|
186
193
|
|
|
187
|
-
// 🎯 1. Root package.json
|
|
194
|
+
// 🎯 1. Root package.json (includes 'sites/*' wildcard in workspaces so user can add sites later)
|
|
188
195
|
writeFileSync(
|
|
189
196
|
join(rootDir, 'package.json'),
|
|
190
197
|
JSON.stringify({
|
|
191
198
|
name: projName,
|
|
192
199
|
private: true,
|
|
193
200
|
type: 'module',
|
|
194
|
-
workspaces: ['
|
|
201
|
+
workspaces: ['kama-worker', 'sites/*'],
|
|
195
202
|
scripts: {
|
|
196
203
|
'bundle:schemas': 'node node_modules/@brightsideoy/kama/scripts/bundle-definitions.js',
|
|
197
|
-
'dev:cms': 'npm run bundle:schemas && npm run dev -w
|
|
198
|
-
'deploy:cms': 'npm run bundle:schemas && npm run deploy -w
|
|
204
|
+
'dev:cms': 'npm run bundle:schemas && npm run dev -w kama-worker',
|
|
205
|
+
'deploy:cms': 'npm run bundle:schemas && npm run deploy -w kama-worker',
|
|
199
206
|
},
|
|
200
207
|
dependencies: {
|
|
201
208
|
'@brightsideoy/kama': currentKamaVersion,
|
|
@@ -205,7 +212,7 @@ sites/*/dist/
|
|
|
205
212
|
|
|
206
213
|
// 🎯 2. Setup CMS Worker with Dynamic Names
|
|
207
214
|
console.log(`\n☁️ Configuring CMS Worker '${workerName}' (${cmsDomain})...`);
|
|
208
|
-
const cmsDir = join(rootDir, '
|
|
215
|
+
const cmsDir = join(rootDir, 'kama-worker');
|
|
209
216
|
mkdirSync(cmsDir, { recursive: true });
|
|
210
217
|
|
|
211
218
|
// 🎯 Properly wrap and inject BUNDLED_DEFINITIONS from LOCAL workspace, not node_modules
|
|
@@ -253,7 +260,7 @@ export default {
|
|
|
253
260
|
'@brightsideoy/kama': currentKamaVersion,
|
|
254
261
|
},
|
|
255
262
|
devDependencies: {
|
|
256
|
-
wrangler: '^
|
|
263
|
+
wrangler: '^4.0.0', // 👈 Updated to ^4.0.0 to support ES import attributes in dependencies
|
|
257
264
|
tsx: '^4.19.2',
|
|
258
265
|
},
|
|
259
266
|
}, null, 2)
|
|
@@ -275,7 +282,7 @@ export default {
|
|
|
275
282
|
},
|
|
276
283
|
vars: {
|
|
277
284
|
CDN_DOMAIN: cmsDomain,
|
|
278
|
-
PUBLIC_FRONTEND_URL: isCloudflare ? `https://${siteDomain}` : 'http://localhost:4321',
|
|
285
|
+
PUBLIC_FRONTEND_URL: (isCloudflare && shouldCreateSite) ? `https://${siteDomain}` : 'http://localhost:4321',
|
|
279
286
|
CLOUDFLARE_ZONE_ID: isCloudflare ? "REPLACE_WITH_YOUR_32_CHAR_ZONE_ID" : "local-zone-not-needed"
|
|
280
287
|
},
|
|
281
288
|
d1_databases: [{
|
|
@@ -304,9 +311,13 @@ export default {
|
|
|
304
311
|
`# Cloudflare Edge Cache Purging Secrets\nCLOUDFLARE_API_TOKEN=${isCloudflare ? 'cfut_YOUR_CUSTOM_PURGE_TOKEN' : 'local_token'}\n`
|
|
305
312
|
);
|
|
306
313
|
|
|
307
|
-
// 🎯 3. Setup
|
|
308
|
-
|
|
309
|
-
|
|
314
|
+
// 🎯 3. Setup Astro Site (ONLY if requested)
|
|
315
|
+
if (shouldCreateSite) {
|
|
316
|
+
const siteFolderName = isCloudflare ? siteDomain.split('.')[0] : 'web';
|
|
317
|
+
await generateAstroSite(rootDir, siteFolderName, siteDomain, cmsFullUrl, workerName, isCloudflare);
|
|
318
|
+
} else {
|
|
319
|
+
console.log(`\nℹ️ Skipping Astro site creation. You can add a site later by running 'npx create-kama' (Mode 2) inside this workspace.`);
|
|
320
|
+
}
|
|
310
321
|
|
|
311
322
|
console.log(`\n✨ Workspace ready! Next steps:`);
|
|
312
323
|
console.log(` 1. cd ${projName}`);
|
|
@@ -316,12 +327,12 @@ export default {
|
|
|
316
327
|
if (d1DatabaseId === '00000000-0000-0000-0000-000000000000' || d1DatabaseId === 'REPLACE_WITH_YOUR_D1_ID') {
|
|
317
328
|
console.log(` 3. Run 'npx wrangler login' and create a D1 database manually.`);
|
|
318
329
|
}
|
|
319
|
-
console.log(` 4. Update CLOUDFLARE_ZONE_ID in
|
|
320
|
-
console.log(` 5. Securely store your purge token: cd
|
|
330
|
+
console.log(` 4. Update CLOUDFLARE_ZONE_ID in kama-worker/wrangler.json with your actual Zone ID`);
|
|
331
|
+
console.log(` 5. Securely store your purge token: cd kama-worker && npx wrangler secret put CLOUDFLARE_API_TOKEN`);
|
|
321
332
|
console.log(` 6. Run 'npm run dev:cms' from the workspace root to start the backend.`);
|
|
322
333
|
} else {
|
|
323
334
|
console.log(` 3. Run 'npm run dev:cms' from the workspace root to start the local SQLite backend.`);
|
|
324
|
-
console.log(`\n💡 Note: You can deploy to Cloudflare later by updating '
|
|
335
|
+
console.log(`\n💡 Note: You can deploy to Cloudflare later by updating 'kama-worker/wrangler.json' with real IDs.`);
|
|
325
336
|
}
|
|
326
337
|
}
|
|
327
338
|
|
|
@@ -337,7 +348,7 @@ async function createNewSiteOnly() {
|
|
|
337
348
|
}
|
|
338
349
|
|
|
339
350
|
let targetWorkerName = 'kama-worker';
|
|
340
|
-
const cmsWranglerPath = join(rootDir, '
|
|
351
|
+
const cmsWranglerPath = join(rootDir, 'kama-worker', 'wrangler.json');
|
|
341
352
|
if (existsSync(cmsWranglerPath)) {
|
|
342
353
|
try {
|
|
343
354
|
const cmsWrangler = JSON.parse(readFileSync(cmsWranglerPath, 'utf-8'));
|
|
@@ -509,8 +520,8 @@ async function generateAstroSite(rootDir, siteFolder, siteDomain, cmsFullUrl, wo
|
|
|
509
520
|
dependencies: {
|
|
510
521
|
'@astrojs/cloudflare': '^14.2.5',
|
|
511
522
|
'@brightsideoy/kama': currentKamaVersion,
|
|
512
|
-
astro: '^
|
|
513
|
-
wrangler: '^
|
|
523
|
+
astro: '^7.2.0',
|
|
524
|
+
wrangler: '^4.0.0', // 👈 Updated to ^4.0.0
|
|
514
525
|
},
|
|
515
526
|
}, null, 2)
|
|
516
527
|
);
|