Skip to content

Commit

Permalink
feat(katzencore): Added StorageManagement; README changed; Removed un…
Browse files Browse the repository at this point in the history
…necessary icons; Fixed Typos; Added Deploy Hook Config & Function
  • Loading branch information
maxlkatze committed Jul 23, 2024
1 parent b505150 commit 488f534
Show file tree
Hide file tree
Showing 21 changed files with 371 additions and 499 deletions.
44 changes: 38 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ Find and replace all on all files (CMD+SHIFT+F):
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]

![CmsKatze](/src/runtime/assets/logo.svg)
![CmsKatze](/src/runtime/assets/logo_outlines.svg)

- [ Release Notes](/CHANGELOG.md)
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/cms-katze?file=playground%2Fapp.vue) -->
<!-- - [📖 &nbsp;Documentation](https://example.com) -->

## Warning
In active development, not ready for production use.
The content.katze.json is not being synced with Git LFS or Git

_Feel free to contribute to this project by creating a pull request.🐱❤️_

Expand All @@ -35,12 +34,12 @@ _Feel free to contribute to this project by creating a pull request.🐱❤️_
## Quick Setup

1. Install using: `npm install @maxlkate/cms@latest`
2. Add `@maxlkate/cms` to the `modules` section of `nuxt.config.js`
2. Add `@maxlkatze/cms` to the `modules` section of `nuxt.config.js`

```js
{
modules: [
'@maxlkate/cms'
'@maxlkatze/cms'
]
}
```
Expand Down Expand Up @@ -124,8 +123,15 @@ You can configure Katze by adding the `katzenCore` key to `nuxt.config.js`
password: 'your secret password', // default: "admin"
},
],
secret: 'your secret key for token encryption',
projectLocation: './', // default: "./"
secret: 'your secret key for token encryption',
projectLocation: './', // default: "./",
projectName: 'YourSiteName',
storage: {
type: 'fs', // default: "fs" | Unstorage Types supported
options: {
// UNSTORAGE OPTIONS
}
}
}
```
#### Users
Expand All @@ -137,6 +143,32 @@ The secret is used to encrypt the Login token for the CMS editor.
#### Project Location
The project location is used to store the content.katze.json fileand to locate the public folder.

#### Project Name
The project name is used to identify the project in the Storage.

#### Storage
The storage can be configured with unstorage drivers.

##### Supported Unstorage Drivers
- azure-app-configuration - [Documentation](https://unstorage.unjs.io/drivers/azure)
- cloudflare-kv-binding - [Documentation](https://unstorage.unjs.io/drivers/cloudflare)
- fs - [Documentation](https://unstorage.unjs.io/drivers/fs)
- github - [Documentation](https://unstorage.unjs.io/drivers/github)
- mongodb - [Documentation](https://unstorage.unjs.io/drivers/mongodb)
- netlify-blobs - [Documentation](https://unstorage.unjs.io/drivers/netlify)
- planetscale - [Documentation](https://unstorage.unjs.io/drivers/planetscale)
- redis - [Documentation](https://unstorage.unjs.io/drivers/redis)
- vercel-kv - [Documentation](https://unstorage.unjs.io/drivers/vercel)

Storage implementation example:
```js
storage: {
type: 'fs',
options: {
base: './',
}
}
```

## Contribution

Expand Down
8 changes: 5 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { type PlanetscaleDriverOptions } from 'unstorage/drivers/planetscale'
import { type RedisOptions } from 'unstorage/drivers/redis'
import { type VercelKVOptions } from 'unstorage/drivers/vercel-kv'
import pkg from '../package.json'
import { useContentStorage } from './runtime/storage/StorageManagment'
import { useContentStorage } from './runtime/storage/StorageManagement'

export interface CmsUser {
name: string
Expand All @@ -37,12 +37,13 @@ export interface ModuleOptions {
type: 'azure-app-configuration' | 'cloudflare-kv-binding' | 'fs' | 'github' | 'mongodb' | 'netlify-blobs' | 'planetscale' | 'redis' | 'vercel-kv'
options: AzureAppConfigurationOptions | KVOptions | FSStorageOptions | GithubOptions | MongoDbOptions | NetlifyStoreOptions | PlanetscaleDriverOptions | RedisOptions | VercelKVOptions
}
deployHookURL?: string
}

export default defineNuxtModule<ModuleOptions>({
meta: {
name: 'KatzenCore',
configKey: 'katzenCore',
name: 'CMSKatze',
configKey: 'katze',
},
// Default configuration options of the Nuxt module
defaults: {
Expand Down Expand Up @@ -107,6 +108,7 @@ export default defineNuxtModule<ModuleOptions>({
_nuxt.options.runtimeConfig.projectLocation = _options.projectLocation + (_options.projectLocation.endsWith('/') ? '' : '/')
const storageKey = _options.projectName + '_katze_content'
_nuxt.options.runtimeConfig.storageKey = storageKey
_nuxt.options.runtimeConfig.deployHookURL = _options.deployHookURL

const contentStorage = await useContentStorage(_nuxt.options.runtimeConfig)
let content = await contentStorage.getItem(storageKey)
Expand Down
Loading

0 comments on commit 488f534

Please sign in to comment.