opacacms 0.1.7 → 0.1.8
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/dist/admin/index.js +255 -20
- package/dist/admin/webcomponent.js +291 -46
- package/dist/cli/index.js +3638 -30
- package/dist/client.js +126 -5
- package/dist/db/bun-sqlite.js +790 -21
- package/dist/db/d1.js +788 -19
- package/dist/db/index.js +53 -4
- package/dist/db/postgres.js +792 -23
- package/dist/db/sqlite.js +788 -19
- package/dist/index.js +456 -8
- package/dist/runtimes/bun.js +1909 -8
- package/dist/runtimes/cloudflare-workers.js +1910 -9
- package/dist/runtimes/next.js +1908 -7
- package/dist/runtimes/node.js +1909 -8
- package/dist/schema/collection.d.ts +3 -7
- package/dist/schema/fields/index.d.ts +24 -25
- package/dist/schema/global.d.ts +9 -9
- package/dist/schema/index.d.ts +30 -4
- package/dist/schema/index.js +546 -1
- package/dist/server.js +2246 -17
- package/dist/storage/index.js +40 -1
- package/package.json +1 -1
- package/dist/chunk-16vgcf3k.js +0 -88
- package/dist/chunk-2yz1nsxs.js +0 -126
- package/dist/chunk-5gvbp2qa.js +0 -167
- package/dist/chunk-62ev8gnc.js +0 -41
- package/dist/chunk-6ew02s0c.js +0 -472
- package/dist/chunk-7a9kn0np.js +0 -116
- package/dist/chunk-8sqjbsgt.js +0 -42
- package/dist/chunk-9kxpbcb1.js +0 -85
- package/dist/chunk-cvdd4eqh.js +0 -110
- package/dist/chunk-d3ffeqp9.js +0 -87
- package/dist/chunk-fa5mg0hr.js +0 -96
- package/dist/chunk-j4d50hrx.js +0 -20
- package/dist/chunk-jwjk85ze.js +0 -15
- package/dist/chunk-m09hahe2.js +0 -250
- package/dist/chunk-s8mqwnm1.js +0 -14
- package/dist/chunk-srsac177.js +0 -85
- package/dist/chunk-v521d72w.js +0 -10
- package/dist/chunk-vtvqfhgy.js +0 -2442
- package/dist/chunk-xa7rjsn2.js +0 -20
- package/dist/chunk-xg35h5a3.js +0 -15
- package/dist/chunk-y8hc6nm4.js +0 -17
- package/dist/chunk-ybbbqj63.js +0 -130
- package/dist/chunk-yr32cp7h.js +0 -1603
- package/dist/chunk-zvwb67nd.js +0 -332
package/dist/chunk-srsac177.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import"./chunk-8sqjbsgt.js";
|
|
2
|
-
|
|
3
|
-
// src/cli/commands/init.ts
|
|
4
|
-
import fs from "node:fs";
|
|
5
|
-
import { resolve } from "node:path";
|
|
6
|
-
async function initCommand(target, example) {
|
|
7
|
-
console.log(`[OpacaCMS] Initializing new project in ./${target}...`);
|
|
8
|
-
if (example) {
|
|
9
|
-
console.log(`[OpacaCMS] Using example template: ${example}`);
|
|
10
|
-
let currentDir = resolve(import.meta.dirname);
|
|
11
|
-
let exampleDir = "";
|
|
12
|
-
const localExample = resolve(process.cwd(), "examples", example);
|
|
13
|
-
if (fs.existsSync(localExample)) {
|
|
14
|
-
exampleDir = localExample;
|
|
15
|
-
} else {
|
|
16
|
-
while (currentDir !== resolve(currentDir, "..")) {
|
|
17
|
-
const potential = resolve(currentDir, "examples", example);
|
|
18
|
-
if (fs.existsSync(potential)) {
|
|
19
|
-
exampleDir = potential;
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
currentDir = resolve(currentDir, "..");
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (!exampleDir) {
|
|
26
|
-
console.error(`[OpacaCMS] Example ${example} not found.`);
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
fs.cpSync(exampleDir, resolve(process.cwd(), target), { recursive: true });
|
|
30
|
-
console.log(`[OpacaCMS] Copied example ${example} to ${target}!`);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
console.log(`[OpacaCMS] Generating default boilerplate...`);
|
|
34
|
-
fs.mkdirSync(resolve(process.cwd(), target), { recursive: true });
|
|
35
|
-
const configCode = `import { defineConfig } from 'opacacms';
|
|
36
|
-
import { createSQLiteAdapter } from 'opacacms/db/sqlite';
|
|
37
|
-
|
|
38
|
-
export default defineConfig({
|
|
39
|
-
appName: "My OpacaCMS App",
|
|
40
|
-
db: createSQLiteAdapter('local.db'),
|
|
41
|
-
collections: [
|
|
42
|
-
{
|
|
43
|
-
slug: 'posts',
|
|
44
|
-
fields: [
|
|
45
|
-
{ name: 'title', type: 'text', required: true },
|
|
46
|
-
{ name: 'content', type: 'text' }
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
});
|
|
51
|
-
`;
|
|
52
|
-
fs.writeFileSync(resolve(process.cwd(), target, "opacacms.config.ts"), configCode);
|
|
53
|
-
const serverCode = `import { Hono } from 'hono';
|
|
54
|
-
import { createAPIRouter } from 'opacacms/server';
|
|
55
|
-
import config from './opacacms.config';
|
|
56
|
-
|
|
57
|
-
const app = new Hono();
|
|
58
|
-
app.route('/api', createAPIRouter(config));
|
|
59
|
-
|
|
60
|
-
export default app;
|
|
61
|
-
`;
|
|
62
|
-
fs.writeFileSync(resolve(process.cwd(), target, "index.ts"), serverCode);
|
|
63
|
-
const pkgJson = {
|
|
64
|
-
name: target,
|
|
65
|
-
type: "module",
|
|
66
|
-
scripts: {
|
|
67
|
-
start: "bun run index.ts",
|
|
68
|
-
dev: "bun run --watch index.ts"
|
|
69
|
-
},
|
|
70
|
-
dependencies: {
|
|
71
|
-
opacacms: "latest",
|
|
72
|
-
hono: "^4.0.0"
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
fs.writeFileSync(resolve(process.cwd(), target, "package.json"), JSON.stringify(pkgJson, null, 2));
|
|
76
|
-
console.log(`[OpacaCMS] Project created successfully!`);
|
|
77
|
-
console.log(`
|
|
78
|
-
cd ${target}`);
|
|
79
|
-
console.log(`bun install`);
|
|
80
|
-
console.log(`bun run dev
|
|
81
|
-
`);
|
|
82
|
-
}
|
|
83
|
-
export {
|
|
84
|
-
initCommand
|
|
85
|
-
};
|