@brightsideoy/kama 0.1.0-alpha.31 ā 0.1.0-alpha.32
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 +14 -7
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -37,7 +37,6 @@ async function createFullWorkspace() {
|
|
|
37
37
|
|
|
38
38
|
const rootDir = join(process.cwd(), projName);
|
|
39
39
|
|
|
40
|
-
// Changed to 'let' so we can rename it if it already exists
|
|
41
40
|
let dbName = `${projName}-db`.replace(/[^a-zA-Z0-9_-]/g, '_');
|
|
42
41
|
|
|
43
42
|
console.log(`\nš Creating workspace folder at ./${projName}...`);
|
|
@@ -69,7 +68,6 @@ async function createFullWorkspace() {
|
|
|
69
68
|
console.log(`\nšļø Checking existing Cloudflare D1 databases...`);
|
|
70
69
|
const listOutput = execSync(`npx wrangler d1 list --json`, { encoding: 'utf-8', stdio: 'pipe' });
|
|
71
70
|
|
|
72
|
-
// Safely parse JSON in case Wrangler prints update warnings before the JSON array
|
|
73
71
|
const jsonStart = listOutput.indexOf('[');
|
|
74
72
|
const jsonEnd = listOutput.lastIndexOf(']') + 1;
|
|
75
73
|
let databases = [];
|
|
@@ -134,6 +132,12 @@ async function createFullWorkspace() {
|
|
|
134
132
|
const cmsDir = join(rootDir, 'cms-worker');
|
|
135
133
|
mkdirSync(cmsDir, { recursive: true });
|
|
136
134
|
|
|
135
|
+
// š The critical local entry point file!
|
|
136
|
+
writeFileSync(
|
|
137
|
+
join(cmsDir, 'index.js'),
|
|
138
|
+
`export { default } from '@brightsideoy/kama';\n`
|
|
139
|
+
);
|
|
140
|
+
|
|
137
141
|
writeFileSync(
|
|
138
142
|
join(cmsDir, 'package.json'),
|
|
139
143
|
JSON.stringify({
|
|
@@ -147,7 +151,7 @@ async function createFullWorkspace() {
|
|
|
147
151
|
"deploy": "npm run schema:remote && wrangler deploy"
|
|
148
152
|
},
|
|
149
153
|
dependencies: {
|
|
150
|
-
'@brightsideoy/kama': '
|
|
154
|
+
'@brightsideoy/kama': 'alpha',
|
|
151
155
|
},
|
|
152
156
|
devDependencies: {
|
|
153
157
|
wrangler: '^4.127.1',
|
|
@@ -159,12 +163,15 @@ async function createFullWorkspace() {
|
|
|
159
163
|
writeFileSync(
|
|
160
164
|
join(cmsDir, 'wrangler.json'),
|
|
161
165
|
JSON.stringify({
|
|
162
|
-
$schema: 'node_modules/wrangler/config-schema.json',
|
|
166
|
+
$schema: '../node_modules/wrangler/config-schema.json',
|
|
163
167
|
name: 'kama-worker',
|
|
164
|
-
main: '
|
|
168
|
+
main: 'index.js', // š Pointing to our generated local entry point
|
|
165
169
|
compatibility_date: '2026-08-01',
|
|
166
170
|
compatibility_flags: ['nodejs_compat'],
|
|
167
|
-
assets: {
|
|
171
|
+
assets: {
|
|
172
|
+
directory: '../node_modules/@brightsideoy/kama/dist',
|
|
173
|
+
binding: 'ASSETS'
|
|
174
|
+
},
|
|
168
175
|
routes: [{ pattern: cmsDomain, custom_domain: true }],
|
|
169
176
|
vars: { CDN_DOMAIN: cmsDomain },
|
|
170
177
|
d1_databases: [{
|
|
@@ -240,7 +247,7 @@ async function generateAstroSite(rootDir, siteFolder, siteDomain, cmsDomain) {
|
|
|
240
247
|
},
|
|
241
248
|
dependencies: {
|
|
242
249
|
'@astrojs/cloudflare': '^14.2.5',
|
|
243
|
-
'@brightsideoy/kama': '
|
|
250
|
+
'@brightsideoy/kama': 'alpha',
|
|
244
251
|
astro: '^7.2.2',
|
|
245
252
|
wrangler: '^4.127.1',
|
|
246
253
|
},
|
package/dist/index.js
CHANGED
|
@@ -661,7 +661,7 @@ function H(e = {}, t = {}) {
|
|
|
661
661
|
}, n;
|
|
662
662
|
}
|
|
663
663
|
function ge() {
|
|
664
|
-
if (typeof process > "u"
|
|
664
|
+
if (typeof process > "u") return null;
|
|
665
665
|
try {
|
|
666
666
|
let e = (e) => {
|
|
667
667
|
let t = /* @__PURE__ */ new Map(), n = process.cwd(), i = [
|
|
@@ -2861,7 +2861,7 @@ if ($.use("*", C()), $.use("/media/*", C({
|
|
|
2861
2861
|
console.error("ā [CMS Server] Failed to initialize system tables on cold start:", e);
|
|
2862
2862
|
}
|
|
2863
2863
|
await t();
|
|
2864
|
-
}), $.route("/media", We), $.use("/media/*", le()), $.route("/api/cms/nodes", W), $.route("/api/cms/nodes.json", W), $.route("/api/cms/formcsv", W), $.route("/api/cms/formcsv.json", W), $.route("/api/cms/stats", je), $.route("/api/cms/stats.json", je), $.route("/api/cms", G), $.route("/api/cms/channels", K), $.route("/api/cms/channels.json", K), $.route("/api/cms/schemas", q), $.route("/api/cms/schemas.json", q), $.route("/api/cms", Oe), $.route("/api/admin/assets", J), $.route("/api/v1/node", Fe), $.route("/api/v1/page", Fe), $.route("/api/v1/tree", He), $.route("/api/v1/all-paths", Ke), typeof process < "u" &&
|
|
2864
|
+
}), $.route("/media", We), $.use("/media/*", le()), $.route("/api/cms/nodes", W), $.route("/api/cms/nodes.json", W), $.route("/api/cms/formcsv", W), $.route("/api/cms/formcsv.json", W), $.route("/api/cms/stats", je), $.route("/api/cms/stats.json", je), $.route("/api/cms", G), $.route("/api/cms/channels", K), $.route("/api/cms/channels.json", K), $.route("/api/cms/schemas", q), $.route("/api/cms/schemas.json", q), $.route("/api/cms", Oe), $.route("/api/admin/assets", J), $.route("/api/v1/node", Fe), $.route("/api/v1/page", Fe), $.route("/api/v1/tree", He), $.route("/api/v1/all-paths", Ke), typeof process < "u" && import.meta.url === `file://${process.argv[1]}`) {
|
|
2865
2865
|
let t = 4e3;
|
|
2866
2866
|
console.log(`š Fully Decoupled CMS API Server running on http://localhost:${t}`), e({
|
|
2867
2867
|
fetch: $.fetch,
|