diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8d19b6d..c3daae5 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -38,9 +38,6 @@ jobs:
- run:
name: Lint
command: pnpm run lint
- - run:
- name: Test
- command: pnpm run coverage
- sonarcloud/scan
- slack/notify:
channel: circleci
diff --git a/.gitignore b/.gitignore
index f6273c8..4f6bde1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,3 +58,24 @@ playground/.vercel/
wordpress/files/
playground/schema.graphql
+playground/queries/Menu.gql
+playground/queries/Page.gql
+playground/queries/Pages.gql
+playground/queries/Post.gql
+playground/queries/PostByUri.gql
+playground/queries/Posts.gql
+playground/queries/Revisions.gql
+playground/queries/Settings.gql
+playground/queries/Viewer.gql
+playground/queries/fragments/ContentNode.fragment.gql
+playground/queries/fragments/CoreGallery.fragment.gql
+playground/queries/fragments/CoreImage.fragment.gql
+playground/queries/fragments/CoreParagraph.fragment.gql
+playground/queries/fragments/CoreQuote.fragment.gql
+playground/queries/fragments/EditorBlock.fragment.gql
+playground/queries/fragments/MediaItem.fragment.gql
+playground/queries/fragments/NodeWithExcerpt.fragment.gql
+playground/queries/fragments/NodeWithFeaturedImage.fragment.gql
+playground/queries/fragments/NodeWithFeaturedImageToMediaItemConnectionEdge.fragment.gql
+playground/queries/fragments/Page.fragment.gql
+playground/queries/fragments/Post.fragment.gql
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b8026da..ba6abd0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,10 @@
# Changelog
+## v0.1.30
+
+[compare changes](https://github.com/vernaillen/wpnuxt-module/compare/v0.1.29...v0.1.30)
+
## v0.1.29
[compare changes](https://github.com/vernaillen/wpnuxt-module/compare/v0.1.28...v0.1.29)
diff --git a/examples/custom-posttypes/.gitignore b/examples/custom-posttypes/.gitignore
new file mode 100644
index 0000000..4a7f73a
--- /dev/null
+++ b/examples/custom-posttypes/.gitignore
@@ -0,0 +1,24 @@
+# Nuxt dev/build outputs
+.output
+.data
+.nuxt
+.nitro
+.cache
+dist
+
+# Node dependencies
+node_modules
+
+# Logs
+logs
+*.log
+
+# Misc
+.DS_Store
+.fleet
+.idea
+
+# Local env files
+.env
+.env.*
+!.env.example
diff --git a/examples/custom-posttypes/README.md b/examples/custom-posttypes/README.md
new file mode 100644
index 0000000..f5db2a2
--- /dev/null
+++ b/examples/custom-posttypes/README.md
@@ -0,0 +1,75 @@
+# Nuxt 3 Minimal Starter
+
+Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
+
+## Setup
+
+Make sure to install the dependencies:
+
+```bash
+# npm
+npm install
+
+# pnpm
+pnpm install
+
+# yarn
+yarn install
+
+# bun
+bun install
+```
+
+## Development Server
+
+Start the development server on `http://localhost:3000`:
+
+```bash
+# npm
+npm run dev
+
+# pnpm
+pnpm run dev
+
+# yarn
+yarn dev
+
+# bun
+bun run dev
+```
+
+## Production
+
+Build the application for production:
+
+```bash
+# npm
+npm run build
+
+# pnpm
+pnpm run build
+
+# yarn
+yarn build
+
+# bun
+bun run build
+```
+
+Locally preview production build:
+
+```bash
+# npm
+npm run preview
+
+# pnpm
+pnpm run preview
+
+# yarn
+yarn preview
+
+# bun
+bun run preview
+```
+
+Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
diff --git a/examples/custom-posttypes/app.vue b/examples/custom-posttypes/app.vue
new file mode 100644
index 0000000..a495b75
--- /dev/null
+++ b/examples/custom-posttypes/app.vue
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/examples/custom-posttypes/nuxt.config.ts b/examples/custom-posttypes/nuxt.config.ts
new file mode 100644
index 0000000..8851e77
--- /dev/null
+++ b/examples/custom-posttypes/nuxt.config.ts
@@ -0,0 +1,4 @@
+// https://nuxt.com/docs/api/configuration/nuxt-config
+export default defineNuxtConfig({
+ devtools: { enabled: true }
+})
diff --git a/examples/custom-posttypes/package.json b/examples/custom-posttypes/package.json
new file mode 100644
index 0000000..7d743a1
--- /dev/null
+++ b/examples/custom-posttypes/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "nuxt-app",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "build": "nuxt build",
+ "dev": "nuxt dev",
+ "generate": "nuxt generate",
+ "preview": "nuxt preview",
+ "postinstall": "nuxt prepare"
+ },
+ "dependencies": {
+ "nuxt": "^3.10.3",
+ "vue": "^3.4.19",
+ "vue-router": "^4.3.0"
+ }
+}
diff --git a/examples/custom-posttypes/public/favicon.ico b/examples/custom-posttypes/public/favicon.ico
new file mode 100644
index 0000000..18993ad
Binary files /dev/null and b/examples/custom-posttypes/public/favicon.ico differ
diff --git a/examples/custom-posttypes/server/tsconfig.json b/examples/custom-posttypes/server/tsconfig.json
new file mode 100644
index 0000000..b9ed69c
--- /dev/null
+++ b/examples/custom-posttypes/server/tsconfig.json
@@ -0,0 +1,3 @@
+{
+ "extends": "../.nuxt/tsconfig.server.json"
+}
diff --git a/examples/custom-posttypes/tsconfig.json b/examples/custom-posttypes/tsconfig.json
new file mode 100644
index 0000000..a746f2a
--- /dev/null
+++ b/examples/custom-posttypes/tsconfig.json
@@ -0,0 +1,4 @@
+{
+ // https://nuxt.com/docs/guide/concepts/typescript
+ "extends": "./.nuxt/tsconfig.json"
+}
diff --git a/examples/yoastseo/.gitignore b/examples/yoastseo/.gitignore
new file mode 100644
index 0000000..4a7f73a
--- /dev/null
+++ b/examples/yoastseo/.gitignore
@@ -0,0 +1,24 @@
+# Nuxt dev/build outputs
+.output
+.data
+.nuxt
+.nitro
+.cache
+dist
+
+# Node dependencies
+node_modules
+
+# Logs
+logs
+*.log
+
+# Misc
+.DS_Store
+.fleet
+.idea
+
+# Local env files
+.env
+.env.*
+!.env.example
diff --git a/examples/yoastseo/README.md b/examples/yoastseo/README.md
new file mode 100644
index 0000000..f5db2a2
--- /dev/null
+++ b/examples/yoastseo/README.md
@@ -0,0 +1,75 @@
+# Nuxt 3 Minimal Starter
+
+Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
+
+## Setup
+
+Make sure to install the dependencies:
+
+```bash
+# npm
+npm install
+
+# pnpm
+pnpm install
+
+# yarn
+yarn install
+
+# bun
+bun install
+```
+
+## Development Server
+
+Start the development server on `http://localhost:3000`:
+
+```bash
+# npm
+npm run dev
+
+# pnpm
+pnpm run dev
+
+# yarn
+yarn dev
+
+# bun
+bun run dev
+```
+
+## Production
+
+Build the application for production:
+
+```bash
+# npm
+npm run build
+
+# pnpm
+pnpm run build
+
+# yarn
+yarn build
+
+# bun
+bun run build
+```
+
+Locally preview production build:
+
+```bash
+# npm
+npm run preview
+
+# pnpm
+pnpm run preview
+
+# yarn
+yarn preview
+
+# bun
+bun run preview
+```
+
+Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
diff --git a/examples/yoastseo/app.vue b/examples/yoastseo/app.vue
new file mode 100644
index 0000000..a495b75
--- /dev/null
+++ b/examples/yoastseo/app.vue
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/examples/yoastseo/extend/queries/fragments/Page.fragment.gql b/examples/yoastseo/extend/queries/fragments/Page.fragment.gql
new file mode 100644
index 0000000..dc505ed
--- /dev/null
+++ b/examples/yoastseo/extend/queries/fragments/Page.fragment.gql
@@ -0,0 +1,31 @@
+#import '~/queries/fragments/ContentNode.fragment.gql';
+#import '~/queries/fragments/CoreGallery.fragment.gql';
+#import '~/queries/fragments/CoreImage.fragment.gql';
+#import '~/queries/fragments/CoreParagraph.fragment.gql';
+#import '~/queries/fragments/CoreQuote.fragment.gql';
+#import '~/queries/fragments/EditorBlock.fragment.gql';
+
+fragment Page on Page {
+ ...ContentNode
+ content
+ isFrontPage
+ isPostsPage
+ isPreview
+ isPrivacyPage
+ isRestricted
+ isRevision
+ title
+ editorBlocks {
+ name
+ ...CoreGallery
+ ...CoreImage
+ ...CoreParagraph
+ ...CoreQuote
+ ...EditorBlock
+ }
+ seo {
+ metaDesc
+ title
+ fullHead
+ }
+}
diff --git a/examples/yoastseo/extend/queries/fragments/Post.fragment.gql b/examples/yoastseo/extend/queries/fragments/Post.fragment.gql
new file mode 100644
index 0000000..6a22f59
--- /dev/null
+++ b/examples/yoastseo/extend/queries/fragments/Post.fragment.gql
@@ -0,0 +1,28 @@
+
+#import '~/queries/fragments/ContentNode.fragment.gql';
+#import '~/queries/fragments/NodeWithFeaturedImage.fragment.gql';
+#import '~/queries/fragments/CoreGallery.fragment.gql';
+#import '~/queries/fragments/CoreImage.fragment.gql';
+#import '~/queries/fragments/CoreParagraph.fragment.gql';
+#import '~/queries/fragments/CoreQuote.fragment.gql';
+#import '~/queries/fragments/EditorBlock.fragment.gql';
+
+fragment Post on Post {
+ ...ContentNode
+ ...NodeWithFeaturedImage
+ content
+ title
+ editorBlocks {
+ name
+ ...CoreGallery
+ ...CoreImage
+ ...CoreParagraph
+ ...CoreQuote
+ ...EditorBlock
+ }
+ seo {
+ metaDesc
+ title
+ fullHead
+ }
+}
diff --git a/examples/yoastseo/extend/wpinstall/script.sh b/examples/yoastseo/extend/wpinstall/script.sh
new file mode 100644
index 0000000..53c502d
--- /dev/null
+++ b/examples/yoastseo/extend/wpinstall/script.sh
@@ -0,0 +1,3 @@
+
+
+# install Yoast SEO plugin & Add WPGraphQL SEO
diff --git a/examples/yoastseo/nuxt.config.ts b/examples/yoastseo/nuxt.config.ts
new file mode 100644
index 0000000..8851e77
--- /dev/null
+++ b/examples/yoastseo/nuxt.config.ts
@@ -0,0 +1,4 @@
+// https://nuxt.com/docs/api/configuration/nuxt-config
+export default defineNuxtConfig({
+ devtools: { enabled: true }
+})
diff --git a/examples/yoastseo/package.json b/examples/yoastseo/package.json
new file mode 100644
index 0000000..7d743a1
--- /dev/null
+++ b/examples/yoastseo/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "nuxt-app",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "build": "nuxt build",
+ "dev": "nuxt dev",
+ "generate": "nuxt generate",
+ "preview": "nuxt preview",
+ "postinstall": "nuxt prepare"
+ },
+ "dependencies": {
+ "nuxt": "^3.10.3",
+ "vue": "^3.4.19",
+ "vue-router": "^4.3.0"
+ }
+}
diff --git a/examples/yoastseo/public/favicon.ico b/examples/yoastseo/public/favicon.ico
new file mode 100644
index 0000000..18993ad
Binary files /dev/null and b/examples/yoastseo/public/favicon.ico differ
diff --git a/examples/yoastseo/server/tsconfig.json b/examples/yoastseo/server/tsconfig.json
new file mode 100644
index 0000000..b9ed69c
--- /dev/null
+++ b/examples/yoastseo/server/tsconfig.json
@@ -0,0 +1,3 @@
+{
+ "extends": "../.nuxt/tsconfig.server.json"
+}
diff --git a/examples/yoastseo/tsconfig.json b/examples/yoastseo/tsconfig.json
new file mode 100644
index 0000000..a746f2a
--- /dev/null
+++ b/examples/yoastseo/tsconfig.json
@@ -0,0 +1,4 @@
+{
+ // https://nuxt.com/docs/guide/concepts/typescript
+ "extends": "./.nuxt/tsconfig.json"
+}
diff --git a/package.json b/package.json
index 82d9201..af3be39 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@vernaillen/wpnuxt",
- "version": "0.1.29",
+ "version": "0.1.30",
"description": "WPNuxt",
"repository": "vernaillen/wpnuxt-module",
"license": "MIT",
diff --git a/playground/nuxt.config.ts b/playground/nuxt.config.ts
index 485b9c8..5ed6cd4 100644
--- a/playground/nuxt.config.ts
+++ b/playground/nuxt.config.ts
@@ -17,7 +17,7 @@ export default defineNuxtConfig({
faustSecretKey: '',
showBlockInfo: false,
debug: false,
- replaceSchema: true
+ replaceSchema: false
},
graphqlMiddleware: {
downloadSchema: true,
diff --git a/playground/pages/[...slug].vue b/playground/pages/[...slug].vue
index d158541..582dfca 100644
--- a/playground/pages/[...slug].vue
+++ b/playground/pages/[...slug].vue
@@ -47,7 +47,10 @@ if (post?.data?.title) {
published:
{{ post.data.date.split('T')[0] }}
-
+
meta:
{{ post.data.seo.metaDesc }}
diff --git a/playground/queries/testyoastseo.gql b/playground/queries/testyoastseo.gql
deleted file mode 100644
index 9d1565e..0000000
--- a/playground/queries/testyoastseo.gql
+++ /dev/null
@@ -1,316 +0,0 @@
-fragment ContentNode on ContentNode {
- # contentType
- contentTypeName
- databaseId
- date
- dateGmt
- desiredSlug
- # editingLockedBy
- enclosure
- # enqueuedScripts
- # enqueuedStylesheets
- guid
- id
- isContentNode
- isPreview
- isRestricted
- isTermNode
- # lastEditedBy
- link
- modified
- modifiedGmt
- previewRevisionDatabaseId
- previewRevisionId
- slug
- status
- # template
- uri
-}
-fragment CoreGallery on CoreGallery {
- ...EditorBlock
- innerBlocks {
- ...CoreImage
- }
-}
-fragment CoreImage on CoreImage {
- ...EditorBlock
- attributes {
- align
- alt
- anchor
- aspectRatio
- borderColor
- caption
- className
- cssClassName
- height
- href
- id
- linkClass
- linkDestination
- linkTarget
- lock
- rel
- scale
- sizeSlug
- src
- style
- title
- url
- width
- }
-}
-fragment CoreParagraph on CoreParagraph {
- ...EditorBlock
- attributes {
- content
- }
-}
-fragment CoreQuote on CoreQuote {
- ...EditorBlock
-}
-fragment EditorBlock on EditorBlock {
- apiVersion
- blockEditorCategoryName
- clientId
- cssClassNames
- isDynamic
- name
- parentClientId
- renderedHtml
-}
-fragment MediaItem on MediaItem {
- altText
- # ancestors
- # author
- authorDatabaseId
- authorId
- caption
- # children
- commentCount
- commentStatus
- # comments
- # contentType
- contentTypeName
- databaseId
- date
- dateGmt
- description
- desiredSlug
- # editingLockedBy
- enclosure
- # enqueuedScripts
- # enqueuedStylesheets
- fileSize
- guid
- id
- isContentNode
- isPreview
- isRestricted
- isTermNode
- # lastEditedBy
- link
- # mediaDetails
- mediaItemId
- mediaItemUrl
- mediaType
- mimeType
- modified
- modifiedGmt
- # parent
- parentDatabaseId
- parentId
- previewRevisionDatabaseId
- previewRevisionId
- sizes
- slug
- sourceUrl
- srcSet
- status
- # template
- title
- uri
-}
-fragment NodeWithExcerpt on NodeWithExcerpt {
- excerpt
- id
-}
-fragment NodeWithFeaturedImage on NodeWithFeaturedImage {
- featuredImage {
- ...NodeWithFeaturedImageToMediaItemConnectionEdge
- }
- featuredImageDatabaseId
- featuredImageId
- id
-}
-fragment NodeWithFeaturedImageToMediaItemConnectionEdge on NodeWithFeaturedImageToMediaItemConnectionEdge {
- cursor
- node {
- ...MediaItem
- }
-}
-fragment Page on Page {
- ...ContentNode
- content
- isFrontPage
- isPostsPage
- isPreview
- isPrivacyPage
- isRestricted
- isRevision
- title
- editorBlocks {
- name
- ...CoreGallery
- ...CoreImage
- ...CoreParagraph
- ...CoreQuote
- ...EditorBlock
- }
-}
-fragment Post on Post {
- ...ContentNode
- ...NodeWithFeaturedImage
- content
- title
- editorBlocks {
- name
- ...CoreGallery
- ...CoreImage
- ...CoreParagraph
- ...CoreQuote
- ...EditorBlock
- }
-}
-
-query Pages($limit: Int = 10) {
- pages(first: $limit) {
- nodes {
- ...Page
- }
- }
-}
-query Posts($limit: Int = 10) {
- posts(first: $limit) {
- nodes {
- ...Post
- ...NodeWithExcerpt
- }
- }
-}
-query LatestPost {
- posts(first: 1) {
- nodes {
- ...Post
- ...NodeWithExcerpt
- }
- }
-}
-query PostByUri($uri: String!) {
- nodeByUri(uri: $uri) {
- ...Page
- ...Post
- }
-}
-query PostById($id: ID!, $asPreview: Boolean = false) {
- post(id: $id, idType: DATABASE_ID, asPreview: $asPreview) {
- ...Post
- }
-}
-query PageById($id: ID!) {
- page(id: $id, idType: DATABASE_ID, asPreview: true) {
- ...Page
- }
-}
-query Settings {
- generalSettings {
- title
- description
- url
- email
- dateFormat
- language
- startOfWeek
- timezone
- timeFormat
- }
-}
-query Menu($name: ID! = "main", $idType: MenuNodeIdTypeEnum! = NAME) {
- menu(id: $name, idType: $idType) {
- id
- name
- menuItems {
- nodes {
- label
- uri
- }
- }
- }
-}
-query Viewer {
- viewer {
- username
- userId
- id
- email
- description
- firstName
- lastName
- locale
- url
- uri
- }
-}
-query Revisions {
- revisions {
- nodes {
- date
- uri
- isPreview
- }
- }
-}
-
-fragment Page on Page {
- ...ContentNode
- content
- isFrontPage
- isPostsPage
- isPreview
- isPrivacyPage
- isRestricted
- isRevision
- title
- editorBlocks {
- name
- ...CoreGallery
- ...CoreImage
- ...CoreParagraph
- ...CoreQuote
- ...EditorBlock
- }
- seo {
- metaDesc
- title
- fullHead
- }
-}
-fragment Post on Post {
- ...ContentNode
- ...NodeWithFeaturedImage
- content
- title
- editorBlocks {
- name
- ...CoreGallery
- ...CoreImage
- ...CoreParagraph
- ...CoreQuote
- ...EditorBlock
- }
- seo {
- metaDesc
- title
- fullHead
- }
-}
diff --git a/sonar-project.properties b/sonar-project.properties
index 582b0e8..d6c34dc 100644
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -1,10 +1,9 @@
sonar.projectKey=wpnuxt-module
sonar.projectName=WPNuxt-module
sonar.organization=vernaillen
-
-sonar.tests=tests
-sonar.test.inclusions=tests/**
-sonar.coverage.exclusions=tests/**
+
+#sonar.tests=tests
+#sonar.test.inclusions=tests/**
+#sonar.coverage.exclusions=tests/**
sonar.javascript.lcov.reportPaths=./coverage/coverage-final.json
-
\ No newline at end of file
diff --git a/src/module.ts b/src/module.ts
index e956fd9..61547a4 100644
--- a/src/module.ts
+++ b/src/module.ts
@@ -135,19 +135,19 @@ export default defineNuxtModule
({
}
})*/
- const userQueryPath = '~/queries/'
+ const queryOutputPath = resolver.resolve(nuxt.options.rootDir + '/queries/')
+
+ const userQueryPath = '~/extend/queries/'
.replace(/^(~~|@@)/, nuxt.options.rootDir)
.replace(/^(~|@)/, nuxt.options.srcDir)
const userQueryPathExists = existsSync(userQueryPath)
- let queryPaths
- if (userQueryPathExists && options.replaceSchema) {
- queryPaths = [ resolver.resolve(userQueryPath + '**/*.gql')]
- } else if (userQueryPathExists && !options.replaceSchema) {
- queryPaths = [ resolver.resolve(userQueryPath + '**/*.gql'), resolver.resolve('./runtime/queries/**/*.gql')]
- } else {
- queryPaths = [ resolver.resolve('./runtime/queries/**/*.gql')]
+
+ fs.cpSync(resolver.resolve('./runtime/queries/'), queryOutputPath, {recursive: true})
+ if (userQueryPathExists) {
+ logger.debug('Extending queries:', userQueryPath)
+ fs.cpSync(resolver.resolve(userQueryPath), queryOutputPath, {recursive: true})
}
- logger.debug('Loading query paths:', queryPaths)
+ logger.debug('Copied merged queries in folder:', queryOutputPath)
await installModule('nuxt-graphql-middleware', {
debug: nuxt.options.runtimeConfig.public.wpNuxt.debug,
@@ -162,11 +162,13 @@ export default defineNuxtModule({
disableOnBuild: false,
schema: {
} as any,
- documents: [resolver.resolve('!./graphql/**/*')],
+ documents: [
+ resolver.resolve('!./graphql/**/*')
+ ],
generates: {
'./graphql/': {
preset: 'client',
- plugins: [],
+ plugins: ['typescript-operations'],
},
},
},
@@ -178,7 +180,7 @@ export default defineNuxtModule({
},
},
outputDocuments: true,
- autoImportPatterns: queryPaths
+ autoImportPatterns: queryOutputPath
})
/*const resolvedMCPath = resolver.resolve('./runtime/app/multiCache.serverOptions')
const templateMC = addTemplate({
diff --git a/src/runtime/components/StagingBanner.vue b/src/runtime/components/StagingBanner.vue
index f8ebe7d..0878c91 100644
--- a/src/runtime/components/StagingBanner.vue
+++ b/src/runtime/components/StagingBanner.vue
@@ -28,7 +28,8 @@ useHead({
diff --git a/src/runtime/queries copy/Settings.gql b/src/runtime/queries copy/Settings.gql
deleted file mode 100644
index dfa3c79..0000000
--- a/src/runtime/queries copy/Settings.gql
+++ /dev/null
@@ -1,7 +0,0 @@
-query Settings {
- generalSettings {
- title
- description
- url
- }
-}
diff --git a/src/runtime/queries copy/fragments/ContentNode.fragment.gql b/src/runtime/queries copy/fragments/ContentNode.fragment.gql
deleted file mode 100644
index fde8127..0000000
--- a/src/runtime/queries copy/fragments/ContentNode.fragment.gql
+++ /dev/null
@@ -1,28 +0,0 @@
-fragment ContentNode on ContentNode {
- # contentType
- contentTypeName
- databaseId
- date
- dateGmt
- desiredSlug
- # editingLockedBy
- enclosure
- # enqueuedScripts
- # enqueuedStylesheets
- guid
- id
- isContentNode
- isPreview
- isRestricted
- isTermNode
- # lastEditedBy
- link
- modified
- modifiedGmt
- previewRevisionDatabaseId
- previewRevisionId
- slug
- status
- # template
- uri
-}
diff --git a/src/runtime/queries copy/fragments/MediaItem.fragment.gql b/src/runtime/queries copy/fragments/MediaItem.fragment.gql
deleted file mode 100644
index 9aa8d76..0000000
--- a/src/runtime/queries copy/fragments/MediaItem.fragment.gql
+++ /dev/null
@@ -1,52 +0,0 @@
-fragment MediaItem on MediaItem {
- altText
- # ancestors
- # author
- authorDatabaseId
- authorId
- caption
- # children
- commentCount
- commentStatus
- # comments
- # contentType
- contentTypeName
- databaseId
- date
- dateGmt
- description
- desiredSlug
- # editingLockedBy
- enclosure
- # enqueuedScripts
- # enqueuedStylesheets
- fileSize
- guid
- id
- isContentNode
- isPreview
- isRestricted
- isTermNode
- # lastEditedBy
- link
- # mediaDetails
- mediaItemId
- mediaItemUrl
- mediaType
- mimeType
- modified
- modifiedGmt
- # parent
- parentDatabaseId
- parentId
- previewRevisionDatabaseId
- previewRevisionId
- sizes
- slug
- sourceUrl
- srcSet
- status
- # template
- title
- uri
-}
\ No newline at end of file
diff --git a/src/runtime/queries copy/menu.gql b/src/runtime/queries copy/menu.gql
deleted file mode 100644
index 3cab12a..0000000
--- a/src/runtime/queries copy/menu.gql
+++ /dev/null
@@ -1,11 +0,0 @@
-query Menu($id: ID! = "dGVybTo0") {
- menu(id: $id) {
- id
- menuItems {
- nodes {
- label
- uri
- }
- }
- }
-}
diff --git a/src/runtime/queries/Menu.gql b/src/runtime/queries/Menu.gql
new file mode 100644
index 0000000..84fb14d
--- /dev/null
+++ b/src/runtime/queries/Menu.gql
@@ -0,0 +1,12 @@
+query Menu($name: ID! = "main", $idType: MenuNodeIdTypeEnum! = NAME) {
+ menu(id: $name, idType: $idType) {
+ id
+ name
+ menuItems {
+ nodes {
+ label
+ uri
+ }
+ }
+ }
+}
diff --git a/src/runtime/queries/Page.gql b/src/runtime/queries/Page.gql
new file mode 100644
index 0000000..751ee7e
--- /dev/null
+++ b/src/runtime/queries/Page.gql
@@ -0,0 +1,7 @@
+#import "~/queries/fragments/Page.fragment.gql"
+
+query PageById($id: ID!) {
+ page(id: $id, idType: DATABASE_ID, asPreview: true) {
+ ...Page
+ }
+}
diff --git a/src/runtime/queries copy/Pages.gql b/src/runtime/queries/Pages.gql
similarity index 100%
rename from src/runtime/queries copy/Pages.gql
rename to src/runtime/queries/Pages.gql
diff --git a/src/runtime/queries copy/PostByUri.gql b/src/runtime/queries/Post.gql
similarity index 57%
rename from src/runtime/queries copy/PostByUri.gql
rename to src/runtime/queries/Post.gql
index de3cb6e..58fa70e 100644
--- a/src/runtime/queries copy/PostByUri.gql
+++ b/src/runtime/queries/Post.gql
@@ -7,3 +7,9 @@ query PostByUri($uri: String!) {
...Post
}
}
+
+query PostById($id: ID!, $asPreview: Boolean = false) {
+ post(id: $id, idType: DATABASE_ID, asPreview: $asPreview) {
+ ...Post
+ }
+}
diff --git a/src/runtime/queries copy/Posts.gql b/src/runtime/queries/Posts.gql
similarity index 69%
rename from src/runtime/queries copy/Posts.gql
rename to src/runtime/queries/Posts.gql
index 2b99e18..21c8e1e 100644
--- a/src/runtime/queries copy/Posts.gql
+++ b/src/runtime/queries/Posts.gql
@@ -9,3 +9,11 @@ query Posts($limit: Int = 10) {
}
}
}
+query LatestPost {
+ posts(first: 1) {
+ nodes {
+ ...Post
+ ...NodeWithExcerpt
+ }
+ }
+}
diff --git a/src/runtime/queries/Revisions.gql b/src/runtime/queries/Revisions.gql
new file mode 100644
index 0000000..89c3c68
--- /dev/null
+++ b/src/runtime/queries/Revisions.gql
@@ -0,0 +1,9 @@
+query Revisions {
+ revisions {
+ nodes {
+ date
+ uri
+ isPreview
+ }
+ }
+}
diff --git a/src/runtime/queries/Settings.gql b/src/runtime/queries/Settings.gql
new file mode 100644
index 0000000..dd2d192
--- /dev/null
+++ b/src/runtime/queries/Settings.gql
@@ -0,0 +1,13 @@
+query Settings {
+ generalSettings {
+ title
+ description
+ url
+ email
+ dateFormat
+ language
+ startOfWeek
+ timezone
+ timeFormat
+ }
+}
diff --git a/src/runtime/queries/Viewer.gql b/src/runtime/queries/Viewer.gql
new file mode 100644
index 0000000..5979efb
--- /dev/null
+++ b/src/runtime/queries/Viewer.gql
@@ -0,0 +1,14 @@
+query Viewer {
+ viewer {
+ username
+ userId
+ id
+ email
+ description
+ firstName
+ lastName
+ locale
+ url
+ uri
+ }
+}
diff --git a/src/runtime/queries/fragments/ContentNode.fragment.gql b/src/runtime/queries/fragments/ContentNode.fragment.gql
new file mode 100644
index 0000000..2c267c8
--- /dev/null
+++ b/src/runtime/queries/fragments/ContentNode.fragment.gql
@@ -0,0 +1,28 @@
+fragment ContentNode on ContentNode {
+ # contentType
+ contentTypeName
+ databaseId
+ date
+ dateGmt
+ desiredSlug
+ # editingLockedBy
+ enclosure
+ # enqueuedScripts
+ # enqueuedStylesheets
+ guid
+ id
+ isContentNode
+ isPreview
+ isRestricted
+ isTermNode
+ # lastEditedBy
+ link
+ modified
+ modifiedGmt
+ previewRevisionDatabaseId
+ previewRevisionId
+ slug
+ status
+ # template
+ uri
+}
diff --git a/src/runtime/queries copy/fragments/CoreGallery.fragment.gql b/src/runtime/queries/fragments/CoreGallery.fragment.gql
similarity index 100%
rename from src/runtime/queries copy/fragments/CoreGallery.fragment.gql
rename to src/runtime/queries/fragments/CoreGallery.fragment.gql
diff --git a/src/runtime/queries copy/fragments/CoreImage.fragment.gql b/src/runtime/queries/fragments/CoreImage.fragment.gql
similarity index 100%
rename from src/runtime/queries copy/fragments/CoreImage.fragment.gql
rename to src/runtime/queries/fragments/CoreImage.fragment.gql
diff --git a/src/runtime/queries copy/fragments/CoreParagraph.fragment.gql b/src/runtime/queries/fragments/CoreParagraph.fragment.gql
similarity index 100%
rename from src/runtime/queries copy/fragments/CoreParagraph.fragment.gql
rename to src/runtime/queries/fragments/CoreParagraph.fragment.gql
diff --git a/src/runtime/queries copy/fragments/CoreQuote.fragment.gql b/src/runtime/queries/fragments/CoreQuote.fragment.gql
similarity index 100%
rename from src/runtime/queries copy/fragments/CoreQuote.fragment.gql
rename to src/runtime/queries/fragments/CoreQuote.fragment.gql
diff --git a/src/runtime/queries copy/fragments/EditorBlock.fragment.gql b/src/runtime/queries/fragments/EditorBlock.fragment.gql
similarity index 92%
rename from src/runtime/queries copy/fragments/EditorBlock.fragment.gql
rename to src/runtime/queries/fragments/EditorBlock.fragment.gql
index 2e32a36..faf9ec7 100644
--- a/src/runtime/queries copy/fragments/EditorBlock.fragment.gql
+++ b/src/runtime/queries/fragments/EditorBlock.fragment.gql
@@ -1,5 +1,4 @@
fragment EditorBlock on EditorBlock {
- attributes
apiVersion
blockEditorCategoryName
clientId
diff --git a/src/runtime/queries/fragments/MediaItem.fragment.gql b/src/runtime/queries/fragments/MediaItem.fragment.gql
new file mode 100644
index 0000000..7af677d
--- /dev/null
+++ b/src/runtime/queries/fragments/MediaItem.fragment.gql
@@ -0,0 +1,52 @@
+fragment MediaItem on MediaItem {
+ altText
+ # ancestors
+ # author
+ authorDatabaseId
+ authorId
+ caption
+ # children
+ commentCount
+ commentStatus
+ # comments
+ # contentType
+ contentTypeName
+ databaseId
+ date
+ dateGmt
+ description
+ desiredSlug
+ # editingLockedBy
+ enclosure
+ # enqueuedScripts
+ # enqueuedStylesheets
+ fileSize
+ guid
+ id
+ isContentNode
+ isPreview
+ isRestricted
+ isTermNode
+ # lastEditedBy
+ link
+ # mediaDetails
+ mediaItemId
+ mediaItemUrl
+ mediaType
+ mimeType
+ modified
+ modifiedGmt
+ # parent
+ parentDatabaseId
+ parentId
+ previewRevisionDatabaseId
+ previewRevisionId
+ sizes
+ slug
+ sourceUrl
+ srcSet
+ status
+ # template
+ title
+ uri
+}
diff --git a/src/runtime/queries copy/fragments/NodeWithExcerpt.fragment.gql b/src/runtime/queries/fragments/NodeWithExcerpt.fragment.gql
similarity index 69%
rename from src/runtime/queries copy/fragments/NodeWithExcerpt.fragment.gql
rename to src/runtime/queries/fragments/NodeWithExcerpt.fragment.gql
index 89848c8..9b444aa 100644
--- a/src/runtime/queries copy/fragments/NodeWithExcerpt.fragment.gql
+++ b/src/runtime/queries/fragments/NodeWithExcerpt.fragment.gql
@@ -1,4 +1,4 @@
fragment NodeWithExcerpt on NodeWithExcerpt {
- excerpt
- id
-}
\ No newline at end of file
+ excerpt
+ id
+}
diff --git a/src/runtime/queries copy/fragments/NodeWithFeaturedImage.fragment.gql b/src/runtime/queries/fragments/NodeWithFeaturedImage.fragment.gql
similarity index 92%
rename from src/runtime/queries copy/fragments/NodeWithFeaturedImage.fragment.gql
rename to src/runtime/queries/fragments/NodeWithFeaturedImage.fragment.gql
index 8ea460d..0b776fb 100644
--- a/src/runtime/queries copy/fragments/NodeWithFeaturedImage.fragment.gql
+++ b/src/runtime/queries/fragments/NodeWithFeaturedImage.fragment.gql
@@ -1,10 +1,10 @@
#import '~/queries/fragments/NodeWithFeaturedImageToMediaItemConnectionEdge.fragment.gql';
fragment NodeWithFeaturedImage on NodeWithFeaturedImage {
- featuredImage {
+ featuredImage {
...NodeWithFeaturedImageToMediaItemConnectionEdge
}
featuredImageDatabaseId
featuredImageId
id
-}
\ No newline at end of file
+}
diff --git a/src/runtime/queries copy/fragments/NodeWithFeaturedImageToMediaItemConnectionEdge.fragment.gql b/src/runtime/queries/fragments/NodeWithFeaturedImageToMediaItemConnectionEdge.fragment.gql
similarity index 100%
rename from src/runtime/queries copy/fragments/NodeWithFeaturedImageToMediaItemConnectionEdge.fragment.gql
rename to src/runtime/queries/fragments/NodeWithFeaturedImageToMediaItemConnectionEdge.fragment.gql
diff --git a/src/runtime/queries copy/fragments/Page.fragment.gql b/src/runtime/queries/fragments/Page.fragment.gql
similarity index 100%
rename from src/runtime/queries copy/fragments/Page.fragment.gql
rename to src/runtime/queries/fragments/Page.fragment.gql
diff --git a/src/runtime/queries copy/fragments/Post.fragment.gql b/src/runtime/queries/fragments/Post.fragment.gql
similarity index 99%
rename from src/runtime/queries copy/fragments/Post.fragment.gql
rename to src/runtime/queries/fragments/Post.fragment.gql
index 01e3527..fc15944 100644
--- a/src/runtime/queries copy/fragments/Post.fragment.gql
+++ b/src/runtime/queries/fragments/Post.fragment.gql
@@ -1,4 +1,3 @@
-
#import '~/queries/fragments/ContentNode.fragment.gql';
#import '~/queries/fragments/NodeWithFeaturedImage.fragment.gql';
#import '~/queries/fragments/CoreGallery.fragment.gql';
diff --git a/src/runtime/queries/wp.gql b/src/runtime/queries/wp.gql
deleted file mode 100644
index 75f3935..0000000
--- a/src/runtime/queries/wp.gql
+++ /dev/null
@@ -1,272 +0,0 @@
-fragment ContentNode on ContentNode {
- # contentType
- contentTypeName
- databaseId
- date
- dateGmt
- desiredSlug
- # editingLockedBy
- enclosure
- # enqueuedScripts
- # enqueuedStylesheets
- guid
- id
- isContentNode
- isPreview
- isRestricted
- isTermNode
- # lastEditedBy
- link
- modified
- modifiedGmt
- previewRevisionDatabaseId
- previewRevisionId
- slug
- status
- # template
- uri
-}
-fragment CoreGallery on CoreGallery {
- ...EditorBlock
- innerBlocks {
- ...CoreImage
- }
-}
-fragment CoreImage on CoreImage {
- ...EditorBlock
- attributes {
- align
- alt
- anchor
- aspectRatio
- borderColor
- caption
- className
- cssClassName
- height
- href
- id
- linkClass
- linkDestination
- linkTarget
- lock
- rel
- scale
- sizeSlug
- src
- style
- title
- url
- width
- }
-}
-fragment CoreParagraph on CoreParagraph {
- ...EditorBlock
- attributes {
- content
- }
-}
-fragment CoreQuote on CoreQuote {
- ...EditorBlock
-}
-fragment EditorBlock on EditorBlock {
- apiVersion
- blockEditorCategoryName
- clientId
- cssClassNames
- isDynamic
- name
- parentClientId
- renderedHtml
-}
-fragment MediaItem on MediaItem {
- altText
- # ancestors
- # author
- authorDatabaseId
- authorId
- caption
- # children
- commentCount
- commentStatus
- # comments
- # contentType
- contentTypeName
- databaseId
- date
- dateGmt
- description
- desiredSlug
- # editingLockedBy
- enclosure
- # enqueuedScripts
- # enqueuedStylesheets
- fileSize
- guid
- id
- isContentNode
- isPreview
- isRestricted
- isTermNode
- # lastEditedBy
- link
- # mediaDetails
- mediaItemId
- mediaItemUrl
- mediaType
- mimeType
- modified
- modifiedGmt
- # parent
- parentDatabaseId
- parentId
- previewRevisionDatabaseId
- previewRevisionId
- sizes
- slug
- sourceUrl
- srcSet
- status
- # template
- title
- uri
-}
-fragment NodeWithExcerpt on NodeWithExcerpt {
- excerpt
- id
-}
-fragment NodeWithFeaturedImage on NodeWithFeaturedImage {
- featuredImage {
- ...NodeWithFeaturedImageToMediaItemConnectionEdge
- }
- featuredImageDatabaseId
- featuredImageId
- id
-}
-fragment NodeWithFeaturedImageToMediaItemConnectionEdge on NodeWithFeaturedImageToMediaItemConnectionEdge {
- cursor
- node {
- ...MediaItem
- }
-}
-fragment Page on Page {
- ...ContentNode
- content
- isFrontPage
- isPostsPage
- isPreview
- isPrivacyPage
- isRestricted
- isRevision
- title
- editorBlocks {
- name
- ...CoreGallery
- ...CoreImage
- ...CoreParagraph
- ...CoreQuote
- ...EditorBlock
- }
-}
-fragment Post on Post {
- ...ContentNode
- ...NodeWithFeaturedImage
- content
- title
- editorBlocks {
- name
- ...CoreGallery
- ...CoreImage
- ...CoreParagraph
- ...CoreQuote
- ...EditorBlock
- }
-}
-
-query Pages($limit: Int = 10) {
- pages(first: $limit) {
- nodes {
- ...Page
- }
- }
-}
-query Posts($limit: Int = 10) {
- posts(first: $limit) {
- nodes {
- ...Post
- ...NodeWithExcerpt
- }
- }
-}
-query LatestPost {
- posts(first: 1) {
- nodes {
- ...Post
- ...NodeWithExcerpt
- }
- }
-}
-query PostByUri($uri: String!) {
- nodeByUri(uri: $uri) {
- ...Page
- ...Post
- }
-}
-query PostById($id: ID!, $asPreview: Boolean = false) {
- post(id: $id, idType: DATABASE_ID, asPreview: $asPreview) {
- ...Post
- }
-}
-query PageById($id: ID!) {
- page(id: $id, idType: DATABASE_ID, asPreview: true) {
- ...Page
- }
-}
-query Settings {
- generalSettings {
- title
- description
- url
- email
- dateFormat
- language
- startOfWeek
- timezone
- timeFormat
- }
-}
-query Menu($name: ID! = "main", $idType: MenuNodeIdTypeEnum! = NAME) {
- menu(id: $name, idType: $idType) {
- id
- name
- menuItems {
- nodes {
- label
- uri
- }
- }
- }
-}
-query Viewer {
- viewer {
- username
- userId
- id
- email
- description
- firstName
- lastName
- locale
- url
- uri
- }
-}
-query Revisions {
- revisions {
- nodes {
- date
- uri
- isPreview
- }
- }
-}
diff --git a/tests/basic.test.ts b/tests/basic.test.ts
deleted file mode 100644
index 954dd3b..0000000
--- a/tests/basic.test.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { describe, it, expect } from 'vitest'
-import { fileURLToPath } from 'node:url'
-import { setup, $fetch } from '@nuxt/test-utils'
-
-describe('ssr', async () => {
- await setup({
- rootDir: fileURLToPath(new URL('../playground', import.meta.url))
- })
-
- it('renders the index page', async () => {
- // Get response to a server-rendered page with `$fetch`.
- const html = await $fetch('/')
- expect(html).toContain('
WPNuxt Demo')
- })
-})