Skip to content

Commit ad0b0d7

Browse files
feat!: rename package from nuxt-kql to nuxt-kirby (#29)
* feat!: rename package from `nuxt-kql` to `nuxt-kirby` * chore: remove rename note * chore: update package name
1 parent 270892b commit ad0b0d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1442
-823
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 🐞 Bug report
2-
description: Write a report to help improve Nuxt KQL
2+
description: Write a report to help improve Nuxt Kirby
33
labels: [pending triage]
44
body:
55
- type: markdown

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
blank_issues_enabled: true
22
contact_links:
3-
- name: 📚 Nuxt KQL Documentation
4-
url: https://github.com/johannschopplich/nuxt-kql#readme
5-
about: Check the documentation for usage of Nuxt KQL
3+
- name: 📚 Nuxt Kirby Documentation
4+
url: https://nuxt-kirby.byjohann.dev
5+
about: Check the documentation for usage of Nuxt Kirby

.github/ISSUE_TEMPLATE/feature-request.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 🚀 Feature request
2-
description: Suggest a feature that will improve Nuxt KQL
2+
description: Suggest a feature that will improve Nuxt Kirby
33
labels: [pending triage]
44
body:
55
- type: markdown
@@ -12,7 +12,7 @@ body:
1212
id: feature-description
1313
attributes:
1414
label: Describe the feature
15-
description: A clear and concise description of what you think would be a helpful addition to Nuxt KQL, including the possible use cases and alternatives you have considered.
15+
description: A clear and concise description of what you think would be a helpful addition to Nuxt Kirby, including the possible use cases and alternatives you have considered.
1616
placeholder: Feature description
1717
validations:
1818
required: true
@@ -30,5 +30,5 @@ body:
3030
label: Final checks
3131
description: 'Before submitting, please make sure you do the following:'
3232
options:
33-
- label: Check existing [issues](https://github.com/johannschopplich/nuxt-kql/issues).
33+
- label: Check existing [issues](https://github.com/johannschopplich/nuxt-kirby/issues).
3434
required: true

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
[![Nuxt KQL module](./docs/public/og.jpg)](https://nuxt-kql.byjohann.dev)
1+
[![Nuxt Kirby module](./docs/public/og.jpg)](https://nuxt-kirby.byjohann.dev)
22

3-
# Nuxt KQL
3+
# Nuxt Kirby
44

55
[Nuxt](https://nuxt.com) module for [Kirby's Query Language](https://github.com/getkirby/kql) API.
66

7-
- [ Release Notes](https://github.com/johannschopplich/nuxt-kql/releases)
8-
- [📖  Read the documentation](https://nuxt-kql.byjohann.dev)
7+
- [ Release Notes](https://github.com/johannschopplich/nuxt-kirby/releases)
8+
- [📖  Read the documentation](https://nuxt-kirby.byjohann.dev)
99

1010
## Features
1111

1212
- 🔒 Protected Kirby credentials when sending queries
13-
- 🪢 Supports token-based authentication with the [Kirby Headless plugin](https://github.com/johannschopplich/kirby-headless) (recommended)
13+
- 🪢 Supports token-based authentication with the [Kirby Headless plugin](https://kirby.tools/docs/headless/getting-started/) (recommended)
1414
- 🤹 No CORS issues!
1515
- 🍱 Handle request just like with the [`useFetch`](https://nuxt.com/docs/getting-started/data-fetching/#usefetch) composable
1616
- 🗃 Cached query responses
17-
- 🦦 [Multiple starter kits](https://nuxt-kql.byjohann.dev/guide/starters) available
17+
- 🦦 [Multiple starter kits](https://nuxt-kirby.byjohann.dev/guide/starters) available
1818
- 🦾 Strongly typed
1919

2020
## Setup
2121

2222
> [!TIP]
23-
> [📖 Read the documentation](https://nuxt-kql.byjohann.dev)
23+
> [📖 Read the documentation](https://nuxt-kirby.byjohann.dev)
2424
2525
```bash
26-
npx nuxi@latest module add kql
26+
npx nuxi@latest module add kirby
2727
```
2828

2929
## Basic Usage
3030

3131
> [!TIP]
32-
> [📖 Read the documentation](https://nuxt-kql.byjohann.dev)
32+
> [📖 Read the documentation](https://nuxt-kirby.byjohann.dev)
3333
34-
Add the Nuxt KQL module to your Nuxt config:
34+
Add the Nuxt Kirby module to your Nuxt config:
3535

3636
```ts
3737
// `nuxt.config.ts`
3838
export default defineNuxtConfig({
39-
modules: ['nuxt-kql']
39+
modules: ['nuxt-kirby']
4040
})
4141
```
4242

docs/.vitepress/config.ts

Lines changed: 57 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,16 @@ export default defineConfig({
3535
logo: '/logo.svg',
3636

3737
editLink: {
38-
pattern: 'https://github.com/johannschopplich/nuxt-kql/edit/main/docs/:path',
38+
pattern: 'https://github.com/johannschopplich/nuxt-kirby/edit/main/docs/:path',
3939
text: 'Suggest changes to this page',
4040
},
4141

4242
nav: nav(),
4343

4444
sidebar: {
45-
'/guide/': sidebarGuide(),
46-
'/config/': sidebarGuide(),
47-
'/usage/': sidebarGuide(),
48-
'/faq/': sidebarGuide(),
45+
'/essentials/': sidebarMain(),
46+
'/guides/': sidebarMain(),
47+
'/advanced/': sidebarMain(),
4948
'/api/': sidebarApi(),
5049
},
5150

@@ -67,45 +66,45 @@ export default defineConfig({
6766
function nav(): DefaultTheme.NavItem[] {
6867
return [
6968
{
70-
text: 'Guide',
71-
activeMatch: '^/guide/',
69+
text: 'Essentials',
70+
activeMatch: '^/essentials/',
7271
items: [
73-
{ text: 'What is Nuxt KQL?', link: '/guide/what-is-nuxt-kql' },
74-
{ text: 'Getting Started', link: '/guide/getting-started' },
75-
{ text: 'Starter Kits', link: '/guide/starters' },
72+
{ text: 'What is Nuxt Kirby?', link: '/essentials/what-is-nuxt-kirby' },
73+
{ text: 'Getting Started', link: '/essentials/getting-started' },
74+
{ text: 'Data Fetching Methods', link: '/essentials/data-fetching-methods' },
75+
{ text: 'Authentication', link: '/essentials/authentication' },
76+
{ text: 'Starter Kits', link: '/essentials/starter-kits' },
7677
],
7778
},
7879
{
79-
text: 'Configuration',
80-
link: '/config/',
81-
},
82-
{
83-
text: 'Usage',
84-
activeMatch: '^/usage/',
80+
text: 'Guides',
81+
activeMatch: '^/guides/',
8582
items: [
86-
{ text: 'Authentication', link: '/usage/authentication-methods' },
87-
{ text: 'Caching', link: '/usage/caching' },
88-
{ text: 'Error Handling', link: '/usage/error-handling' },
89-
{ text: 'Typed Responses', link: '/usage/typed-query-results' },
90-
{ text: 'Prefetching Queries', link: '/usage/prefetching-queries' },
91-
{ text: 'Multi-Language Sites', link: '/usage/multi-language-sites' },
92-
{ text: 'Batching Queries', link: '/usage/batching-queries' },
83+
{ text: 'Multi-Language Sites', link: '/guides/multi-language-sites' },
84+
{ text: 'Caching Strategies', link: '/guides/caching-strategies' },
85+
{ text: 'Error Handling', link: '/guides/error-handling' },
86+
{ text: 'Prefetching KQL Queries', link: '/guides/prefetching-kql-queries' },
87+
{ text: 'Batching KQL Queries', link: '/guides/batching-kql-queries' },
9388
],
9489
},
9590
{
9691
text: 'API',
9792
activeMatch: '^/api/',
9893
items: [
94+
{ text: 'Overview', link: '/api/' },
95+
{ text: 'Module Configuration', link: '/api/module-configuration' },
96+
{ text: 'Types', link: '/api/types' },
9997
{
100-
text: 'Overview',
101-
link: '/api/',
98+
text: 'KQL Queries',
99+
items: [
100+
{ text: 'useKql', link: '/api/use-kql' },
101+
{ text: '$kql', link: '/api/kql' },
102+
],
102103
},
103104
{
104-
text: 'Composables',
105+
text: 'Kirby API',
105106
items: [
106-
{ text: 'useKql', link: '/api/use-kql' },
107107
{ text: 'useKirbyData', link: '/api/use-kirby-data' },
108-
{ text: '$kql', link: '/api/kql' },
109108
{ text: '$kirby', link: '/api/kirby' },
110109
],
111110
},
@@ -123,65 +122,64 @@ function nav(): DefaultTheme.NavItem[] {
123122
]
124123
}
125124

126-
function sidebarGuide(): DefaultTheme.SidebarItem[] {
125+
function sidebarMain(): DefaultTheme.SidebarItem[] {
127126
return [
128127
{
129-
text: 'Guides',
128+
text: 'Essentials',
130129
items: [
131-
{ text: 'What is Nuxt KQL?', link: '/guide/what-is-nuxt-kql' },
132-
{ text: 'Getting Started', link: '/guide/getting-started' },
133-
{ text: 'Starter Kits', link: '/guide/starters' },
130+
{ text: 'What is Nuxt Kirby?', link: '/essentials/what-is-nuxt-kirby' },
131+
{ text: 'Getting Started', link: '/essentials/getting-started' },
132+
{ text: 'Data Fetching Methods', link: '/essentials/data-fetching-methods' },
133+
{ text: 'Authentication', link: '/essentials/authentication' },
134+
{ text: 'Starter Kits', link: '/essentials/starter-kits' },
134135
],
135136
},
136137
{
137-
text: 'Configuration',
138-
items: [
139-
{ text: 'Module', link: '/config/' },
140-
],
141-
},
142-
{
143-
text: 'Usage',
138+
text: 'Guides',
144139
items: [
145-
{ text: 'Authentication', link: '/usage/authentication-methods' },
146-
{ text: 'Caching', link: '/usage/caching' },
147-
{ text: 'Error Handling', link: '/usage/error-handling' },
148-
{ text: 'Typed Responses', link: '/usage/typed-query-results' },
149-
{ text: 'Prefetching Queries', link: '/usage/prefetching-queries' },
150-
{ text: 'Multi-Language Sites', link: '/usage/multi-language-sites' },
151-
{ text: 'Batching Queries', link: '/usage/batching-queries' },
140+
{ text: 'Multi-Language Sites', link: '/guides/multi-language-sites' },
141+
{ text: 'Caching Strategies', link: '/guides/caching-strategies' },
142+
{ text: 'Error Handling', link: '/guides/error-handling' },
143+
{ text: 'Prefetching KQL Queries', link: '/guides/prefetching-kql-queries' },
144+
{ text: 'Batching KQL Queries', link: '/guides/batching-kql-queries' },
152145
],
153146
},
154147
{
155-
text: 'FAQ',
148+
text: 'Digging Deeper',
156149
items: [
157-
{ text: 'How Does It Work?', link: '/faq/how-does-it-work' },
158-
{ text: 'What Is KQL?', link: '/faq/what-is-kql' },
159-
{ text: 'Can I Encounter CORS Issues?', link: '/faq/cors-issues' },
150+
{ text: 'CORS Issues', link: '/advanced/cors-issues' },
151+
{ text: 'What is KQL?', link: '/advanced/what-is-kql' },
152+
{ text: 'How does it work?', link: '/advanced/how-does-it-work' },
160153
],
161154
},
162155
]
163156
}
164157

165158
function sidebarApi(): DefaultTheme.SidebarItem[] {
166159
return [
160+
{ text: 'Overview', link: '/api/' },
161+
{ text: 'Module Configuration', link: '/api/module-configuration' },
167162
{
168-
text: 'Overview',
169-
link: '/api/',
163+
text: 'KQL Queries',
164+
items: [
165+
{ text: 'useKql', link: '/api/use-kql' },
166+
{ text: '$kql', link: '/api/kql' },
167+
],
170168
},
171169
{
172-
text: 'Composables',
170+
text: 'Kirby API',
173171
items: [
174-
{ text: 'useKql', link: '/api/use-kql' },
175172
{ text: 'useKirbyData', link: '/api/use-kirby-data' },
176-
{ text: '$kql', link: '/api/kql' },
177173
{ text: '$kirby', link: '/api/kirby' },
178174
],
179175
},
180176
{
181-
text: 'Type Declarations',
177+
text: 'Types',
182178
items: [
183-
{ text: 'KirbyQueryRequest', link: '/api/types-query-request' },
184-
{ text: 'KirbyQueryResponse', link: '/api/types-query-response' },
179+
{ text: 'Using Types', link: '/api/types' },
180+
{ text: 'Query Types', link: '/api/types-query' },
181+
{ text: 'Request Types', link: '/api/types-request' },
182+
{ text: 'Response Types', link: '/api/types-response' },
185183
],
186184
},
187185
]

docs/.vitepress/meta.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* VitePress head */
2-
export const name = 'Nuxt KQL'
3-
export const ogUrl = 'https://nuxt-kql.byjohann.dev/'
2+
export const name = 'Nuxt Kirby'
3+
export const ogUrl = 'https://nuxt-kirby.byjohann.dev/'
44
export const ogImage = `${ogUrl}og.jpg`
55

66
/* GitHub and social links */
7-
export const github = 'https://github.com/johannschopplich/nuxt-kql'
8-
export const releases = 'https://github.com/johannschopplich/nuxt-kql/releases'
7+
export const github = 'https://github.com/johannschopplich/nuxt-kirby'
8+
export const releases = 'https://github.com/johannschopplich/nuxt-kirby/releases'
99
export const twitter = 'https://twitter.com/jschopplich'

docs/advanced/common-issues.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Common Issues
2+
3+
Solutions to frequently encountered problems when using Nuxt Kirby.
4+
5+
## CORS Issues
6+
7+
### Can I Encounter CORS Issues?
8+
9+
**tl;dr**: No, since Nuxt will proxy requests to Kirby through its own server.
10+
11+
With the default module configuration, you will not have to deal with CORS issues. [`useKql`](/api/use-kql), [`useKirbyData`](/api/use-kirby-data), [`$kql`](/api/kql), and [`$kirby`](/api/kirby) pass a given request to the internal Nuxt server route `/api/__kirby__` set up by the module.
12+
13+
On the server, the request is forwarded to the Kirby instance, and the response is sent back to the client. Since the request is made server-side, CORS is not an issue.
14+
15+
### What if I Enable Client-Side Requests?
16+
17+
If you enable `client: true` in your configuration, requests go directly from the browser to Kirby, which may encounter CORS issues depending on your Kirby setup.
18+
19+
**Solution**: Configure CORS headers in your Kirby installation:
20+
21+
```php
22+
// site/config/config.php
23+
return [
24+
'api' => [
25+
'basicAuth' => true,
26+
'allowInsecure' => true // for development only
27+
],
28+
'hooks' => [
29+
'route:before' => function ($route, $path, $method) {
30+
if ($method === 'OPTIONS') {
31+
header('Access-Control-Allow-Origin: *');
32+
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
33+
header('Access-Control-Allow-Headers: Content-Type, Authorization');
34+
exit;
35+
}
36+
}
37+
]
38+
];
39+
```
40+
41+
## Authentication Issues
42+
43+
**Check your environment variables**:
44+
45+
```bash
46+
# Make sure these are set correctly
47+
KIRBY_BASE_URL=https://your-kirby-site.com
48+
KIRBY_API_TOKEN=your-secret-token
49+
50+
# Or for basic auth:
51+
KIRBY_API_USERNAME=your-username
52+
KIRBY_API_PASSWORD=your-password
53+
```
54+
55+
**Check your Kirby setup**:
56+
57+
For **bearer token** authentication:
58+
- Ensure the [Kirby Headless plugin](https://kirby.tools/docs/headless/getting-started/) is installed
59+
- Verify the token matches in both applications
60+
- Check that the endpoint is `api/kql` not `api/query`
61+
62+
For **basic authentication**:
63+
- Ensure `basicAuth` is enabled in Kirby's config
64+
- Check that the endpoint is `api/query` not `api/kql`
65+
- Verify username and password are correct

docs/advanced/cors-issues.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
### Can I Encounter CORS Issues?
2+
3+
::: tip tl;dr:
4+
No, since Nuxt will proxy requests to Kirby through its own server.
5+
:::
6+
7+
With the default module configuration, you will not have to deal with CORS issues. [`useKql`](/api/use-kql), [`useKirbyData`](/api/use-kirby-data), [`$kql`](/api/kql), and [`$kirby`](/api/kirby) pass a given request to the internal Nuxt server route `/api/__kirby__` set up by the module.
8+
9+
On the server, the request is forwarded to the Kirby instance, and the response is sent back to the client. Since the request is made server-side, CORS is not an issue.
10+
11+
### What if I Enable Client-Side Requests?
12+
13+
When enabling `client: true` in your Nuxt Kirby configuration, requests are sent directly from the browser to Kirby, which may encounter CORS issues depending on your Kirby setup.
14+
15+
If you have followed the [Getting Started guide](essentials/getting-started.html#step-3-set-up-your-kirby-backend), your Kirby instance should already be configured with the [Kirby Headless plugin](https://kirby.tools/docs/headless/getting-started/). It includes default CORS settings that allow requests from any origin.
16+
17+
```php
18+
// site/config/config.php
19+
return [
20+
'headless' => [
21+
// https://kirby.tools/docs/headless/configuration/cors
22+
'cors' => [
23+
'allowOrigin' => '*',
24+
'allowMethods' => 'GET, POST, OPTIONS',
25+
'allowHeaders' => 'Accept, Content-Type, Authorization, X-Language',
26+
'maxAge' => '86400',
27+
]
28+
]
29+
];
30+
```
31+
32+
::: info
33+
To improve security, you might want to restrict the `allowOrigin` parameter to your actual front-end domain in your production setup.
34+
:::

0 commit comments

Comments
 (0)