Skip to content

Commit 1057ab6

Browse files
committed
chore: release v3.0.0
1 parent a84e728 commit 1057ab6

File tree

3 files changed

+94
-60
lines changed

3 files changed

+94
-60
lines changed

UPGRADE.md

Lines changed: 91 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,27 @@ Vuepal 3.0 comes with a lot of new features and improvements. This document
44
outlines the changes and how to upgrade your existing Vuepal setup to the latest
55
version.
66

7-
Vuepal 3.0 is meant to be used with Nuxt > 3.17 and with the following modules:
7+
Version 3.0 is meant to be used with Nuxt > 3.17 and with the latest versions of
8+
these modules:
89

9-
- [Nuxt GraphQL Middleware](https://nuxt.com/modules/nuxt-graphql-middleware) >
10-
5.0.0
11-
- [Nuxt Language Negotiation](https://github.com/dulnan/nuxt-language-negotiation) >
12-
2.0.0
13-
- [Nuxt Easy Texts](https://github.com/dulnan/nuxt-easy-texts) > 2.0.0
14-
- [Nuxt SVG Icon Sprite](https://github.com/dulnan/nuxt-svg-icon-sprite) > 2.0.0
15-
- [NUxt Page Dependency](https://github.com/dulnan/nuxt-page-dependencies) >
16-
1.0.0
10+
| Module | Version | Upgrade Guide |
11+
| ------------------------- | ------- | -------------------------------------------------------------------------------- |
12+
| nuxt-graphql-middleware | 5.1.0 | https://github.com/dulnan/nuxt-graphql-middleware/releases/tag/release%2F5.0.0 |
13+
| nuxt-language-negotiation | 2.0.0 | https://github.com/dulnan/nuxt-language-negotiation/releases/tag/release%2F2.0.0 |
14+
15+
When using the "blökkli Starterkit", you may also update
16+
[nuxt-easy-texts](https://github.com/dulnan/nuxt-easy-texts) and
17+
[nuxt-svg-icon-sprite](https://github.com/dulnan/nuxt-svg-icon-sprite), though
18+
they don't have any dependency with Vuepal.
1719

1820
## Nuxt 4 compatibility
1921

2022
The Vuepal module is compatible with Nuxt 4. The module will automatically
2123
detect the Nuxt version and work with the new file structure. We recommend
22-
already switching to the
24+
already switching to this
2325
[new folder structure](https://nuxt.com/docs/getting-started/upgrade#new-directory-structure).
2426

25-
## Automatic Registering of fragments
27+
## Automatic Registration of Fragments
2628

2729
A new feature in nuxt-graphql-middleware allows other modules to automatically
2830
register GraphQL documents. Vuepal also uses this for its fragments and queries.
@@ -68,14 +70,14 @@ exist. Based on that, it will dynamically add or remove certain features.
6870
For example, if you enable the `graphql_metatag_schema_org_schema` Drupal module
6971
and the `metatags_schema_org` GraphQL extension, Vuepal will automatically query
7072
the `schemaOrgMetatags` field in route queries and set the schema.org metatags
71-
automatically.
73+
automatically. This also applies for `breadcrumb`, `languageSwitchLinks` and
74+
`metatags`.
7275

7376
## New `useDrupalRouteQuery` composable
7477

7578
This is the most important change in Vuepal 3.0. Instead of creating a GraphQL
76-
query for each route, you can now use the `useDrupalRouteQuery()` composable to
77-
automatically generate route queries. You can define the queries to generate and
78-
the related fragments in the Vuepal configuration in the `nuxt.config.ts` file.
79+
query for each route, you can now let Vuepal create them for your. You can
80+
define the route queries in the configuration in your `nuxt.config.ts`.
7981

8082
This new feature is optional; the "old way" still works.
8183

@@ -123,8 +125,7 @@ await renderPageDependencies()
123125
### After
124126

125127
Define the route queries in the `nuxt.config.ts` file. Here you need to specify
126-
the fragments that this route query will use. The`useDrupalRouteQuery()`
127-
composable will automatically generate the GraphQL query and extract the entity.
128+
which entity fragments the query should contain:
128129

129130
```ts
130131
export default defineNuxtConfig({
@@ -144,6 +145,9 @@ export default defineNuxtConfig({
144145
})
145146
```
146147

148+
Now you can use these three route queries using the new `useDrupalRouteQuery`
149+
composable:
150+
147151
File: `pages/[...slug]/index.vue`
148152

149153
```vue
@@ -213,12 +217,11 @@ introduced in `nuxt-language-negotiation`.
213217

214218
```ts
215219
definePageMeta({
216-
name: 'static-page-example',
220+
name: 'contact',
217221
drupalFrontendRoute: true,
218222
languageMapping: {
219-
de: '/de/statisch',
220-
fr: '/fr/statique',
221-
en: '/en/static',
223+
de: '/de/kontakt',
224+
en: '/en/contact',
222225
},
223226
})
224227
```
@@ -237,42 +240,6 @@ definePageMeta({
237240
})
238241
```
239242

240-
## Removal of the `pluginOrder` module
241-
242-
This module is no longer needed as Nuxt 3 now has a solution to properly order
243-
the plugins.
244-
245-
Before:
246-
247-
```ts [nuxt.config.ts]
248-
pluginOrder: {
249-
order: [
250-
// Match plugins by their file path.
251-
// Note that only a single plugin may match.
252-
// The match is performed as "plugin.src.includes(v.pathMatch)".
253-
{ pathMatch: 'plugins/language.ts' },
254-
{ pathMatch: 'myother/plugin.ts' },
255-
],
256-
logSortedPlugins
257-
:
258-
false,
259-
}
260-
```
261-
262-
After: Use the `dependsOn` feature of Nuxt 3 to define plugin order.
263-
264-
```ts [app/plugins/initData.ts]
265-
export default defineNuxtPlugin({
266-
name: 'starterkit:init-data',
267-
dependsOn: [
268-
'nuxt-graphql-middleware-provide-state',
269-
'starterkit:graphql-plugin',
270-
'nuxt:router',
271-
],
272-
async setup() {},
273-
})
274-
```
275-
276243
## New types in `vuepal.adapter.ts`
277244

278245
The `defineVuepalAdapter` method can now be imported directly from the package.
@@ -384,3 +351,70 @@ You can then access the breadcrumb links either using `useBreadcrumb()` or via
384351
</div>
385352
</template>
386353
```
354+
355+
## Hooking into `useDrupalRoute`
356+
357+
If you want to alter some additional app state whenever `useDrupalRoute` or
358+
`useDrupalRouteQuery` is called, you can do so by hooking into the
359+
`vuepal:drupal-route` hook. This is in fact how the `breadcrumb` and
360+
`languageSwitchLinks` feature also work:
361+
362+
```ts
363+
import type { BreadcrumbFragment } from '#graphql-operations'
364+
import { getBreadcrumbFromRouteQuery } from '#vuepal/helpers/breadcrumb'
365+
366+
/**
367+
* Manages the breadcrumb state.
368+
*/
369+
export default defineNuxtPlugin({
370+
name: 'vuepal:breadcrumb',
371+
setup(app) {
372+
const state = useState<BreadcrumbFragment[]>('breadcrumbLinks', () => [])
373+
374+
// Called by useDrupalRoute.
375+
app.hooks.hook('vuepal:drupal-route', (data) => {
376+
state.value = getBreadcrumbFromRouteQuery(data.routeQuery)
377+
})
378+
},
379+
})
380+
```
381+
382+
The hook is called after every non-error route query.
383+
384+
## Optional (when using blökkli starterkit)
385+
386+
### Removal of the `pluginOrder` module
387+
388+
This module is no longer needed as Nuxt 3 now has a solution to properly order
389+
the plugins.
390+
391+
Before:
392+
393+
```ts [nuxt.config.ts]
394+
pluginOrder: {
395+
order: [
396+
// Match plugins by their file path.
397+
// Note that only a single plugin may match.
398+
// The match is performed as "plugin.src.includes(v.pathMatch)".
399+
{ pathMatch: 'plugins/language.ts' },
400+
{ pathMatch: 'myother/plugin.ts' },
401+
],
402+
logSortedPlugins
403+
:
404+
false,
405+
}
406+
```
407+
408+
After: Use the `dependsOn` feature of Nuxt 3 to define plugin order.
409+
410+
```ts [app/plugins/initData.ts]
411+
export default defineNuxtPlugin({
412+
name: 'starterkit:init-data',
413+
dependsOn: [
414+
'nuxt-graphql-middleware-provide-state',
415+
'starterkit:graphql-plugin',
416+
'nuxt:router',
417+
],
418+
async setup() {},
419+
})
420+
```

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuepal",
3-
"version": "3.0.0-alpha.5",
3+
"version": "3.0.0",
44
"description": "Nuxt+Vue Drupal Integration",
55
"license": "MIT",
66
"homepage": "https://github.com/liip/vuepal",
@@ -51,7 +51,7 @@
5151
"change-case": "^5.4.4",
5252
"fzf": "^0.5.2",
5353
"nuxt-graphql-middleware": "^5.1.0",
54-
"nuxt-language-negotiation": "^2.0.0-alpha.2",
54+
"nuxt-language-negotiation": "^2.0.0",
5555
"yaml": "^2.4.1"
5656
},
5757
"devDependencies": {

0 commit comments

Comments
 (0)