|
| 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