Skip to content

Commit

Permalink
Merge pull request #1546 from wpengine/canary
Browse files Browse the repository at this point in the history
Sync `canary` -> `main`
  • Loading branch information
blakewilson authored Aug 23, 2023
2 parents bbf1d5c + 23f64e6 commit cbd764a
Show file tree
Hide file tree
Showing 101 changed files with 20,376 additions and 9,942 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"access": "public",
"baseBranch": "canary",
"updateInternalDependencies": "patch",
"ignore": ["@faustjs/next-headless-getting-started", "@faustwp/getting-started-example"],
"ignore": ["@faustjs/next-headless-getting-started", "@faustwp/getting-started-example", "@faustwp/app-router-example"],
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
2 changes: 2 additions & 0 deletions .github/actions/run-coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ runs:
# Remove this when the issue has been resolved.
- uses: ArtiomTr/[email protected]
with:
# tell to the action to not attach comment.
output: report-markdown
test-script: npm run test:coverage:ci
working-directory: ${{ inputs.working-directory }}
annotations: none
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/audit-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Audit Dependencies
on: pull_request

jobs:
audit_depedencies:
audit_dependencies:
runs-on: ubuntu-latest

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-test-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install NPM Deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nextjs-bundle-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
pull_request:
push:
branches:
- canary
- 'canary'
workflow_dispatch:

permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/release-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,3 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Possibly deploy WordPress plugin
# Checks the changesets publishedPackages output
# If there is a published package named "@faustwp/wordpress-plugin"
# Then deploy the WordPress plugin
# https://github.com/changesets/action#outputs
if: contains(fromJSON(steps.changesets.outputs.publishedPackages).*.name, '@faustwp/wordpress-plugin')
# Use a variant of 10up/action-wordpress-plugin-deploy that allows us to specify a PLUGIN_DIR
# to support our monorepo structure.
uses: ./.github/actions/release-plugin
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
PLUGIN_DIR: plugins/faustwp
SLUG: faustwp
2 changes: 1 addition & 1 deletion .github/workflows/test-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
wordpress: ['6.2', '6.1']
wordpress: ['6.2', '6.3']
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
5 changes: 5 additions & 0 deletions examples/next/app-router/.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://faustexample.wpengine.com

# Plugin secret found in WordPress Settings->Faust
# FAUST_SECRET_KEY=YOUR_PLUGIN_SECRET
34 changes: 34 additions & 0 deletions examples/next/app-router/app/[postSlug]/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// import { fetchAccessToken } from "@/faust/auth/fetchAccessToken";
// import { getAuthClient, getClient } from "@/faust/client";
// import { isPreviewMode } from "@/faust/previews";
import { getClient } from '@faustwp/experimental-app-router';
import { gql } from '@apollo/client';

export default async function Page(props) {
const postSlug = props.params.postSlug;

// Depending on if isPreview or not use the auth client or regular client
let client = getClient();

const { data } = await client.query({
query: gql`
query GetPost($postSlug: ID!) {
post(id: $postSlug, idType: SLUG) {
title
content
date
}
}
`,
variables: {
postSlug,
},
});

return (
<main>
<h2>{data?.post?.title}</h2>
<div dangerouslySetInnerHTML={{ __html: data?.post?.content ?? '' }} />
</main>
);
}
69 changes: 69 additions & 0 deletions examples/next/app-router/app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { gql } from '@apollo/client';
import { getClient } from '@faustwp/experimental-app-router';
import Link from 'next/link';
/**
* For now, we will manually call the Faust config as we have not yet determined
* how we want to set the config (Currently in Faust we call it in the [wordPressNode] file).
*
* @todo
*/
import '../faust.config.js';

export const metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
};

export default async function RootLayout({ children }) {
const client = getClient();

const { data } = await client.query({
query: gql`
query GetLayout {
generalSettings {
title
description
}
primaryMenuItems: menuItems(where: { location: PRIMARY }) {
nodes {
id
label
uri
}
}
footerMenuItems: menuItems(where: { location: FOOTER }) {
nodes {
id
label
uri
}
}
}
`,
});

return (
<html lang="en">
<body>
<header>
<div>
<h1>
<Link href="/">{data.generalSettings.title}</Link>
</h1>

<h5>{data.generalSettings.description}</h5>
</div>

<ul>
{data.primaryMenuItems.nodes.map((node) => (
<li>
<Link href={node.uri}>{node.label}</Link>
</li>
))}
</ul>
</header>
{children}
</body>
</html>
);
}
35 changes: 35 additions & 0 deletions examples/next/app-router/app/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { getClient } from '@faustwp/experimental-app-router';
import { gql } from '@apollo/client';
import Link from 'next/link';

export default async function Home() {
let client = getClient();

const { data } = await client.query({
query: gql`
query GetPosts {
posts {
nodes {
id
title
uri
slug
}
}
}
`,
});

return (
<main>
<h2>Posts</h2>
<ul>
{data.posts.nodes.map((post) => (
<li>
<Link href={`/${post.slug}`}>{post.title}</Link>
</li>
))}
</ul>
</main>
);
}
7 changes: 7 additions & 0 deletions examples/next/app-router/faust.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { setConfig } from '@faustwp/core/dist/cjs/config/index.js';
import possibleTypes from './possibleTypes.json';

/** @type {import('@faustwp/core').FaustConfig} */
export default setConfig({
possibleTypes,
});
6 changes: 6 additions & 0 deletions examples/next/app-router/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
export default {
experimental: {
appDir: true,
},
};
27 changes: 27 additions & 0 deletions examples/next/app-router/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@faustwp/app-router-example",
"private": true,
"type": "module",
"scripts": {
"dev": "faust dev",
"build": "faust build",
"generate": "faust generatePossibleTypes",
"stylesheet": "faust generateGlobalStylesheet",
"start": "faust start"
},
"dependencies": {
"@apollo/client": "^3.8.0",
"@faustwp/cli": "1.1.1",
"@faustwp/core": "1.1.1",
"@faustwp/experimental-app-router": "^0.0.2",
"@apollo/experimental-nextjs-app-support": "^0.4.1",
"graphql": "^16.7.1",
"next": "^13.4.13",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"engines": {
"node": ">=16",
"npm": ">=8"
}
}
1 change: 1 addition & 0 deletions examples/next/app-router/possibleTypes.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/next/faustwp-getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
},
"dependencies": {
"@apollo/client": "^3.6.6",
"@faustwp/cli": "1.0.1",
"@faustwp/core": "1.0.3",
"@faustwp/cli": "1.1.1",
"@faustwp/core": "1.1.1",
"@wordpress/base-styles": "^4.26.0",
"@wordpress/block-library": "^7.19.0",
"classnames": "^2.3.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/next/getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {
"@faustjs/core": "^0.15.10",
"@faustjs/next": "^0.15.11",
"@faustjs/next": "^0.15.12",
"next": "^12.2.4",
"normalize.css": "^8.0.1",
"react": "^17.0.2",
Expand Down
3 changes: 2 additions & 1 deletion examples/next/getting-started/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": "./src",
"incremental": true
"incremental": true,
"typeRoots": ["node_modules/@types"]
},
"include": [
"next-env.d.ts",
Expand Down
Loading

2 comments on commit cbd764a

@headless-platform-by-wp-engine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the recent updates to your Atlas environment:

App Environment URL Build
faustjs Production https://hh…wered.com ✅ (logs)

Learn more about building on Atlas in our documentation.

@headless-platform-by-wp-engine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the recent updates to your Atlas environment:

App Environment URL Build
faustjs-legacy Production https://h8…wered.com ✅ (logs)

Learn more about building on Atlas in our documentation.

Please sign in to comment.