Skip to content

Commit

Permalink
Update vue-craftcms and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelreichor committed Nov 16, 2024
1 parent 3f95515 commit b82240f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 43 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-wombats-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nuxt-craftcms": patch
---

Update vue-craftcms and add new config option. Update Readme.
45 changes: 20 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,43 @@

<p align="center">
<a href="https://npmjs.com/package/nuxt-craftcms">
<img src="https://img.shields.io/npm/v/nuxt-craftcms/latest.svg?style=flat-square" alt="Nuxt craftcms latest version" />
<img src="https://img.shields.io/npm/v/nuxt-craftcms?color=blue" alt="Nuxt craftcms latest version" />
</a>
<a href="https://npmjs.com/package/nuxt-craftcms" rel="nofollow">
<img src="https://img.shields.io/npm/dt/nuxt-craftcms.svg?style=flat-square" alt="Nuxt craftcms downloads">
<img src="https://img.shields.io/npm/d18m/nuxt-craftcms?color=blue" alt="Nuxt craftcms downloads">
</a>
<a href="https://npmjs.com/package/nuxt-craftcms" rel="nofollow">
<img src="https://img.shields.io/github/license/samuelreichor/nuxt-craftcms?color=blue" alt="Nuxt craftcms license">
</a>
</p>

> [!WARNING]
> This npm package is still in production and important features may change.
## Quick Setup

Install the module to your Nuxt application with one command:
## Features

- Easily build and execute queries directly from Nuxt.
- Connect your data directly with your Vue components, to speed up development.
- Avoid overfetching by using a custom function in the query builder to select only the fields you require.
- Json Transformer are in place to prettify the response.
- Query addresses, assets, entries and users.

```bash
npx nuxi module add nuxt-craftcms
```
## Requirements

Add a craftcms config to your `nuxt.config.js` and replace the baseUrl with your Craft CMS url.
This plugin requires Nuxt 3 and the [Craft Query API](https://github.com/samuelreichor/craft-query-api) installed on your Craft CMS instance.

```typescript
import { defineNuxtConfig } from 'nuxt';
## Documentation

export default defineNuxtConfig({
modules: ['nuxt-craftcms'],
Visit the [Nuxt Craft CMS](https://samuelreichor.at/libraries/nuxt-craftcms) for all documentation, guides and developer resources.

craftcms: {
baseUrl: 'https://backend-craftcms.ddev.site'
}
});
```

## Further Resources

- [Craft CMS Plugin](https://github.com/samuelreichor/craft-query-api)
- [Core JS Querybuilder](https://github.com/samuelreichor/js-craftcms-api)
- [Vue Craft](https://github.com/samuelreichor/vue-craftcms)
- [Craft Query API](https://github.com/samuelreichor/craft-query-api): A Craft CMS Plugin, that powers this great stuff.
- [JS Craft CMS API](https://github.com/samuelreichor/js-craftcms-api): The core package of the querybuilder.
- [Vue Craft CMS](https://github.com/samuelreichor/nuxt-craft): A package to use the query builder in Vue.

## Support

- Bugs or Feature Requests? [Submit an issue](/../../issues/new).

## Contributing

Contributions are welcome! <3
If you encounter bugs or have feature requests, [please submit an issue](/../../issues/new). Your feedback helps improve the library!
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"dependencies": {
"@nuxt/kit": "^3.13.2",
"vue-craftcms": "0.2.0"
"vue-craftcms": "0.2.1"
},
"devDependencies": {
"@changesets/cli": "^2.27.9",
Expand Down
10 changes: 3 additions & 7 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { addPlugin, defineNuxtModule, addImportsDir, addComponent, createResolver } from '@nuxt/kit'
import type { CraftCmsOptions } from 'vue-craftcms'
import { defaultOptions, type CraftCmsOptions } from 'vue-craftcms'

export default defineNuxtModule<CraftCmsOptions>({
export default defineNuxtModule<Required<CraftCmsOptions>>({
meta: {
name: 'nuxt-craftcms',
configKey: 'craftcms',
Expand All @@ -10,11 +10,7 @@ export default defineNuxtModule<CraftCmsOptions>({
},
},
// Default configuration options of the Nuxt module
defaults: {
baseUrl: '',
debug: false,
registerComponents: true,
},
defaults: defaultOptions,
setup(options, nuxt) {
const resolver = createResolver(import.meta.url)

Expand Down

0 comments on commit b82240f

Please sign in to comment.