@sveltia/cms 0.1.0
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/LICENSE.txt +21 -0
- package/README.md +281 -0
- package/dist/sveltia-cms.js +425 -0
- package/package.json +59 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Kohei Yoshino.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# Sveltia CMS
|
|
2
|
+
|
|
3
|
+
Sveltia CMS is a Git-based lightweight headless CMS partially compatible with [Netlify/Decap CMS](https://www.netlifycms.org/). You can use it with any static site generator, such as SvelteKit, Next.js and Hugo, if the content is managed on a Git repository. The product is now in public beta, with more features to come.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
Here are some highlights mainly compared to Netlify/Decap CMS:
|
|
8
|
+
|
|
9
|
+
### Compatible with Netlify/Decap CMS
|
|
10
|
+
|
|
11
|
+
- Ready to replace Netlify/Decap CMS _in some casual use case scenarios_ by updating one single line of code.
|
|
12
|
+
- Existing [configuration files](https://www.netlifycms.org/docs/configuration-options/) can be reused as is.
|
|
13
|
+
- Many features are still missing though; see the chart below for details.
|
|
14
|
+
|
|
15
|
+
### Better UX
|
|
16
|
+
|
|
17
|
+
- A modern, intuitive UI powered by the [Sveitia UI component library](https://github.com/sveltia/sveltia-ui), with some inspiration from the Netlify/Decap CMS v3 prototype[^1].
|
|
18
|
+
- Immersive dark mode[^2].
|
|
19
|
+
|
|
20
|
+
### Better performance
|
|
21
|
+
|
|
22
|
+
- Built completely from scratch with [Svelte](https://svelte.dev/). The app starts fast and stays fast.
|
|
23
|
+
- Using the GraphQL API for GitHub by default to fetch contents quickly at once, so showing and searching entries and media are now instant. Saving entries and media is also faster.
|
|
24
|
+
- Small footprint: less than 250 KB when minified and gzipped, compared to 1.5 MB of Netlify/Decap CMS.
|
|
25
|
+
|
|
26
|
+
### Better productivity
|
|
27
|
+
|
|
28
|
+
- Integrating Pexels, Pixabay and Unsplash to allow inserting free stock photos into image fields with no hassle.
|
|
29
|
+
- Able to work on a local Git repository without installing a proxy server. See below for details.
|
|
30
|
+
- Able to delete multiple entries and assets at once.
|
|
31
|
+
- Solving various outstanding Netlify/Decap CMS bugs[^11].
|
|
32
|
+
|
|
33
|
+
### Better i18n support
|
|
34
|
+
|
|
35
|
+
- Making it easier to switch between locales while editing.
|
|
36
|
+
- Integrating DeepL to allow translating text fields from another locale with one click. See below for details.
|
|
37
|
+
- You can now use a random ID for an entry slug, which is a good option for locales writing in non-Latin characters. See below for details.
|
|
38
|
+
- Solving limitations in Netlify/Decap CMS’s [list and object widgets](https://www.netlifycms.org/docs/beta-features/#i18n-support) so that changes made with these widgets will be duplicated between locales as expected[^7].
|
|
39
|
+
- Users can now choose their preferred UI locale. English and Japanese only at this time.
|
|
40
|
+
|
|
41
|
+
### Collection enhancements
|
|
42
|
+
|
|
43
|
+
- You can set an icon for each collection[^3]. See below for details.
|
|
44
|
+
- A per-collection media folder will now appear aside of entries. See below for details.
|
|
45
|
+
|
|
46
|
+
### Media library enhancements
|
|
47
|
+
|
|
48
|
+
- A whole new media library makes it easier to manage all your assets.
|
|
49
|
+
- You can upload multiple assets at once, including files in nested folders, by browsing or dragging & dropping them on the media library[^5].
|
|
50
|
+
- You can now navigate between the global media folder and a per-collection media folder[^6] and soon move assets between them.
|
|
51
|
+
|
|
52
|
+
## Compatibility
|
|
53
|
+
|
|
54
|
+
While we’re not recreating all the features found in Netlify/Decap CMS, we plan to gradually expand the compatible areas where possible so that more users can migrate to our alternative.
|
|
55
|
+
|
|
56
|
+
| Feature | Status in Sveltia CMS |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| UI locales | Only English and Japanese are available at this time. No registration is needed. It can be changed in Preferences. |
|
|
59
|
+
| Account | Only the GitHub backend is available at this time. You can use Netlify Identity or an external OAuth client to sign in with GitHub, just like Netlify/Decap CMS. GitLab could be supported later, but other backends are unlikely to be added, mainly due to the lack of GraphQL API. |
|
|
60
|
+
| Configuration | Supported. |
|
|
61
|
+
| Media | External media storage services are not yet supported. |
|
|
62
|
+
| Editorial Workflow | Coming soon. |
|
|
63
|
+
| Collections | Supported. |
|
|
64
|
+
| Widgets | See below. |
|
|
65
|
+
| Custom widgets | Not yet supported. |
|
|
66
|
+
| Custom previews | Not yet supported. |
|
|
67
|
+
|
|
68
|
+
### Widgets
|
|
69
|
+
|
|
70
|
+
| Widget | Status in Sveltia CMS |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| Code | Not yet supported. |
|
|
73
|
+
| Color | It’s a native `<input>` widget at this time. The `enableAlpha` option is not yet supported. |
|
|
74
|
+
| Date/DateTime | It’s also a native `<input>` widget. The `date_format` and `time_format` options with Moment.js tokens are not yet supported. We may deprecate the Moment.js format support anyway. |
|
|
75
|
+
| File/Image | The `media_library` options are not yet supported other than `max_file_size` and `choose_url`. |
|
|
76
|
+
| List/Object | We haven’t tested with deeply nested fields. |
|
|
77
|
+
| Map | Not yet supported. |
|
|
78
|
+
| Markdown | It’s a plain text editor at this time. We’ll soon implement a rich text editor with i18n issues addressed. |
|
|
79
|
+
| Relation | The `search_fields` and `file` options are not yet supported. The `options_length` option will be ignored because it confuses users and Sveltia CMS doesn’t have the search performance issue. |
|
|
80
|
+
|
|
81
|
+
### Beta features in Netlify/Decap CMS
|
|
82
|
+
|
|
83
|
+
| Feature | Status in Sveltia CMS |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| Working with a Local Git Repository | Supported. See below for details. |
|
|
86
|
+
| GitLab and BitBucket Editorial Workflow Support | The GitLab backend is not yet supported. No plan to support BitBucket. |
|
|
87
|
+
| i18n Support | Supported. In fact, i18n is at the core of Sveltia CMS! |
|
|
88
|
+
| GitHub GraphQL API | Sveltia CMS uses GraphQL with no configuration. It cannot be disabled. |
|
|
89
|
+
| GitLab GraphQL API | The GitLab backend is not yet supported. |
|
|
90
|
+
| Open Authoring | Not yet supported. |
|
|
91
|
+
| Folder Collections Path | Not yet supported. |
|
|
92
|
+
| Folder Collections Media and Public Folder | Only the _undocumented_, absolute path per-collection folder configuration is currently supported. See below. |
|
|
93
|
+
| List Widget: Variable Types | Coming soon. |
|
|
94
|
+
| Custom Mount Element | Supported. |
|
|
95
|
+
| Manual Initialization | Not yet supported. |
|
|
96
|
+
| Raw CSS in registerPreviewStyle | Not yet supported. |
|
|
97
|
+
| Squash merge GitHub pull requests | Editorial workflow is not yet supported. |
|
|
98
|
+
| Commit Message Templates | Supported. |
|
|
99
|
+
| Image widget file size limit | Supported. |
|
|
100
|
+
| Summary string template transformations | Supported. |
|
|
101
|
+
| Registering to CMS Events | Not yet supported. |
|
|
102
|
+
| Dynamic Default Values | Not yet supported. |
|
|
103
|
+
| Nested Collections | Not yet supported. |
|
|
104
|
+
| Remark plugins | Not yet supported. |
|
|
105
|
+
|
|
106
|
+
### Known issues
|
|
107
|
+
|
|
108
|
+
- Auto-saving a draft entry isn’t implemented yet.
|
|
109
|
+
- Accessibility support is limited.
|
|
110
|
+
|
|
111
|
+
### Roadmap
|
|
112
|
+
|
|
113
|
+
- Further Netlify/Decap CMS compatibility, including Editorial Workflow
|
|
114
|
+
- Config editor[^10]
|
|
115
|
+
- Documentation
|
|
116
|
+
- Starter templates
|
|
117
|
+
|
|
118
|
+
## Getting started
|
|
119
|
+
|
|
120
|
+
### New users
|
|
121
|
+
|
|
122
|
+
Currently, Sveltia CMS is aimed at existing Netlify/Decap CMS users. If you don’t have it yet, follow [their documentation](https://www.netlifycms.org/docs/intro/) to install it and configure your site first. Then migrate to Sveltia CMS as described below.
|
|
123
|
+
|
|
124
|
+
### Migration
|
|
125
|
+
|
|
126
|
+
If you’re already using Netlify/Decap CMS with the GitHub backend and don’t have any custom widget, custom preview or plugin, migrating to Sveltia CMS is super easy. Edit `/admin/index.html` to replace the CMS script URL, and push the change to your repository:
|
|
127
|
+
|
|
128
|
+
```diff
|
|
129
|
+
-<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
|
|
130
|
+
+<script src="https://unpkg.com/@sveltia/cms/dist/sveltia-cms.js"></script>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
That’s it! You can open `https://[hostname]/admin/` as before to start editing. There is even no authentication process if you’ve already been signed in with GitHub on Netlify/Decap CMS because Sveltia CMS uses your auth token stored in the browser. Simple enough!
|
|
134
|
+
|
|
135
|
+
That said, we highly recommend testing your new Sveltia CMS instance first on your local machine. See below for how.
|
|
136
|
+
|
|
137
|
+
### Bug Report
|
|
138
|
+
|
|
139
|
+
Sveltia CMS is still in early beta, so we do expect various bugs. Please [report any bug to us](https://github.com/sveltia/sveltia-cms/issues/new).
|
|
140
|
+
|
|
141
|
+
## Tips & tricks
|
|
142
|
+
|
|
143
|
+
### Work with a local Git repository
|
|
144
|
+
|
|
145
|
+
You can use Sveltia CMS with a local Git repository, just like the [beta feature](https://www.netlifycms.org/docs/beta-features/#working-with-a-local-git-repository) in Netlify/Decap CMS, but Sveltia CMS has simplified the workflow by removing the necessity of the additional configuration and proxy server, thanks to the [File System Access API](https://developer.chrome.com/articles/file-system-access/).
|
|
146
|
+
|
|
147
|
+
1. Launch the local development server for your frontend framework, typically with `npm run dev`.
|
|
148
|
+
1. Visit `http://localhost:[port]/admin/index.html` with [Chrome or Edge](https://developer.mozilla.org/en-US/docs/web/api/window/showopenfilepicker#browser_compatibility).
|
|
149
|
+
1. Click “Work with Local Repository” and select the project’s root directory once prompted.
|
|
150
|
+
1. Make some changes on Sveltia CMS.
|
|
151
|
+
1. See if the produced changes look good using `git diff` or a GUI like GitHub Desktop.
|
|
152
|
+
1. Commit and push the changes if satisfied, or discard them if you’re just testing.
|
|
153
|
+
|
|
154
|
+
### Use a custom icon for a collection
|
|
155
|
+
|
|
156
|
+
As shown in the screenshot above, you can use different icons for collections in Sveltia CMS.
|
|
157
|
+
|
|
158
|
+
1. Visit [Google Fonts](https://fonts.google.com/icons?icon.set=Material+Symbols) and select a Material Symbols icon.
|
|
159
|
+
1. Select the Android tab within the right panel, and copy the icon name.
|
|
160
|
+
1. Add it to one of your collection definitions in `config.yml` as the new `icon` property, like the example below.
|
|
161
|
+
1. Repeat the same steps for all the collections if desired.
|
|
162
|
+
1. Commit and push the changes to your Git repository.
|
|
163
|
+
1. Reload Sveltia CMS once the updated config file is deployed.
|
|
164
|
+
|
|
165
|
+
```diff
|
|
166
|
+
- name: tags
|
|
167
|
+
label: Tags
|
|
168
|
+
+ icon: sell
|
|
169
|
+
create: true
|
|
170
|
+
folder: data/tags/
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Use a custom media folder for a collection
|
|
174
|
+
|
|
175
|
+
This is actually not new in Sveltia CMS but rather an _undocumented_ feature in Netlify/Decap CMS[^4]. You can specify media and public folders for each collection that override the [global media folder](https://www.netlifycms.org/docs/configuration-options/#media-and-public-folders). Well, it’s [documented](https://www.netlifycms.org/docs/beta-features/#folder-collections-media-and-public-folder) as a beta feature, but that’s probably not what you want.
|
|
176
|
+
|
|
177
|
+
Rather, if you’d like to add all the media files for a collection in one single folder, specify both `media_folder` and `public_folder` instead of leaving them empty. The trick is to use an _absolute path_ for `media_folder` like the example below. You can try this with Netlify/Decap CMS first if you prefer.
|
|
178
|
+
|
|
179
|
+
```diff
|
|
180
|
+
media_folder: static/media
|
|
181
|
+
public_folder: /media
|
|
182
|
+
|
|
183
|
+
collections:
|
|
184
|
+
- name: products
|
|
185
|
+
label: Products
|
|
186
|
+
create: true
|
|
187
|
+
folder: data/products/
|
|
188
|
+
+ media_folder: /static/media/products
|
|
189
|
+
+ public_folder: /media/products
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
In Sveltia CMS, those per-collection media folders are displayed prominently for easier asset management.
|
|
193
|
+
|
|
194
|
+
### Use DeepL to translate entry fields
|
|
195
|
+
|
|
196
|
+
Sveltia CMS comes with a handy DeepL integration so that you can translate any text field from another locale without leaving the content editor. To enable the high-quality, quick translation feature:
|
|
197
|
+
|
|
198
|
+
1. Sign up for [DeepL API](https://www.deepl.com/pro-api/) and copy your Authentication Key from DeepL’s Account page.
|
|
199
|
+
1. Go back to Sveltia CMS, click on the Account button at the top right corner, then click Preferences.
|
|
200
|
+
1. Paste your key to the DeepL API Authentication Key field, and close the Preferences dialog.
|
|
201
|
+
1. Open any entry, and you can now translate all fields or individual fields by selecting the Translate menu item.
|
|
202
|
+
1. If you have upgraded to DeepL API Pro, provide your new Authentication Key in the same way.
|
|
203
|
+
|
|
204
|
+
### Use a random ID for an entry slug
|
|
205
|
+
|
|
206
|
+
By default, the [slug for a new entry file](https://www.netlifycms.org/docs/configuration-options/#slug) will be generated based on the entry’s title field. Or, you can specify the collection’s `slug` option to use the file creation date or other fields. While the behavior is generally acceptable and SEO-friendly, it’s not useful if the title might change later or if it contains non-Latin characters like Chinese. In Sveltia CMS, you can easily generate a random [UUID](https://developer.mozilla.org/en-US/docs/Glossary/UUID) without a custom widget!
|
|
207
|
+
|
|
208
|
+
It’s simple — just specify `{{uuid}}` (full UUID v4) or `{{uuid_short}}` (last 12 characters only) in the `slug` option. The results would look like `4fc0917c-8aea-4ad5-a476-392bdcf3b642` and `392bdcf3b642`, respectively.
|
|
209
|
+
|
|
210
|
+
```diff
|
|
211
|
+
- name: members
|
|
212
|
+
label: Members
|
|
213
|
+
create: true
|
|
214
|
+
folder: data/members/
|
|
215
|
+
+ slug: '{{uuid_short}}'
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Set up Content Security Policy
|
|
219
|
+
|
|
220
|
+
If your site adopts Content Security Policy (CSP), use the following policy for Sveltia CMS, or some features may not work.
|
|
221
|
+
|
|
222
|
+
```csp
|
|
223
|
+
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
|
|
224
|
+
font-src 'self' https://fonts.gstatic.com;
|
|
225
|
+
img-src 'self' blob: data:;
|
|
226
|
+
script-src 'self' https://unpkg.com;
|
|
227
|
+
connect-src 'self' blob: data:;
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
And combine the following policies depending on your Git backend and enabled integrations.
|
|
231
|
+
|
|
232
|
+
- GitHub:
|
|
233
|
+
```csp
|
|
234
|
+
img-src https://avatars.githubusercontent.com;
|
|
235
|
+
connect-src https://api.github.com https://www.githubstatus.com;
|
|
236
|
+
```
|
|
237
|
+
- Pexels:
|
|
238
|
+
```csp
|
|
239
|
+
img-src https://images.pexels.com;
|
|
240
|
+
connect-src https://images.pexels.com https://api.pexels.com;
|
|
241
|
+
```
|
|
242
|
+
- Pixabay:
|
|
243
|
+
```csp
|
|
244
|
+
img-src https://pixabay.com;
|
|
245
|
+
connect-src https://pixabay.com;
|
|
246
|
+
```
|
|
247
|
+
- Unsplash:
|
|
248
|
+
```csp
|
|
249
|
+
img-src https://images.unsplash.com;
|
|
250
|
+
connect-src https://images.unsplash.com https://api.unsplash.com;
|
|
251
|
+
```
|
|
252
|
+
- DeepL API Free:
|
|
253
|
+
```csp
|
|
254
|
+
connect-src https://api-free.deepl.com;
|
|
255
|
+
```
|
|
256
|
+
- DeepL API Pro:
|
|
257
|
+
```csp
|
|
258
|
+
connect-src https://api.deepl.com;
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Support
|
|
262
|
+
|
|
263
|
+
Visit the [Discussions](https://github.com/sveltia/sveltia-cms/discussions) page on this GitHub repository.
|
|
264
|
+
|
|
265
|
+
## Contributions
|
|
266
|
+
|
|
267
|
+
Feel free to [file an issue](https://github.com/sveltia/sveltia-cms/issues/new) for a bug report or feature request! Meanwhile, pull requests are not accepted now due to limited review resources.
|
|
268
|
+
|
|
269
|
+
## Disclaimer
|
|
270
|
+
|
|
271
|
+
This software is provided “as is” without any express or implied warranty. This product is not affiliated with Netlify, Decap CMS or any other integrated services. All product names, logos, and brands are the property of their respective owners.
|
|
272
|
+
|
|
273
|
+
[^1]: [Netlify/Decap CMS #2557](https://github.com/netlify/netlify-cms/issues/2557)
|
|
274
|
+
[^2]: [Netlify/Decap CMS #3267](https://github.com/netlify/netlify-cms/issues/3267)
|
|
275
|
+
[^3]: [Netlify/Decap CMS #1040](https://github.com/netlify/netlify-cms/issues/1040)
|
|
276
|
+
[^4]: [Netlify/Decap CMS #3671](https://github.com/netlify/netlify-cms/issues/3671)
|
|
277
|
+
[^5]: [Netlify/Decap CMS #1032](https://github.com/netlify/netlify-cms/issues/1032)
|
|
278
|
+
[^6]: [Netlify/Decap CMS #3240](https://github.com/netlify/netlify-cms/issues/3240)
|
|
279
|
+
[^7]: [Netlify/Decap CMS #4386](https://github.com/netlify/netlify-cms/issues/4386)
|
|
280
|
+
[^10]: [Netlify/Decap CMS #341](https://github.com/netlify/netlify-cms/issues/341)
|
|
281
|
+
[^11]: [Netlify/Decap CMS #1382](https://github.com/netlify/netlify-cms/issues/1382)
|