@infuro/cms-core 1.0.6 → 1.0.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/README.md +27 -43
- package/dist/admin.cjs +270 -41
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.css +12 -15
- package/dist/admin.d.cts +3 -1
- package/dist/admin.d.ts +3 -1
- package/dist/admin.js +304 -75
- package/dist/admin.js.map +1 -1
- package/dist/api.cjs +131 -1
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +131 -1
- package/dist/api.js.map +1 -1
- package/dist/cli.cjs +859 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +836 -0
- package/dist/cli.js.map +1 -0
- package/dist/{index-BPnATEXW.d.cts → index-P5ajDo8-.d.cts} +9 -0
- package/dist/{index-BPnATEXW.d.ts → index-P5ajDo8-.d.ts} +9 -0
- package/dist/index.cjs +702 -265
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +91 -3
- package/dist/index.d.ts +91 -3
- package/dist/index.js +685 -254
- package/dist/index.js.map +1 -1
- package/dist/migrations/1731800000000-ChatAndKnowledgeBase.ts +39 -0
- package/dist/migrations/1731900000000-KnowledgeBaseVector.ts +17 -0
- package/dist/migrations/1772178563554-InitialSchema.ts +304 -0
- package/dist/migrations/README.md +3 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -4,56 +4,40 @@ A headless CMS framework built on Next.js and TypeORM. It provides a ready-to-us
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
You don't set up or clone core in each website. Install the published package and run the init command to scaffold a new site.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- PostgreSQL and env vars: `DATABASE_URL`, `NEXTAUTH_SECRET`, `NEXTAUTH_URL`
|
|
11
|
-
- A few files in your app: **data-source** (TypeORM), **auth-helpers**, **cms** (plugins), **API catch-all route**, **NextAuth route**, **admin layout + catch-all page**, **middleware**, **providers** (Session + Theme + Toaster)
|
|
12
|
-
- Tailwind config that includes the package in `content` and extends theme (shadcn-style colors)
|
|
13
|
-
- Optional: custom admin nav, custom CRUD configs, custom admin pages, plugins
|
|
9
|
+
**Typical workflow for a new site:**
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
1. Create a Next.js app (TypeScript, Tailwind, App Router, `src` directory):
|
|
12
|
+
`npx create-next-app@latest my-site --typescript --tailwind --app --src-dir`
|
|
13
|
+
2. From the project root, run:
|
|
14
|
+
`npx @infuro/cms-core init`
|
|
15
|
+
3. Copy `.env.example` to `.env`, set `DATABASE_URL`, `NEXTAUTH_SECRET`, `NEXTAUTH_URL`, then run `npm run seed` (or migrations) and `npm run dev`.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
npm install @infuro/cms-core typeorm reflect-metadata bcryptjs next-auth next-themes sonner
|
|
19
|
-
npm install -D @types/node
|
|
20
|
-
```
|
|
17
|
+
Init creates all required files (data-source, auth-helpers, cms, API routes, admin layout and page, middleware, providers, seed, migration runner, default theme, basic home and contact pages), and can patch `next.config`, `tailwind.config`, layout, and `package.json` and install dependencies. Use `--force` to overwrite existing files, `--dry-run` to see what would be created, `--no-deps` to skip npm install, `--no-patch-config` to skip config changes.
|
|
21
18
|
|
|
22
|
-
For local development
|
|
19
|
+
**Manual setup (if you prefer not to use init):** Install from npm (`npm install @infuro/cms-core typeorm reflect-metadata bcryptjs next-auth next-themes sonner` and `npm install -D @types/node`), then follow the step-by-step setup below. For local development of core itself, use `"@infuro/cms-core": "file:../core"` in the site's package.json.
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
"@infuro/cms-core": "file:../core"
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Then follow the setup steps below.
|
|
29
|
-
|
|
30
|
-
## Architecture
|
|
21
|
+
## Project structure (your site after setup)
|
|
31
22
|
|
|
32
23
|
```
|
|
33
|
-
|
|
34
|
-
├── src/
|
|
35
|
-
│ ├── entities/ # TypeORM entities (User, Blog, Form, etc.)
|
|
36
|
-
│ ├── api/ # API handlers (CRUD, auth, CMS-specific)
|
|
37
|
-
│ ├── auth/ # NextAuth config, middleware, helpers
|
|
38
|
-
│ ├── admin/ # Admin panel (layout, pages, page resolver)
|
|
39
|
-
│ ├── plugins/ # Plugin system (email, storage, analytics, ERP, etc.)
|
|
40
|
-
│ ├── components/ # Shared UI (shadcn/ui + Admin components)
|
|
41
|
-
│ ├── hooks/ # React hooks (analytics, mobile, plugin)
|
|
42
|
-
│ └── lib/ # Utilities (cn, etc.)
|
|
43
|
-
|
|
44
|
-
your-website/ # Your Next.js app
|
|
24
|
+
your-website/
|
|
45
25
|
├── src/
|
|
46
26
|
│ ├── app/
|
|
47
|
-
│ │ ├── admin/ #
|
|
27
|
+
│ │ ├── admin/ # layout.tsx + [[...slug]]/page.tsx
|
|
48
28
|
│ │ └── api/
|
|
49
29
|
│ │ ├── auth/ # NextAuth route
|
|
50
|
-
│ │ └── [[...path]]/ #
|
|
30
|
+
│ │ └── [[...path]]/ # Catch-all for CMS API
|
|
51
31
|
│ ├── lib/
|
|
52
|
-
│ │ ├── data-source.ts
|
|
53
|
-
│ │ ├── auth-helpers.ts
|
|
54
|
-
│ │
|
|
55
|
-
│ ├──
|
|
56
|
-
│ └──
|
|
32
|
+
│ │ ├── data-source.ts
|
|
33
|
+
│ │ ├── auth-helpers.ts
|
|
34
|
+
│ │ ├── cms.ts
|
|
35
|
+
│ │ ├── theme-registry.ts
|
|
36
|
+
│ │ └── seed.ts
|
|
37
|
+
│ ├── themes/ # Optional: default theme from init
|
|
38
|
+
│ ├── migrations/
|
|
39
|
+
│ ├── middleware.ts
|
|
40
|
+
│ └── ... # Your pages, components, etc.
|
|
57
41
|
```
|
|
58
42
|
|
|
59
43
|
## Getting Started
|
|
@@ -65,7 +49,7 @@ npx create-next-app@latest my-website --typescript --tailwind --app --src-dir
|
|
|
65
49
|
cd my-website
|
|
66
50
|
```
|
|
67
51
|
|
|
68
|
-
### 2. Install
|
|
52
|
+
### 2. Install the package
|
|
69
53
|
|
|
70
54
|
```bash
|
|
71
55
|
npm install @infuro/cms-core typeorm reflect-metadata bcryptjs next-auth next-themes sonner
|
|
@@ -346,7 +330,7 @@ export default async function AdminPage({ params }: { params: Promise<{ slug?: s
|
|
|
346
330
|
}
|
|
347
331
|
```
|
|
348
332
|
|
|
349
|
-
The admin at `/admin` is rendered by
|
|
333
|
+
The admin at `/admin` is rendered by the package (layout, sidebar, header, built-in pages). Pass `customNavSections` and `customCrudConfigs` to add your own sidebar links and CRUD list pages (see [Adding custom pages and admin nav](#adding-custom-pages-and-admin-nav)).
|
|
350
334
|
|
|
351
335
|
### 10. Configure Tailwind
|
|
352
336
|
|
|
@@ -633,13 +617,13 @@ createCmsMiddleware({
|
|
|
633
617
|
|
|
634
618
|
## Tailwind Config
|
|
635
619
|
|
|
636
|
-
|
|
620
|
+
The admin panel and UI components use shadcn/ui and require CSS variable-based color mappings. Your `tailwind.config.js` needs these in `theme.extend.colors`:
|
|
637
621
|
|
|
638
622
|
```js
|
|
639
623
|
module.exports = {
|
|
640
624
|
content: [
|
|
641
625
|
"./src/**/*.{js,ts,jsx,tsx,mdx}",
|
|
642
|
-
"
|
|
626
|
+
"./node_modules/@infuro/cms-core/dist/**/*.{js,cjs}",
|
|
643
627
|
],
|
|
644
628
|
darkMode: "class",
|
|
645
629
|
theme: {
|
|
@@ -679,7 +663,7 @@ module.exports = {
|
|
|
679
663
|
};
|
|
680
664
|
```
|
|
681
665
|
|
|
682
|
-
The CSS variables
|
|
666
|
+
The CSS variables are injected by the admin layout at runtime. Your website's own CSS can also define them in `:root` if your public pages use shadcn/ui components.
|
|
683
667
|
|
|
684
668
|
## Environment Variables
|
|
685
669
|
|