Skip to content

Commit

Permalink
docs: add migration guide
Browse files Browse the repository at this point in the history
  • Loading branch information
mercs600 committed Sep 13, 2022
1 parent 9a05b08 commit 04c6409
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
{
title: 'General Information',
collapsable: false,
children: ['/', 'getting-started']
children: ['/', 'getting-started', 'migration']
},
{
title: 'From scratch',
Expand Down
13 changes: 9 additions & 4 deletions docs/frontend/content-elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To avoids conflicts with other UI libraries or your design system we use `T3` pr
For instance new content elements should be named `T3CeMycontentelement`.


We use `T3` prefix because some of our global components are not ContentElement e.g. `T3NavLink`
We use `T3` prefix because some of our global components are not ContentElements e.g. `T3NavLink`


You don't have name your content elements component file this way, but this is imporant when you register them as global (look below).
Expand Down Expand Up @@ -61,7 +61,7 @@ We assume our API deliver new content element - with type "keyvisual".

1. to create new content element, you can use [base content element](https://github.com/TYPO3-Initiatives/nuxt-typo3/tree/master/lib/mixins/component/baseCe.js) mixin to inherit all common props.

`components/CeKeyvisual.vue`:
`components/T3CeKeyvisual.vue`:

```html
<template>
Expand All @@ -72,7 +72,7 @@ We assume our API deliver new content element - with type "keyvisual".
<script>
import baseCe from '~typo3/mixins/component/baseCe.js'
export default {
name: 'CeKeyvisual',
name: 'T3CeKeyvisual',
extends: baseCe, // here is defined header prop
props: {
// lead should be delivered by API
Expand All @@ -91,7 +91,7 @@ export default {

```js
import Vue from 'vue'
import CeKeyvisual from '~/components/CeKeyvisual'
import CeKeyvisual from '~/components/T3CeKeyvisual'

Vue.component('T3CeKeyvisual', CeKeyVisual)
```
Expand All @@ -104,3 +104,8 @@ export default {
}
```

## Autoimports

We support Nuxt [auto-imports](https://nuxtjs.org/docs/features/component-discovery#enabling-auto-discovery).

If you have enabled [this options](https://nuxtjs.org/docs/configuration-glossary/configuration-components/) you can skip points (2, 3) above.
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ npm install nuxt-typo3

## Configuration

Add the `typo3` object to your `nuxt.config.js` to configure all required settings. Read more about configuration [here](https://typo3-initiatives.github.io/nuxt-typo3/configuration/i18n.html).
Add the `typo3` object to your `nuxt.config.js` to configure all required settings. Read more about configuration [here](https://github.com/TYPO3-Headless/nuxt-typo3/blob/master/lib/options.js).

```js
{
Expand Down
87 changes: 87 additions & 0 deletions docs/migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Migration from 0.9.x to 1.0.0

We reactored some part of frontend app due to changes of Headless extension v3.x and change requests from community.

During migration you may encounter following errors:
### Errors with component imports:
All `nuxt-typo3` components have `T3` Prefix. Content elements have `T3Ce`

```jsx
These dependencies were not found: friendly-errors 15:22:42
friendly-errors 15:22:42
* ~typo3/components/content/elements/CeImage in ../node_modules/babel-loader/lib??ref--2-0!../node_modules/vue-loader/lib??vue-loader-options!./components/Component.vue?vue&type=script&lang=js&
```
replace
```jsx
import CeImage from '~typo3/components/content/elements/CeImage'
```
to
```jsx
import T3CeImage from '~typo3/components/T3CeImage'
```
Component name doesn't have underscore, please use camelCase
### pages/_.vue
Component responsible for backend layout rendering use `T3Dynamic` (for dynamic content elements and backend layouts)
replace
```html
<be-dynamic
:page="page.page"
:content="page.content"
:type="backendLayout"
/>
```
with
```html
<t3-dynamic
:data="t3page.content"
:type="t3page.appearance.backendLayout"
layout
/>
```

### layouts/backend/BeDefault.vue:

replace

```jsx
<ce-renderer :content="content.colPos0" />
```

with

```jsx
<t3-renderer :content="content.colPos0" />
```

### AsyncData

With 0.9.x version you could receive `page` object from asyncData, now it use `t3` prefix - `t3page`


### Store

Vuex store are namespaced now

replace
```js
store.dispatch('getInitialData')
```

with

```js
store.dispatch('typo3/getInitialData')
```

If you have found another issue please create an issue on github

0 comments on commit 04c6409

Please sign in to comment.