Skip to content

Commit c7cf721

Browse files
docs: add migration guide
1 parent fc29aa7 commit c7cf721

File tree

2 files changed

+55
-4
lines changed

2 files changed

+55
-4
lines changed

docs/.vitepress/config.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,8 @@ function nav(): DefaultTheme.NavItem[] {
113113
{
114114
text: `v${version}`,
115115
items: [
116-
{
117-
text: 'Release Notes ',
118-
link: releases,
119-
},
116+
{ text: 'Release Notes ', link: releases },
117+
{ text: 'Migration Guide', link: '/advanced/migration' },
120118
],
121119
},
122120
]
@@ -152,6 +150,7 @@ function sidebarMain(): DefaultTheme.SidebarItem[] {
152150
{ text: 'How does it work?', link: '/advanced/how-does-it-work' },
153151
],
154152
},
153+
{ text: 'Migration', link: '/advanced/migration' },
155154
]
156155
}
157156

docs/advanced/migration.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Migration Guide
2+
3+
## From Nuxt KQL v2 to Nuxt Kirby v3
4+
5+
[Matt Lenz](https://github.com/mattlenz) kindly provided the `nuxt-kirby` npm package name and has transferred the ownership of the package to me. Therefore, the module name has changed from `nuxt-kql` to `nuxt-kirby`. This better reflects the purpose of the module, which is to integrate [Kirby CMS](https://getkirby.com/) with Nuxt – not only for KQL queries.
6+
7+
Other than the module name change, there are no breaking changes in the module itself. However, you have to update the Nuxt module configuration key from `kql` to `kirby`.
8+
9+
Please follow these steps to migrate your existing Nuxt KQL v2 project to Nuxt Kirby v3:
10+
11+
1. Uninstall the `nuxt-kql` module and install the `nuxt-kirby` module instead:
12+
```bash
13+
npm uninstall nuxt-kql && npm install nuxt-kirby
14+
15+
# pnpm
16+
pnpm remove nuxt-kql && pnpm add nuxt-kirby
17+
18+
# yarn
19+
yarn remove nuxt-kql && yarn add nuxt-kirby
20+
```
21+
22+
2. Update your `nuxt.config.ts` file to replace all instances of `kql` with `kirby`. For example, change this:
23+
```ts
24+
// `nuxt.config.ts`
25+
export default defineNuxtConfig({
26+
modules: ['nuxt-kql'], // [!code --]
27+
modules: ['nuxt-kirby'], // [!code ++]
28+
29+
kql: { // [!code --]
30+
auth: 'bearer' // [!code --]
31+
}, // [!code --]
32+
kirby: { // [!code ++]
33+
auth: 'bearer' // [!code ++]
34+
}, // [!code ++]
35+
})
36+
```
37+
38+
To keep breaking changes to a minimum, the import alias `#nuxt-kql` has been kept for now. If you are using it to import any Kirby types, you can keep using it. For future-proofing your code, please consider changing it to `#nuxt-kirby` instead. For example, change this:
39+
40+
```ts
41+
import type { KirbyQueryRequest } from '#nuxt-kirby' // [!code ++]
42+
import type { KirbyQueryRequest } from '#nuxt-kql' // [!code --]
43+
44+
const query = ref<KirbyQueryRequest>({
45+
query: 'page("notes/across-the-ocean")',
46+
select: {
47+
id: true,
48+
title: true,
49+
text: 'page.text.toBlocks',
50+
},
51+
})
52+
```

0 commit comments

Comments
 (0)