@easy-cms/core 0.21.0 → 0.22.1
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 +31 -4
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
# @easy-cms/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The core of Easy CMS: the config, the typed Local API, the REST handler, auth and access control,
|
|
4
|
+
hooks, drafts and versions, localization, uploads, webhooks and plugins. Part of
|
|
5
|
+
[Easy CMS](https://github.com/maritonx/easy-cms), the embedded, code-first headless CMS for Nuxt
|
|
6
|
+
and Next.js.
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
Start with `npm create easy-cms@latest`, which installs this package with a framework adapter
|
|
11
|
+
and a database adapter. By hand:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @easy-cms/core @easy-cms/db-sqlite
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or `pnpm add`, `yarn add` or `bun add`.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
6
20
|
|
|
7
21
|
```ts
|
|
8
22
|
// easy-cms.config.ts
|
|
9
|
-
import { defineConfig, isAdmin
|
|
23
|
+
import { type CollectionDocument, defineConfig, isAdmin } from '@easy-cms/core'
|
|
24
|
+
import { sqlite } from '@easy-cms/db-sqlite'
|
|
10
25
|
|
|
11
26
|
const config = defineConfig({
|
|
12
27
|
secret: process.env.EASY_CMS_SECRET!,
|
|
@@ -15,7 +30,7 @@ const config = defineConfig({
|
|
|
15
30
|
{
|
|
16
31
|
slug: 'posts',
|
|
17
32
|
drafts: true,
|
|
18
|
-
access: { update: isAdmin },
|
|
33
|
+
access: { read: () => true, update: isAdmin },
|
|
19
34
|
fields: [
|
|
20
35
|
{ name: 'title', type: 'text', required: true },
|
|
21
36
|
{ name: 'slug', type: 'slug', from: 'title' },
|
|
@@ -28,3 +43,15 @@ const config = defineConfig({
|
|
|
28
43
|
export default config
|
|
29
44
|
export type Post = CollectionDocument<typeof config, 'posts'>
|
|
30
45
|
```
|
|
46
|
+
|
|
47
|
+
The Nuxt and Next.js adapters (or `easy-cms serve`) serve the admin and REST API from this config;
|
|
48
|
+
`useEasyCMS()` / `getEasyCMS(config)` give you the Local API, typed from it.
|
|
49
|
+
|
|
50
|
+
> Easy CMS is pre-1.0: the API may change between minor versions. See the
|
|
51
|
+
> [changelog](https://github.com/maritonx/easy-cms/blob/main/packages/core/CHANGELOG.md).
|
|
52
|
+
|
|
53
|
+
## Links
|
|
54
|
+
|
|
55
|
+
[Configuration](https://maritonx.github.io/easy-cms/guide/configuration) · [Local API](https://maritonx.github.io/easy-cms/guide/local-api) · [Documentation](https://maritonx.github.io/easy-cms/) ([ภาษาไทย](https://maritonx.github.io/easy-cms/th/)) · [GitHub](https://github.com/maritonx/easy-cms)
|
|
56
|
+
|
|
57
|
+
MIT License
|
package/dist/index.js
CHANGED
|
@@ -2425,7 +2425,7 @@ async function loadConfig(options = {}) {
|
|
|
2425
2425
|
const looked = options.configFile ?? CONFIG_FILE_NAMES.join(", ");
|
|
2426
2426
|
throw new Error(
|
|
2427
2427
|
`Easy CMS config not found in ${cwd} (looked for ${looked}).
|
|
2428
|
-
\u2192
|
|
2428
|
+
\u2192 create one with create-easy-cms (\`npm create easy-cms\`, or pnpm, yarn or bun create easy-cms)`
|
|
2429
2429
|
);
|
|
2430
2430
|
}
|
|
2431
2431
|
const jiti = createJiti(import.meta.url, { moduleCache: false, interopDefault: false });
|