Skip to content

Commit

Permalink
added wp-env + 4 compont test pages, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
vernaillen committed Aug 14, 2024
1 parent c53fcca commit 94e6194
Show file tree
Hide file tree
Showing 38 changed files with 5,729 additions and 7,627 deletions.
20 changes: 20 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"core": "WordPress/WordPress#6.6.1",
"plugins": [
"https://github.com/wpnuxt/wpnuxt-plugin/releases/download/v0.0.2/wpnuxt-plugin.zip",
"https://downloads.wordpress.org/plugin/faustwp.zip",
"https://github.com/wpengine/wp-graphql-content-blocks/releases/download/v4.0.1/wp-graphql-content-blocks.zip",
"https://downloads.wordpress.org/plugin/wp-graphql.zip"
],
"port": 4000,
"config": {
"FRONTEND_URI": "http://localhost:3000"
},
"mappings": {
"wp-cli.yml": "./wordpress/wp-env-apache-modules.yml",
"demo-content": "./wordpress/demo-content"
},
"lifecycleScripts": {
"afterStart": "wp-env run cli wp rewrite structure /%postname%/ --hard"
}
}
1 change: 1 addition & 0 deletions docs/2.getting-started/2.configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file.
47 changes: 47 additions & 0 deletions docs/3.blocks/core-button.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: CoreButton
---

## attributes

```
anchor?: string;
backgroundColor?: string;
cssClassName?: string;
fontFamily?: string;
fontSize?: string;
gradient?: string;
style?: string;
text?: string;
textAlign?: string;
textColor?: string;
linkTarget?: string;
rel?: string;
url?: string;
linkClassName?: string;
```

## default component

```vue
<script setup lang="ts">
import type { CoreButton } from '#wpnuxt/blocks'
defineProps<{
block: CoreButton
}>()
</script>
<template>
<UButton
:to="block.attributes.url"
:target="block.attributes.linkTarget"
:class="block.attributes.cssClassName"
:rel="block.attributes.rel"
:style="block.attributes.style"
>
<span v-sanitize="block.attributes.text" />
</UButton>
</template>
```
30 changes: 30 additions & 0 deletions docs/3.blocks/core-buttons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: CoreButtons
---

```vue
<script setup lang="ts">
import type { CoreButtons, EditorBlock } from '#wpnuxt/blocks'
defineProps<{
block: CoreButtons
}>()
</script>
<template>
<div
v-for="innerBlock, index in block.innerBlocks"
:key="index"
>
<CoreButton
v-if="innerBlock.name === 'core/button'"
:block="innerBlock"
/>
<EditorBlock
v-else
:block="innerBlock"
/>
</div>
</template>
```
3 changes: 3 additions & 0 deletions docs/3.blocks/core-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: CoreCode
---
3 changes: 3 additions & 0 deletions docs/3.blocks/core-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: CoreColumn
---
3 changes: 3 additions & 0 deletions docs/3.blocks/core-columns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: CoreColumns
---
3 changes: 3 additions & 0 deletions docs/3.blocks/core-heading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: CoreHeading
---
3 changes: 3 additions & 0 deletions docs/3.blocks/core-image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: CoreImage
---
3 changes: 3 additions & 0 deletions docs/3.blocks/core-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: CoreList
---
3 changes: 3 additions & 0 deletions docs/3.blocks/core-paragraph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: CoreParagraph
---
3 changes: 3 additions & 0 deletions docs/3.blocks/core-quote.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: CoreQuote
---
3 changes: 3 additions & 0 deletions docs/3.blocks/core-separator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: CoreSeparator
---
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
"lint:fix": "eslint . --fix",
"test": "vitest run",
"test:watch": "vitest watch",
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
"wp-env": "wp-env",
"wp-env:create": "wp-env start --update && ./wordpress/wp-env-cli.sh",
"start": "pnpm run wp-env:create && pnpm run dev"
},
"dependencies": {
"@nuxt/image": "^1.7.0",
Expand All @@ -42,10 +45,11 @@
"devDependencies": {
"@nuxt/devtools": "^1.3.9",
"@nuxt/eslint-config": "^0.5.0",
"@nuxt/module-builder": "^0.8.1",
"@nuxt/module-builder": "^0.8.3",
"@nuxt/schema": "^3.12.4",
"@nuxt/test-utils": "^3.13.1",
"@types/node": "^22.2.0",
"@nuxt/test-utils": "^3.14.1",
"@types/node": "^22.3.0",
"@wordpress/env": "^10.5.0",
"changelogen": "^0.5.5",
"eslint": "^9.9.0",
"nuxt": "^3.12.4",
Expand Down
9 changes: 9 additions & 0 deletions playground/.env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
NUXT_IMAGE_PROVIDER='ipx'

WPNUXT_WORDPRESS_URL=http://localhost:4000
WPNUXT_FRONTEND_URL=http://localhost:3000
WPNUXT_FAUST_SECRET_KEY=yourKey

WPNUXT_LOG_LEVEL=4
WPNUXT_ENABLE_CACHE=true
WPNUXT_STAGING=true
6 changes: 4 additions & 2 deletions playground/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export default defineAppConfig({
ui: {
variables: {

primary: 'reefgold',
gray: 'neutral',
button: {
base: 'mb-1 mr-1'
}
}
})
1 change: 0 additions & 1 deletion playground/app/app.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div>
<NuxtPage />
<StagingBanner />
</div>
</template>
17 changes: 1 addition & 16 deletions playground/app/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
<script setup lang="ts">
const { data: pages } = await useWPPages()
const { data: posts } = await useWPPosts()
</script>

<template>
<div>
<header class="prose max-w-5xl mx-auto p-5">
Pages:
<span
v-for="page, index in pages"
:key="index"
>
<NuxtLink
v-if="page.slug"
:to="'/' + page.slug"
>
{{ page.title }}
</NuxtLink>
<span v-if="index !== pages.length - 1"> - </span>
</span>
<br>
Posts:
Components:
<span
v-for="post, index in posts"
:key="index"
Expand Down
1 change: 1 addition & 0 deletions playground/app/pages/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ definePageMeta({
<template>
<NuxtLayout>
<BlockRenderer :blocks="post?.editorBlocks" />
<StagingBanner />
</NuxtLayout>
</template>
Loading

0 comments on commit 94e6194

Please sign in to comment.