@easy-cms/next 0.22.0 → 0.22.2
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 +14 -2
- package/dist/index.js +11 -5
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
# @easy-cms/next
|
|
2
2
|
|
|
3
|
-
Next.js (App Router, 15
|
|
3
|
+
Next.js adapter for Easy CMS (App Router, 15 or later): route handlers for the REST API and the admin UI, and a typed `getEasyCMS()` for Server Components. Part of [Easy CMS](https://github.com/maritonx/easy-cms), the embedded, code-first headless CMS for Nuxt and Next.js.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
4
6
|
|
|
5
7
|
```bash
|
|
6
|
-
|
|
8
|
+
npm install @easy-cms/next @easy-cms/core @easy-cms/db-postgres
|
|
7
9
|
```
|
|
8
10
|
|
|
11
|
+
Or `pnpm add`, `yarn add` or `bun add`.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
9
15
|
**1. Wrap `next.config.ts`** so the server build keeps the admin UI and database drivers:
|
|
10
16
|
|
|
11
17
|
```ts
|
|
@@ -50,3 +56,9 @@ tries to query the database while prerendering.
|
|
|
50
56
|
|
|
51
57
|
`createRouteHandlers(config, { trustProxy: true })` uses `X-Forwarded-For` for login rate limiting;
|
|
52
58
|
enable it behind a proxy you trust, such as Vercel.
|
|
59
|
+
|
|
60
|
+
## Links
|
|
61
|
+
|
|
62
|
+
[Next.js](https://maritonx.github.io/easy-cms/guide/next) · [Documentation](https://maritonx.github.io/easy-cms/) ([ภาษาไทย](https://maritonx.github.io/easy-cms/th/)) · [GitHub](https://github.com/maritonx/easy-cms)
|
|
63
|
+
|
|
64
|
+
MIT License
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
import { existsSync } from "fs";
|
|
2
3
|
import { createRequire } from "module";
|
|
3
4
|
import { dirname, join } from "path";
|
|
4
|
-
import { createAdminHandler } from "@easy-cms/admin";
|
|
5
|
+
import { APP_DIR, createAdminHandler, SHELL_FILE } from "@easy-cms/admin";
|
|
5
6
|
import {
|
|
6
7
|
configSignature,
|
|
7
8
|
createEasyCMS,
|
|
@@ -79,10 +80,15 @@ async function getEasyCMSUser(config) {
|
|
|
79
80
|
return cms.auth.verify(token);
|
|
80
81
|
}
|
|
81
82
|
function adminAppDir() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
if (existsSync(join(APP_DIR, SHELL_FILE))) return APP_DIR;
|
|
84
|
+
try {
|
|
85
|
+
const fromProject = createRequire(join(process.cwd(), "package.json"));
|
|
86
|
+
const nextPackage = fromProject.resolve("@easy-cms/next/package.json");
|
|
87
|
+
const adminPackage = createRequire(nextPackage).resolve("@easy-cms/admin/package.json");
|
|
88
|
+
return join(dirname(adminPackage), "dist/app");
|
|
89
|
+
} catch {
|
|
90
|
+
return APP_DIR;
|
|
91
|
+
}
|
|
86
92
|
}
|
|
87
93
|
export {
|
|
88
94
|
createAdminRouteHandlers,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-cms/next",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.2",
|
|
4
4
|
"description": "Next.js adapter for Easy CMS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"node": ">=22.12"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@easy-cms/admin": "^0.22.
|
|
29
|
+
"@easy-cms/admin": "^0.22.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"next": ">=15.0.0",
|
|
33
33
|
"react": ">=19.0.0",
|
|
34
|
-
"@easy-cms/core": "^0.22.
|
|
34
|
+
"@easy-cms/core": "^0.22.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/react": "^19.2.0",
|
|
38
38
|
"next": "^16.3.6",
|
|
39
39
|
"react": "^19.2.0",
|
|
40
|
-
"@easy-cms/core": "^0.22.
|
|
41
|
-
"@easy-cms/db-sqlite": "^0.22.
|
|
40
|
+
"@easy-cms/core": "^0.22.2",
|
|
41
|
+
"@easy-cms/db-sqlite": "^0.22.2"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|