Skip to content

Commit

Permalink
Revert "Remove legacy code"
Browse files Browse the repository at this point in the history
This reverts commit d1870f3.
  • Loading branch information
josephfusco committed Nov 26, 2024
1 parent d1870f3 commit 2d97b80
Show file tree
Hide file tree
Showing 288 changed files with 52,377 additions and 4 deletions.
5 changes: 5 additions & 0 deletions examples/next/getting-started/.env.local.sample
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
3 changes: 3 additions & 0 deletions examples/next/getting-started/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next"
}
37 changes: 37 additions & 0 deletions examples/next/getting-started/.gitignore
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
16 changes: 16 additions & 0 deletions examples/next/getting-started/README.md
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]()
30 changes: 30 additions & 0 deletions examples/next/getting-started/gqty.config.js
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;
5 changes: 5 additions & 0 deletions examples/next/getting-started/next-env.d.ts
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.
6 changes: 6 additions & 0 deletions examples/next/getting-started/next.config.js
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();
42 changes: 42 additions & 0 deletions examples/next/getting-started/package.json
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 added examples/next/getting-started/public/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions examples/next/getting-started/src/client/index.ts
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';
Loading

0 comments on commit 2d97b80

Please sign in to comment.