-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
288 changed files
with
52,377 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Your WordPress site URL | ||
NEXT_PUBLIC_WORDPRESS_URL=https://headlessfw.wpengine.com | ||
|
||
# Plugin secret found in WordPress Settings->Headless | ||
FAUSTWP_SECRET_KEY=YOUR_PLUGIN_SECRET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# dotenv files | ||
.env | ||
.env.test | ||
.env.production | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# vercel | ||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Next.js Headless WordPress Getting Started Example | ||
|
||
⚠️ TRY THE NEW FAUST: This Example project uses the old version of Faust. We will only be providing ongoing support for critical bugs and vulnerabilities with this version. If you intended to use the new version of Faust, please follow this [getting started guide](https://faustjs.org/docs/getting-started). Read the [following announcement](https://faustjs.org/blog/sprint-22-update) that explains the re-release of Faust.js. | ||
|
||
## Setup | ||
|
||
See the [setup steps](https://github.com/wpengine/faustjs#quick-start). | ||
|
||
## Run it | ||
|
||
```bash | ||
npm install | ||
npm run dev | ||
``` | ||
|
||
[http://localhost:3000]() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require('dotenv-flow').config(); | ||
|
||
/** | ||
* @type {import("@gqty/cli").GQtyConfig} | ||
*/ | ||
const config = { | ||
react: false, | ||
scalarTypes: { DateTime: 'string' }, | ||
introspection: { | ||
endpoint: `${process.env.NEXT_PUBLIC_WORDPRESS_URL}/graphql`, | ||
headers: {}, | ||
}, | ||
destination: './src/client/index.ts', | ||
subscriptions: false, | ||
javascriptOutput: false, | ||
}; | ||
|
||
console.log(`Using "${config.introspection.endpoint}" to generate schema...`); | ||
console.log( | ||
'**********************************************************************', | ||
); | ||
console.log(`* ✨ There is a new version of Faust ✨. * | ||
* If you are still using the this version, and you wish to migrate, * | ||
* take a look at our migration guide at * | ||
* https://faustjs.org/docs/migrationPath/overview *`); | ||
console.log( | ||
'**********************************************************************', | ||
); | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const { withFaust } = require('@faustjs/next'); | ||
|
||
/** | ||
* @type {import('next').NextConfig} | ||
**/ | ||
module.exports = withFaust(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "@faustjs/next-headless-getting-started", | ||
"version": "0.1.0", | ||
"private": true, | ||
"engines": { | ||
"node": ">=14.0.0", | ||
"npm": ">=6.0.0" | ||
}, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"clean": "rimraf .next node_modules", | ||
"lint": "next lint", | ||
"generate": "gqty generate", | ||
"wpe-build": "next build" | ||
}, | ||
"dependencies": { | ||
"@faustjs/core": "^0.15.13", | ||
"@faustjs/next": "^0.16.0", | ||
"next": "^12.3.4", | ||
"normalize.css": "^8.0.1", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"sass": "^1.54.0", | ||
"sharp": "^0.32.6" | ||
}, | ||
"devDependencies": { | ||
"@gqty/cli": "^3.1.0", | ||
"@types/node": "^17.0.17", | ||
"@types/react": "^17.0.34", | ||
"@types/react-dom": "^17.0.11", | ||
"dotenv-flow": "3.2.0", | ||
"eslint": "^8.4.1", | ||
"eslint-config-next": "^12.0.7", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.5.2" | ||
}, | ||
"overrides": { | ||
"postcss": "^8.4.31" | ||
} | ||
} |
Binary file not shown.
Binary file added
BIN
+53.8 KB
examples/next/getting-started/public/images/headless_hero_background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* GQTY: You can safely modify this file and Query Fetcher based on your needs | ||
*/ | ||
import type { IncomingMessage } from 'http'; | ||
import { getClient } from '@faustjs/next'; | ||
import { | ||
generatedSchema, | ||
scalarsEnumsHash, | ||
GeneratedSchema, | ||
SchemaObjectTypes, | ||
SchemaObjectTypesNames, | ||
} from './schema.generated'; | ||
|
||
export const client = getClient< | ||
GeneratedSchema, | ||
SchemaObjectTypesNames, | ||
SchemaObjectTypes | ||
>({ | ||
schema: generatedSchema, | ||
scalarsEnumsHash, | ||
}); | ||
|
||
export function serverClient(req: IncomingMessage) { | ||
return getClient<GeneratedSchema, SchemaObjectTypesNames, SchemaObjectTypes>({ | ||
schema: generatedSchema, | ||
scalarsEnumsHash, | ||
context: req, | ||
}); | ||
} | ||
|
||
export * from './schema.generated'; |
Oops, something went wrong.