Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom queries #133

Merged
merged 27 commits into from
Feb 12, 2021
Merged

Custom queries #133

merged 27 commits into from
Feb 12, 2021

Conversation

wjohnsto
Copy link
Contributor

@wjohnsto wjohnsto commented Feb 10, 2021

Okay, it was not my intent for this to be a big PR, but here it goes:

  1. BH-850 DONE

  2. BH-852 DONE

  3. Queries to get Posts and a Content Node can be customized using fragments and variables

    • This customization can occur with calls to the hooks, services, or during getServerSideProps or getStaticProps
    • There is a doc now that explains how queries work
  4. All Next-specific functionality is extracted into a /packages/headless/src/next directory

    • You can import it as import ... from '@wpengine/headless/next';
  5. All React-specific (non-Next) functionality is extracted into a /packages/headless/src/react directory

    • You can import it as import ... from '@wpengine/headless/react';
  6. There is now a generic React TemplateLoader that will work outside of Next. There is also a NextTemplateLoader that allows Templates to specify getStaticProps and getServerSideProps

  7. Theme components should now export getServerSideProps and getStaticProps methods if they want to make extra server-side requests (@see /examples/getting-started/wp-templates/single)

    • Either getServerSideProps or getStaticProps will be called depending upon whether the app is using getServerSideProps or getStaticProps
  8. Custom queries can be made directly within getServerSideProps or getStaticProps of pages and theme components as follows:

    import { getApolloClient } from '@wpengine/headless';
    import { gql } from '@apollo/client';
    import { GetStaticPropsContext } from 'next';
    
    // ...
    
    export async function getStaticProps(context: GetStaticPropsContext) {
      const client = getApolloClient(context);
      client.query({
            query: gql`...`
      });
     
      return getNextStaticProps(context);
    }
    • These queries, if made prior to calling getNextStaticProps or getNextServerSideProps, will be cached and available client-side
  9. There is a generic authorizeHandler middleware function that only authorizes a user and sets a cookie. in @wpengine/headless/next there is a previewHandler that will set preview data and call on the authorizeHandler

BREAKING CHANGES:

  1. initializeNextStaticProps is now getNextStaticProps and is in @wpengine/headless/next
  2. initializeNextServerSideProps is now getNextServerSideProps and is in @wpengine/headless/next
  3. getPropsMiddleware on Templates is now replaced by getStaticProps and getServerSideProps
    • The function signature for the new functions is the same as the Next.js variants, so you have access to context only (you can import and call for other things you might need)
  4. usePosts now returns a WPGraphQL.RootQueryToPostConnection, so the list of posts will be found on the nodes or edges properties
  5. All Next.js functions are in @wpengine/headless/next and not exported from @wpengine/headless. This includes:
    • NextTemplateLoader
    • WPHead
    • getNextServerSideProps
    • getNextStaticPaths
    • getNextStaticProps
    • previewHandler
    • usePost (the Next-specific variant)
    • useUriInfo (the Next-specific variant)
  6. All non-Next React functions are in @wpengine/headless/react and not exported from @wpengine/headless. This includes:
    • HeadlessContext
    • HeadlessProvider
    • Menu
    • MenuList
    • TemplateLoader
    • useApollo
    • useGeneralSettings
    • usePost
    • usePosts
    • useUriInfo
  7. The following objects are no longer exported from core:
    • gql (can be imported from @apollo/client)
    • useQuery (can be imported from @apollo/client)
    • useMutation (can be imported from @apollo/client)

@wjohnsto wjohnsto requested review from a team as code owners February 10, 2021 15:16
@mindctrl
Copy link
Contributor

@wjohnsto woot! Glad to see the ability to customize queries. There's a pretty big merge conflict here now. Can you fix that up before we get too deep in reviewing?

@nickcernis
Copy link
Member

@wjohnsto Thank you for your work on this.

Can you help me to better understand how passing variables to adjust a query should work, please?

I read the docs and amended packages/headless/src/next/serverSide.ts like this:

  if (pageInfo.isPostsPage) {
    await getPosts(client, options.posts);
  }

+  if (pageInfo.isArchive) {
+    await getPosts(client, {
+      variables: {
+        where: { categoryName: 'uncategorized' }, // Hard-coding the category name for now.
+      },
+    });
+  }

I expected to see posts from the uncategorized category (default for WP posts) at http://localhost:3000/category/uncategorized. Instead I see no posts. GraphiQL in Chrome shows no categoryName variable was passed to getPosts.

@mindctrl
Copy link
Contributor

I did the same as Nick, but I get different results. At first the category page is empty, and about 3 seconds later all posts are rendered instead of the ones related to the category I requested. 🤷

@wjohnsto
Copy link
Contributor Author

@wjohnsto Thank you for your work on this.

Can you help me to better understand how passing variables to adjust a query should work, please?

I read the docs and amended packages/headless/src/next/serverSide.ts like this:

  if (pageInfo.isPostsPage) {
    await getPosts(client, options.posts);
  }

+  if (pageInfo.isArchive) {
+    await getPosts(client, {
+      variables: {
+        where: { categoryName: 'uncategorized' }, // Hard-coding the category name for now.
+      },
+    });
+  }

I expected to see posts from the uncategorized category (default for WP posts) at http://localhost:3000/category/uncategorized. Instead I see no posts. GraphiQL in Chrome shows no categoryName variable was passed to getPosts.

@nickcernis Can you show me the contents of the file in question?

@nickcernis
Copy link
Member

@wjohnsto
Copy link
Contributor Author

wjohnsto commented Feb 12, 2021

@nickcernis Have you confirmed that the call is being made and the results are missing posts? Something like:

  if (pageInfo.isArchive) {
    console.log('making call for archive posts')
    const result = await getPosts(client, {
      variables: {
        where: { categoryName: 'uncategorized' }, // Hard-coding the category name for now.
      },
    });
    console.log(result);
  }

Something to think about, this same call would need to be made client-side in order to work. You would not be able to call usePosts() and expect the archived posts.

@nickcernis
Copy link
Member

Have you confirmed that the call is being made and the results are missing posts?

Yes, it's firing although the result is not missing posts.

Something to think about, this same call would need to be made client-side in order to work. You would not be able to call usePosts() and expect the archived posts.

Thanks, it sounds like this is the likely cause. I'll look into creating a category template with a matching query.

With that in mind I'm happy to approve and merge and address anything else in follow-ups. Thanks again for your work, @wjohnsto!

cookies: getCookiesFromContext(context),
});
let localApolloClient:
| ApolloClient<NormalizedCacheObject>
Copy link

Choose a reason for hiding this comment

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

@wjohnsto hi there, just a random passerby here, but is this a typical union with a prepended | or is there something more going on that I may be misunderstanding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think there is anything more going on, it's possible this was the output from eslint/prettier as I do not remember writing this specifically. The outcome is the same as let localApolloClient: ApolloClient<NormalizedCacheObject>.

Copy link

Choose a reason for hiding this comment

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

Awesome, thanks for clearing that up!

wjohnsto added a commit that referenced this pull request Jul 1, 2021
* feat: change fallback mode to 'blocking' allow passing overrides in initializeNextStaticPaths()

* feat: Add getting started sidebar box to plugin settings page (#76)

* feature: Add getting started box

* design: Style getting started box

* chore: Move install script to external script

This also removes the WPGraphQL notification bar.
We've replaced this with a button so the bar is
no longer needed.

* chore: PHP standards

* chore: Remove unused class

* refactor: Add error handling for WPGraphQL install

* chore: Use consistent plugin name and quotes

* style: Improve label alignment and accessibility

* docs: Update README with more information about the framework

* docs: Improve secret key field description (#78)

- Makes link text more accessible.
- Adds missing `__()` translation function call.

* fix: Replaced wpe_headless_domain_replacement_enabled() in rewrite callbacks with wpe_headless_is_rewrites_enabled() to correct link rewrites. (#77)

* fix: Undefined index: preview_id

* fix: phpcs

* Docs rework to use absolute URL paths (#83)

* testing absolute links

* chore: adding semantic commit

Co-authored-by: William Johnston <[email protected]>

* docs: Add deployment steps for wpe-headless plugin (#79)

* test: Added tests for content replacement functions and callbacks

* test: Moved duplicate wp_insert_post calls to setUp()

* fix: Added optional operator to src attribute within EnqueuedStylesheet when filtering for gutenburg styling (#84)

* docs: Adjust “disable theme” label (#85)

To make it clear that the plugin option disables
admin pages, not full theme functionality.

* fix: change Next to start on port 8080 (#82)

Since the WP Atlas hosting/deployment service expects the service to run on port 8080, we should update the example so it's ready to work with the deployment service.

* feat: Updated for WordPress plugin release. (#88)

* Update README.md (#89)

* feat: add graphql-code-gen

Types are now generated using the WP GraphQL schema

* feat: migrate types over to generated types from WP GraphQL

* style: lint fixes

* fix(BH-816): make redirect in initializeNextStaticProps dynamic

* build: add lint script in @wpengine/headless

* style: lint fixes

* docs: add templating/README.md

* docs: add getting-started/README.md

* docs: Update README with links to guides

* Add callback for content src= replacement (#90)

* feat: Add callback for content src= replacement

* Match full domain path in src attr

* feat: Add content modeling plugin skeleton

* Add phpunit config

* Feat/filter media src (#97)

* feat: Add callback for content src= replacement

* Match full domain path in src attr

* feat: Add conent image srcset filter

* Add admin checkbox for image source rewrite

* style: whitespace lint issue

* test: Add test for when image filter not enabled

* Update media source toggle string

* fix: Added WP_CLI check before redirecting user on WordPress plugin activate. (#101)

* chore: bump Next.js to ^10.0.5 in preview example

* fix: use <div /> instead of <p /> for excerpt/content in example

<p>'s cannot be inside <p>'s and without this, there is an error during rehydration

* fix(BH-809): use Apollo hooks, extract GraphQL queries

* fix: do not export resolveTemplate in /utils to reduce chance of Webpack errors

This should prevent errors if the 'theme' directory is not present in a non-Next.js project

* chore: bump @wpengine/headless to 0.4.0

* refactor: generate wpgraphql.d.ts instead of wpgraphql.ts

The primary advantage to this is a smaller bundle size and not needing to import WPGraphQL all over the place

* ci: refactor plugin jobs and add content-model plugin (#102)

* refactor: existing wpe-headless jobs to paramaterized

* ci: add content-model plugin to circleci

* Add content model readme file

* remove composer-setup.php after lint

* test: End to end testing integration (#104)

* Added @wordpress/env package to create a WordPress testing/development environment

* Added wp-env commands for wpe-headless plugin.

* Added wp-env config file to wpe-headless plugin

* Added cypress and wp-env npm packages

* Added cypress files

* Corrected failing test

* Turned videos off by default

* Reworked .gitignore

* Moved end-2-end testing to project root

* fix: resolve regressions with previews not working without client-side requests

* fix: run getContentNode if using front page to properly hydrate Apollo cache

This fixes usePost() not returning anything if using a frontpage and client-side queries are disabled. Also, extracted out query into nextFetchFromWP()

* feat: add page.tsx template to preview example

* fix: update heading levels in preview example templates

* docs: Added documentation for end-2-end testing. (#107)

* Added documentation for end-2-end testing

* Update docs/DEVELOPMENT.md

Co-authored-by: Nick Cernis <[email protected]>

Co-authored-by: Nick Cernis <[email protected]>

* Cookies will only be persistent for a single request (#108)

* putting apollo client on context

* feat: cookie now initialized whenever accessed

* feat: cookies are persistent only for a single request

* chore: fixing lint issues

* fix: add ctx prop to <HeadlessProvider /> in example

Co-authored-by: William Johnston <[email protected]>
Co-authored-by: Clay Griffiths <[email protected]>

* chore: bump @wpengine/headless to 0.4.1

* feat: Added initial structure for registering custom content types and fields.

test: Updated phpcs config.

* feat: Adjust domain replacement logic to remove header / query parameter requirement.

BREAKING CHANGE:

Previously the plugin required enabling the "Enable Post and Category URL rewrites" setting
and also passing either the `replace-domain` parameter to the WPGraphQL endpoint
or sending `HTTP_X_WP_HEADLESS` in the header.

Now it only requires enabling the plugin option. No other request parameters
are required.

* fix: Use 302 redirects for public URLs (#113)

Turning off “Enable public route redirects” will
no longer continue to cause redirects due to
aggressive browser caching of 301 redirects.

* style: Style and structure the example project (#109)

* chore: Add normalize.css and sass to starter theme

* chore: Add a main Sass file for global CSS

* chore: Load normalize.css and the main CSS file

* chore: Add fonts and font-face declarations

* design: Add base styling

* feat: Add simple stateless components and styles

* chore: Add image for homepage hero background

* feat: Add front page content and styles

* refactor: Use Next Link for site title

* refactor: Make Posts intro prop optional

* feat: Add Header and Footer to all page templates

* style: Add padding around page content

* style: Add breakpoint Sass variables

* docs: Mention the components scoped CSS styles

* feat: Give Hero component an ID prop

So that styling can be overridden on a per-page
basis.

The page using the Hero component can pass the
id prop and then override default Hero styling
in its [page-name].module.scss file.

* style: Give posts a scoped 'single' class

To help with responsive styling.

* style: Adjust styling at smaller widths

* chore: Pass heading levels in a type-safe way

Some hoop-jumping to satisfy TypeScript's type
checker. Fixes the type error that @mindctrl
kindly reported:

Type '{ children: string; className: string; }'
is not assignable to type 'IntrinsicAttributes'.

* refactor: Rename sass folder to scss

* chore: Fix import order

* refactor: Use Google Fonts instead of local fonts

Addresses feedback from @trevanhetzel at
https://github.com/wpengine/headless-framework/pull/109#discussion_r568136700.

* chore: Annotate function return types

* docs: Update font info on the front page.

To mention Google Fonts in place of locally hosted
fonts.

* fix: Incorrect nesting of Post heading and link

This was causing a console error for the Posts
component:

“Function components cannot be given refs.”

* chore: Suppress no-spreading warning

* chore: Suppress unneeded eslint rules

* fix: Load front-page.tsx if showing latest posts

If Settings → Reading is set to display latest
posts on the homepage (the default), this ensures
that the latest-posts template loads to display
the welcome content.

Before, users would have to set a static page
as the homepage in WP before they saw the default
homepage, which is a worse setup experience.

* chore: Remove unused file

* chore: Inline Post type

The WPGraphQL types do not appear to be exposed,
so attempting to import { WPGraphQL } from
'@wpengine/headless' results in:

Type error: Module '"../node_modules/@wpengine/headless/dist"'
has no exported member 'WPGraphQL'.

* fix: return '404' as possible template if there's a 404

* feat: add 404.tsx template to examples/preview

* fix: force $wp_query->parse_query() to run when getting templates

* fix: Remove front page template loader from index

Clay's fix in https://github.com/wpengine/headless-framework/pull/109/commits/9e996a96be95d042a48df69063d3e2aebb84aebf
ensures the front-page template loads for “latest
posts” homepages now, so front-page.tsx
will load automatically as expected. 🎉

* docs: change “theme” to “project” in welcome text

To address Trevan's copy edits:
- https://github.com/wpengine/headless-framework/pull/109#discussion_r568981682
- https://github.com/wpengine/headless-framework/pull/109#discussion_r568982025

Co-authored-by: Clay Griffiths <[email protected]>

* Ci: package headless build (#111)

* ci: Add npm build and test jobs

* npm install in test job

* Disable npm package test run until failing test can be fixed in another ticket

* ci: enable npm package test

* ci: use circleci/node orb commands

* test: remove menu component test. needs attention

* test: pass with no tests found

* chore: remove 404 page template (#114)

Removes pages/404.tsx, because 404s will now
result in loading theme/404.tsx.

This ensures that:
- Devs don't have two conflicting 404 templates to
choose from.
- example.com/404 loads the theme 404 template
instead of the page/404.tsx template.

* fix: Change the way GraphQL auth callback checks HTTP_AUTHORIZATION (#116)

* chore: bump wpe-headless plugin to 0.4.1

* feat: clone preview as getting-started (#117)

* refactor: clone preview folder as getting-started

We plan to then simplify the preview example in
a future PR.

getting-started will serve as the full framework
demo from this point on.

* chore: remove dev-lerna script for preview example

We only want packages/headless and
examples/getting-started to build when doing
`npm run dev` from the project root.

Otherwise Next spins examples/preview and
examples/getting-started up and there's a port
collision on 3000.

An alternative is to spin up examples on different
ports, but this seems excessive, particularly if
the examples folder grows.

* docs: update install steps to use getting-started

* docs: update getting-started example readme (#118)

I cloned this from the preview example but forgot
to update the readme.

* Ci/add e2e test (#119)

* ci: Add npm build and test jobs

* npm install in test job

* Disable npm package test run until failing test can be fixed in another ticket

* ci: enable npm package test

* ci: use circleci/node orb commands

* test: remove menu component test. needs attention

* test: pass with no tests found

* ci: add e2e

* ci attach project

* ci add run cypress tests

* ci: move e2e to own workflow

* build: include src/types/wpgraphql.d.ts in published package

* chore: bump version to 0.4.3

* chore: update @wpengine/headless in preview example

* docs: Fixed link to post previews doc

Closes #121.

* feat: Add "npm run clean" command (#125)

* feat: Add "npm run clean" command

Clears next folders and node_modules for the
example projects.

Intended to be run from the project root after
switching branches and encountering unexpected
behavior.

Follow with `npm run bootstrap` to start over.

* docs: mention 'npm run clean' command

Props @markkelnar.

* refactor: use WPGraphQL types in Posts component (#124)

* refactor: pass templates to TemplateLoader and Data Fetchers rather than auto loading from theme dir

* feat: make <TemplateLoader /> generic, add <NextTemplateLoader />

* refactor: update examples/preview to use wp-templates dir

* fix: return null in <TemplateLoader /> if page info is not provided

* fix: make templates param in Data Fetcher optional

* docs: update docs to reflect <TemplateLoader /> changes

* docs: Document the WPHead component (#128)

* docs: add WPHead readme

* docs: complete WPHead readme

* docs: update examples to point to wp-templates/ instead of theme/

* fix: ensure WP stylesheets start with WP URL (#115)

Passes the WP URL from WPGraphQL instead of
depending on process.env, which isn't available
to the WPHead component.

* fix: remove hash when querying GetUriInfo in useUriInfo()

* chore: bump @wpengine/headless to 0.5.0

* feat(BH-863): add support for previewing drafts (#122)

* feat: add support for previewing drafts in @wpengine/headless

* feat: add support for previewing drafts from WP (note: Gutenberg not yet supported)

https://github.com/WordPress/gutenberg/issues/4555
https://github.com/WordPress/gutenberg/issues/13998

* fix: improve reliability of post preview link replacement for published content

* feat: add NextPreviewContext so we can better know if previewMode is active in hooks

* test: update preview link WP test

Co-authored-by: Nick Cernis <[email protected]>

* fix: prevent 500 error on archives (#131)

* chore: extend GET_URI_INFO query with conditionals

So that `nextFetchFromWP` can better alter
requests based on the page type.

* chore: add conditionals to getUriInfo service

Exposes isSingular and isArchive in the response.

* chore: update UriInfo type with new conditionals

* chore: update GetUriInfoQuery type

Handled automatically with this command from
packages/headless:

npm run generate-graphql

* refactor: only run getContentNode on singulars

Calling getContentNode on an archive was causing
the 500 error.

* fix: update package-locks

Attempting to clear CI errors.

* revert: remove package locks

* fix: check pageInfo is not void before using

Resolves the compilation error:

Property 'isSingular' does not exist on
type 'void'.

* refactor: improve front page variable name

* refactor: improve inline comment

* refactor: remove unneeded path check

isFrontPage and isPostsPage are all we need.

* fix: WPE_HEADLESS_SECRET to WP_HEADLESS_SECRET (#134)

The WPE_ prefix is reserved for env vars on the
WP Engine hosting platform, so users will not
be able to create vars with this name.

* docs (BH-829): Generate headless package docs with typedoc (#132)

* docs: generate docs with typedoc

* chore: update package-lock

* chore: configure typedoc

* docs: add initial generated docs

* docs: correct typo

* Custom queries (#133)

* feat: adding post and page data fragments

* feat: setting up gql queries with fragments

* adding page information and allowing list post options

* feat: allowing extensible args for list posts

* chore: fragments are explicit, variables on gql calls are optional

* feat: enabling variables and fragments to be passed to gql services

* chore: adjusting example to use new hook interfaces

* feat: conditionally calling server-side services, usePost will only make request if necessary

* chore: lint fix

* removing console log

* refactor: initializeApollo -> getApolloClient

* chore: decoupling next

* refactor: adjusting exports to be consistent and not use default, lint fix

* feat: allowing customizable queries on the backend and allowing you to cache them as well

* moving react dependencies into sub-folder

* refactor: using higher-level component imports

* refactor: moving WPHead to be a next-only component

* refactor: removing unused docs, adding documentation for theme components

* adding docs for queries

* fix: correcting doc imports

Co-authored-by: Will Johnston <[email protected]>

* chore: prep headless plugin 0.5 and package 0.6 (#136)

* chore: bump headless package to 0.6.0 in examples (#137)

* chore: correcting image link to be absolute (#138)

Co-authored-by: William Johnston <[email protected]>

* docs: fix typo breaking a link in README (#140)

* docs: fix post preview link (#143)

* fix: Rewrite href nodes with the frontend URL (#99)

* fix: Replace href keys in WPGraphQL responses

So that URL replacement works in the updated menu
component.

* ci: npm publish job (#141)

* feat (BH-864): Add a category template to the getting-started example (#145)

* feat: Add category template

* feat: Add PostsArchive component

Same as Posts but attempts to amend the default
query.

* refactor: Remove PostsArchive component

Just use Posts instead.

* fix: Load a named category in category.tsx

* fix: Fetch category slug from path

Assumes a category prefix of 'category'.

* chore: Remove to-dos and unused code

Co-authored-by:  John Parris <[email protected]>

* fix: only returning revalidate for SSG (#142)

* fix: only returning revalidate for SSG

* ensuring pageProps is an object

* fix: lint

Co-authored-by: William Johnston <[email protected]>

* fix (BH-897): Fetch six posts for the front page template (#147)

* fix: Fetch six posts for the front page template

Fixes #144 so the front page template displays
posts even if Settings → Reading is using a
static page instead of “latest posts”.

* docs: remove where clause to get all posts

* Adjusting previews doc to work with latest framework features (#148)

* chore: correcting image link to be absolute

* doc: adjusting previews doc to work with latest framework features

Co-authored-by: William Johnston <[email protected]>

* feat: Add wp-admin index page for content modeling.

* test: Add test for content model wp-admin page

* feat: Generate labels for custom post type registration.

Given a singular and plural name, generate the labels necessary
for registering custom post types.

* test: Add tests for generating custom post type labels.

* test: Update labels in example test data.

* ci: Update phpcs configuration.

* feat: Pagination component (BH-856) and getting-started example (#154)

* feat: Add a Pagination component to display links

This depends on Next and WPGraphQL. It assumes the
cursor-based pagination strategy described at
https://www.wpgraphql.com/2020/03/26/forward-and-backward-pagination-with-wpgraphql/.

Custom queries must be handled separately by the
page template displaying the posts. See an example
in headless-framework/examples/getting-started/wp-templates/category.tsx.

* chore: Do not pass pagination info to WPGraphQL

When the path is
/category/uncategorized/after/abc123, we want to
only send /category/uncategorized to GraphQL for
the purpose of determining the correct template
for the current page.

So strip the `/after/abc123` portion, leaving
/category/uncategorized.

This assumes we want to paginate post archives
using URLs in the format:

/category/uncategorized/[before|after]/[abc123].

Where abc123 is the ID of the last or first post
on the current page.

This is different to the WP-native /page/1 format
but more closely matches the more efficient
cursor-based pagination strategy at
https://www.wpgraphql.com/2020/03/26/forward-and-backward-pagination-with-wpgraphql/

It also allows pages to be fetched on the server
(and cached) without using client-side requests
to fetch additional content. This means a user
does not have to fill in NEXT_PUBLIC_WORDPRESS_URL
to get paginated content.

* feat: Add pagination to getting-started template

To demonstrate a paginated archive. Will show
next and previous page links on category
archives such as category/uncategorized.

* style: Add basic styles for the pagination links

* refactor: extract category option logic

Puts category option logic in the framework
instead of in the page template.

As suggested by @trevanhetzel in
https://github.com/wpengine/headless-framework/pull/154.

* docs: improve getStaticProps info

* chore: lint

* refactor: 'keyword' to 'direction'

Keyword sounds like it relates to search terms.

Thanks to @mindctrl for the feedback.

* fix: #152, exporting types from non-core modules (#153)

Co-authored-by: William Johnston <[email protected]>

* ci: Install WPGraphQL plugin for phpunit tests.

* feat: Register custom post types and fields with the WPGraphQL API

* ci: Update PHP_CodeSniffer config to remove snake case requirement.

* chore: Remove debug code

* test: Add test case for number/float field type.

* fix: Do not replace URLs in generalSettings query

So that a query like this:

query GeneralSettings {
  generalSettings {
    title
    description
    url
  }
}

Gives the expected WP URL instead of the frontend
site URL if “Enable Post and Category URL
rewrites” is enabled at Settings → Headless.

* Added to quickstart to populate front end url (#161)

* fix: improvements to the Posts getting-started component (#160)

* fix: Wrap read more anchor in Next Link component

* refactor: remove count prop from Posts

No longer required because we can now limit posts
via custom queries, as in front-page.tsx.

* chore: remove unneeded href attribute

Next Links only need this on the Link wrapper:
https://nextjs.org/docs/api-reference/next/link

* chore: remove unneeded space

Co-authored-by: John Parris <[email protected]>

Co-authored-by: John Parris <[email protected]>

* feat: Point getting-started to a live demo URL for a faster new user experience (BH-895) (#155)

* feat: Use a demo WORDPRESS_URL by default

Makes a missing WORDPRESS_URL or .env.local a
warning instead of an exception.

Shows content from a live demo site instead of
failing to build.

* feat: Warn if WP_HEADLESS_SECRET is not set

Instead of throwing an exception and failing to
continue, warn the user if WP_HEADLESS_SECRET is
unset.

That way they can continue without env vars and
still see demo content. (Previews will not work
until they act on the warning.)

* feat: Add a posts link to the hard-coded menu

Swap out for a dynamic menu in another PR.

* docs: Redo quick start docs

To create the frontend app first, then repoint
to a WordPress instance.

* docs: Redo getting started docs

To create the frontend app first, then repoint
to a WordPress instance.

* docs: frontend to front-end for consistency

* docs: Prompt to set the front-end site URL

* chore: prep WP Engine Headless 0.5.1 and @wpengine/headless 0.6.1 for release (#162)

* chore: bump @wpengine/headless package to 0.6.1

* chore: bump WP Engine Headless plugin to 0.5.1

* docs: note stable tag in readme when releasing

* docs: add package changelog and compatibility note

* docs: fix plugin name

* chore: set examples to use @wpengine/headless 0.6.1 (#164)

* chore: bump examples to use latest package version

* chore: update lockfiles

* chore: Remove content model plugin and Circle CI config

* docs: Describe automated package release process (#169)

* Update format for preview links (#167)

* fix: Rewrite post preview links to the following format:

host/preview/post-slug?p=xx&preview=true

* test: Adjust preview link test to check for updated link format.

* refactor: client-side preview handling

* feat: Gutenberg preview link replacement

* feat: fixing gutenberg bug where preview link filter is not honored. TemplateLoader works for promises or components. Removing preview handler, since only auth handler is needed

* doc: adjusting NEXT_PUBLIC_WORDPRESS_URL to be default

* doc: adjusting previews doc to use new preview route

* fix: lint errors

* fix: lint errors

* refactor: JS is old-browser friendly

* fix: fixing WP gutenberg links, adding XXX

* fix: not opening new window for preview links

* fix: composeUrlPath will only warn if uriPath is not a string

* fix: changed displatch for gutenberg editor to autosave instead of savePost

* fix: pagination is working with a default implementation

* doc: fixing typo

* doc: simplifying previews component

* docs: Amend getting started steps to copy env file

The hard-coded fallback URL was removed in
https://github.com/wpengine/headless-framework/pull/167/files#diff-d1f942ac42801cdbd70e98a5a4105d8c354af691b37b65f1706f5323898af1e7L23.

So we now need to prompt the user to copy the
env file before they run the dev server.

Without this every page 404s.

Co-authored-by: William Johnston <[email protected]>
Co-authored-by: Matt Landers <[email protected]>
Co-authored-by: Matt Landers <[email protected]>
Co-authored-by: Nick Cernis <[email protected]>

* chore: prep WP Engine Headless 0.5.2 and @wpengine/headless 0.6.2 for release (#171)

* chore: Prep WPE Headless plugin 0.5.2 for release

* chore: Prep headless package 0.6.2 for release

* chore: Use @wpengine/headless 0.6.2 in examples (#172)

* Preview links work with configured site URL path (#173)

* fix: Rewrite post preview links to the following format:

host/preview/post-slug?p=xx&preview=true

* test: Adjust preview link test to check for updated link format.

* refactor: client-side preview handling

* feat: Gutenberg preview link replacement

* feat: fixing gutenberg bug where preview link filter is not honored. TemplateLoader works for promises or components. Removing preview handler, since only auth handler is needed

* doc: adjusting NEXT_PUBLIC_WORDPRESS_URL to be default

* doc: adjusting previews doc to use new preview route

* fix: lint errors

* fix: lint errors

* refactor: JS is old-browser friendly

* fix: fixing WP gutenberg links, adding XXX

* fix: not opening new window for preview links

* fix: composeUrlPath will only warn if uriPath is not a string

* fix: changed displatch for gutenberg editor to autosave instead of savePost

* fix: pagination is working with a default implementation

* doc: fixing typo

* doc: simplifying previews component

* fix: preview links working for frontend site URLs with path

* lint: fix

* lint: fix 2

* fix: using skip parameter for useQuery to avoid conditional hook calls

* refactor: using skip for useQuery for every skippable hook

Co-authored-by: John Parris <[email protected]>
Co-authored-by: William Johnston <[email protected]>
Co-authored-by: Matt Landers <[email protected]>
Co-authored-by: Matt Landers <[email protected]>

* Prep WP Engine Headless 0.5.3 and @wpengine/headless 0.6.3 for release (#175)

* chore: bump WPE Headless plugin to 0.5.3

* chore: bump @wpengine/headless package to 0.6.3

* test: Codeception end-2-end integration (#159)

* Integrated Codeception.
* Added end-2-end tests for settings.
* Added end-2-end tests for post previews.

Co-authored-by: Nick Cernis <[email protected]>

* chore: use @wpengine/headless 0.6.3 in examples (#176)

* DOCS: Initial Framework grammar and tone edits (#181)

* DOCS: Initial Framework grammar and tone edits

* Update docs/getting-started/README.md

Co-authored-by: Nick Cernis <[email protected]>

* Update docs/getting-started/README.md

Co-authored-by: Nick Cernis <[email protected]>

* Update docs/getting-started/README.md

Co-authored-by: Nick Cernis <[email protected]>

* Update docs/templating/README.md

Co-authored-by: Nick Cernis <[email protected]>

* Update docs/queries/README.md

Co-authored-by: Nick Cernis <[email protected]>

* Update docs/templating/README.md

Co-authored-by: Nick Cernis <[email protected]>

* Remove "it" from sentence.

* Update README.md

* Update docs/templating/README.md

Co-authored-by: Nick Cernis <[email protected]>

Co-authored-by: Nick Cernis <[email protected]>
Co-authored-by: Will Johnston <[email protected]>

* doc: adding space between of[Node] (#182)

* adding space between of[Node]

* doc: semantic commit

* doc: reverting semantic commit

Co-authored-by: William Johnston <[email protected]>

* test: Add phpunit tests for settings functions

* build(deps): bump elliptic in /examples/getting-started (#180)

Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump elliptic from 6.5.3 to 6.5.4 in /examples/preview (#179)

Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump elliptic from 6.5.3 to 6.5.4 in /packages/headless (#178)

Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: bump next to 10.0.9 (#184)

Removes a transitive dependency (cacache) that
depended on a vulnerable version of ssri (6.0.1)
triggering dependabot alerts.

* chore: bump lerna to 4.0.0 (#185)

To ensures that the `ssri` transitive dependency is
using the security patch from v8.0.1.

* chore: bump @wordpress/env to prevent mysql error

Error during npm run wp:start was:
mysqlcheck: Got error: 1045: Access denied for user

Caused by changes to the WP Docker image:

https://github.com/WordPress/gutenberg/issues/29829

* fix: prevent errors for JWT authenticated requests (#190)

Removes the graphql_authentication_errors filter
and callback, which cause an error for JWT
authenticated requests.

Authentication already happens in
wpe_headless_rest_determine_current_user, which
is hooked to determine_current_user and runs
during GraphQL, REST and regular requests.

Fixes #189.

* chore: prepare release of WPE Headless 0.5.4 (#192)

* Update CODEOWNERS to include developer-relations.

* Removing Cypress (#196)

* updating composer doc to specify codeception version

* refactor: removing Cypress (#195)

* refactor: removing test-end-2-end which only references cypress tests

Co-authored-by: William Johnston <[email protected]>

* build(deps): bump node-notifier in /packages/headless (#197)

Bumps [node-notifier](https://github.com/mikaelbr/node-notifier) from 8.0.0 to 8.0.2.
- [Release notes](https://github.com/mikaelbr/node-notifier/releases)
- [Changelog](https://github.com/mikaelbr/node-notifier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mikaelbr/node-notifier/compare/v8.0.0...v8.0.2)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump rmccue/requests in /plugins/wpe-headless (#193)

Bumps rmccue/requests from 1.7.0 to 1.8.0.

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs[repo](#201): adding basic contribution guidelines (#202)

* docs[repo](#201): adding basic contribution guidelines

* docs[repo]: adding semantic commits workflow

* docs[repo]: configuring semantic commits

* docs: configuring semantic commits

Co-authored-by: William Johnston <[email protected]>

* build(deps): bump ua-parser-js in /packages/headless (#204)

Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 0.7.23 to 0.7.28.
- [Release notes](https://github.com/faisalman/ua-parser-js/releases)
- [Commits](https://github.com/faisalman/ua-parser-js/compare/0.7.23...0.7.28)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump handlebars from 4.7.6 to 4.7.7 in /packages/headless (#205)

Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.7.6 to 4.7.7.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.7.6...v4.7.7)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump url-parse from 1.4.7 to 1.5.1 in /packages/headless (#206)

Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.4.7 to 1.5.1.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.4.7...1.5.1)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Contribution guidelines (#203)

* docs[repo](#201): adding basic contribution guidelines

* docs[repo]: adding semantic commits workflow

* docs[repo]: configuring semantic commits

* docs: configuring semantic commits

* fix: fixing broken links

Co-authored-by: William Johnston <[email protected]>

* build(deps): bump lodash in /examples/getting-started (#207)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump lodash from 4.17.20 to 4.17.21 in /examples/preview (#208)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump lodash from 4.17.20 to 4.17.21 (#213)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump lodash from 4.17.20 to 4.17.21 in /packages/headless (#212)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump hosted-git-info in /examples/getting-started (#211)

Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump hosted-git-info in /examples/preview (#210)

Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump hosted-git-info in /packages/headless (#209)

Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: lint fixes (#216)

* fix: lint fixes

* fix: updating packages and running lint:fix

Co-authored-by: William Johnston <[email protected]>

* `core` broken out (#215)

* feat: setting up core package, removing references to react, next. Adjusting environment variables to be configuration variables

* test[core]:(#198) Adding config tests

* test[core]:(#198) moving config test file to mimic folder structure in src

* test[core]:(#198) finishing config tests

* fix: linting issues

* fix[core]: fixing lint warnings

Co-authored-by: William Johnston <[email protected]>

* feat: break out `react` package (#217)

* feat: setting up core package, removing references to react, next. Adjusting environment variables to be configuration variables

* feat[react](#199): Begin scaffolding for decoupled React package

* fix[react]:(#199) Use new paths for imports and remove old deps from package

* fix[react]:(#199) Remove react components

* fix[react]:(#199) Remove components export from index and Add Todos

* make: use @wpengine/headless-core naming for now

* fix: Update import paths to headless-core

* fix: wildcard export of queries for react pck

* chore: bump @apollo/client to 3.3.17

* fix: add back `QueryResult` types in services

Adding back the `ApolloQueryResult` type as the `useQuery` hook in `@apollo/client` still returns `QueryResult` instead of `ApolloQueryResult`

* fix: when running dev-lerna don't clean before tsc

run `npm run bootstrap` prior to `npm run dev` to built packages for dev.

Removed the `clean` script from `dev-lerna` since we now have sibling packages relying on each other

* chore: remove old react submodule

* fix: set headless-core version to 0.6.3

* fix: package versions and names

* refactor: remove ununsed types

* fix: Match ApolloClient shape from core

* fix[core]:(#199) adjusting ApolloQueryResult | QueryResult to be more specific to support core and react modules. Adjusting package.json to list apollo and graphql as dependencies

Co-authored-by: William Johnston <[email protected]>

* feat: break out `next` package (#219)

* feat: setup scaffolding for next package

* fix: Add @wpengine/headless-react dep

* fix: sibling dependency imports

* fix: export HeadlessProvider for headless-next

* fix: include nextConfig

* fix: export authorizeHandler

* fix: remove next as dependency

* fix: add wpgraphql definition

* fix: include reference to wpgraphql definition

* refactor: include core utils under submodule

* fix: include next definition reference

* refactor: remove WPHead

* Publish `core`, `react`, and `next` (#226)

* chore: incrementing package versions

* chore: setting package urls

* chore: #223 updating react to use canary core

* chore: #223 updating next to use canary core and canary react

Co-authored-by: William Johnston <[email protected]>

* ci: setting up linting automation (#222)

* ci: setting up linting automation

* fix: removing graphql devDependency

* fix: #221 lint fixes and package increment

* fix: #221 lint fixes and package increment for react

* fix: #221 lint fixes and package increment for core

Co-authored-by: William Johnston <[email protected]>

* build(deps): bump wp-cli/wp-cli in /plugins/wpe-headless (#231)

Bumps wp-cli/wp-cli from 2.4.1 to 2.5.0.

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs: Next.js getting started example with decoupled packages (#237)

* Next getting started example

* fix: Use released headless packages on NPM

* feat: Add pagination, SSG for archive pages

* refactor: document the permalink category base

* refactor: category URL in archive getStaticProps

* make: lerna dev scripts

* fix: site titles and scss home page styles

* fix: revert next package changes

* refactor: remove re-exports from higher-level headless libs (#229)

* refactor: remove re-exports from higher-level headless libs

* fix: typescript-eslint and prettier rule conflict

* fix: lint scripts for ci

* fix: remove prettier/@typescript-eslint

* Revert "fix: lint scripts for ci"

This reverts commit f6c86ec120194a87a5efa3ccef80249c953a6c42.

* fix: Use core linting scripts

* fix: ESlint warnings

* style: Use src directory in examples/next/getting-started (#242)

* style: use src dir for components, pages, & scss

* chore: remove old styles

* refactor: remove custom next.config.js implementation

* style: update tsconfig baseUrl for src dir

* refactor: (#239) removing unused code and using baseUrl for imports

* fix: npm audit

Co-authored-by: William Johnston <[email protected]>

* refactor: remove nextConfig.js (#243)

* refactor: remove custom nextConfig implementation

* fix: npm audit

* docs: update changelogs for 0.6.4-0.6.5 (#245)

* Tests: Create tests for Next package (#247)

* refactor: specify modules for export

* test: add tests for stringifyQueries

* test: getStaticPaths default and overridabale tests

* test: suites for utils

* Create tests for `core` package (#248)

* test[core]: (#246) adjusting config exports to allow for granular testing, making config params immutable, adding tests for mutability

* test[core]: (#246) adding assert tests

* test[core]: (#246) adding assert tests

* test[core]: (#246) adding cookie tests where possible

* test[core]: (#246) adding assert tests

* test[core]: (#246) adding assert tests

* test[core]: (#246) adding auth middleware tests

* test[core]: (#246) adding auth/authorize tests

* removing hanging fetch

Co-authored-by: William Johnston <[email protected]>

* headless-plugin: do not rewrite post links in GraphQL response (#250)

To prevent an issue where post uris are returned
with a localhost prefix but page uris are
returned with just the path.

Both post and page uris will now be only the path.

* chore: prep Headless Plugin 0.5.5 for release (#251)

* Tests: Create test for React package (#249)

* fix: jest config for react package

* refactor: only export what is necessary

* test: create useGeneralSettings custom hook test

* test: useUriInfo test

* fix: use version 1 lockfile

* fix: eslint issue

* fix: middleware conflict

* fix: update lint script to use ts parser

* chore: npm audit

* fix: remove unused imports

* Add root-level scripts for linting and testing (#253)

* chore: (#252) adding linting and testing scripts

* chore: (#252) modifying eslint action to use root script

* chore: (#252) modifying eslint action to install the right dependencies

* chore: (#252) adding testing github action

* chore: (#252) adding testing github action as separate file

* chore: (#252) fixing tsconfig files in react and next packages to allow for better monorepo intellisense

* chore: (#252) adding react and react-dom devDependencies to next package

* chore: (#252) renaming action tasks

* chore: (#252) renaming action tasks

Co-authored-by: William Johnston <[email protected]>

* chore: (#254) removing lerna, adding root scripts for bootstrapping (#256)

Co-authored-by: William Johnston <[email protected]>

* Add ESLint Ignore Patterns for IDE ESLint plugins (#257)

* chore: (#255) add ESLint ignore patterns

* Revert "chore: (#255) add ESLint ignore patterns"

This reverts commit dff565bb7a877e92cc85dd29e4d614ee146e75c4.

* chore: (#255) revert and fix formatting

* chore: fixing refresh script to not install with a prefix (#258)

Co-authored-by: William Johnston <[email protected]>

* fix: (#259) ESLint scripts on MacOS (#260)

* Removing apollo and adding gqless (#264)

* chore: (#262) removing apollo and adding gqless

* feat: (#262) adding ability to intercept request context and apply headers, adding client-side auth header

* feat: (#262) incrementing versions

* feat: (#262) add gqless to React package (#265)

* chore: (#262) removing apollo and adding gqless

* feat: (#262) adding ability to intercept request context and apply headers, adding client-side auth header

* feat: (#262) incrementing versions

* feat: (#262) create client

* refactor: (#262) remove apollo

* refactor: (#262) headless provider

* feat (#262): create hooks using gqless

* feat: (#262) provide client creation options ability

Co-authored-by: William Johnston <[email protected]>

* fix: (#266) fix headlessConfig() setter (#267)

* feat: resolve/infer URL from Next context (#263)

* feat: utils to determine url from context

* test: getUrlFromContext and other utils

* fix: add react as dev dependency for test

* chore: npm audit

* fix: getCurrentUrlPath uses getUrlFromContext + tests

* fix: Add jest types for monorepo development

* fix: eslint issues

* refactor: reorganize getUrlFromContext

* fix: add @apollo/client dep

* feat: infer pagination archive urls

* Gqless next implementation (#268)

* chore: incrementing package versions

* feat: (#262) adding next gqless support, adjusting react typings to test merging

* feat: adding is404, exporting core client on react and next clients (#269)

* feat: (#278) create react example (#282)

* feat: react example

* feat: design/styles for react example

* fix: navigation

* fix: preview route

* feat: enable previews in React example

* feat: ability to specify the api URL

* feat: env template

* feat: finalize home page and add titles

* feat: start server script

* refactor: bootstrap

* fix: react helment titles

* refactor: use canary packages

* refactor: use the default client

* refactor: add local types

* chore: adjusting typings to avoid having to cast, adding linking scripts

* fix: requested changes

Co-authored-by: William Johnston <[email protected]>

* fix: (#284) preview example alerts (#285)

* Getting started migration (#283)

* exporting next client

* doc: (#273) adding post list and single post pages using canary framework

* doc: (#272) adding pageUri page

* fix: correct router provider for getNextStaticProps

* fix: example is using new getNextStaticProps interface

* chore: adding next lint and fixing lint error

* fix: is404 will always refetch the entity

* feat: (#274) migrate categories

* chore: setting up workspaces

* chore: fixing actions to install and run correct scripts

* chore: actions use node 14

* chore: correcting action

* chore: correcting action

* chore: correcting test action to not run npm test

* chore: removing node version matrix from action

* chore: testing version action

* chore: testing version action

* chore: using node 15 to get npm 7

* chore: actions are building before running test or lint

* chore: actions should be working now with correct npm version

* doc: (#276) pagination working for posts

* doc: (#276) using pagination component for post pagination

* chore: removing unused code

* doc: (#276) pagination component using const and exporting props interface

* feat: (#272) demonstrate custom page use

* doc: adding 404 functionality to posts, adding featured category page and header link to blog

* feat: adding optional logger for queries

* feat: (#277) category pagination

* fix: lodash linting error

* fix: Add 404 checks to pages/categories

* fix: (#281,#271) previews working in next example

* fix: adding preview file

* fix: useHydrateCache always restores cache, logger is direct import

* chore: incrementing versions

* fix: removing console log

* chore: removing unused code

* refactor: prepare for demo

* feat: Add custom 404 page

* fix: display featured image on post/page if exists

* refactor: remove unused deps from example

* chore: incrementing package versions

* doc: (#271) adding page and post previews to a single page

* chore: using next package versions

* chore: updating dependencies

* fix: lint issue

Co-authored-by: Blake Wilson <[email protected]>

* fix: (#284) glob-parent, normalize-url (#286)

* doc: (#287) using core types for pagination and posts (#288)

* Dependabot fix (#291)

* fix: (#290) removing old package-lock.json

* fix: (#290) removing old headless/package-lock.json

* fix: (#290) updating headless packages

* ci: removing packages/headless build from CI since it is deprecated

* ci: removing packages-headless build from CI since it is deprecated

* Custom client functionality (#295)

* doc: (#279) adding project with custom client

* feat: (#279) enabling custom clients as well as server-side clients, adding custom client to getting-started

* feat: (#279) enabling ssr for authenticated client requests

* fix: (#290) Replace node-sass with sass (#294)

* fix: node-sass -> sass, remove react example from workspaces

* fix: minor/patch scripts

* refactor: remove old codegen tools

* chore: (#296) incrementing package versions (#297)

* Migrate react example 0.7 (#299)

* refactor: use new 0.7 client

* fix: use plain WP schema

* refactor: use ReactClient interface

* refactor: use schema types

* make: fix trim-newlines dependabot alert (#300)

* Setting @faustjs as framework name (#319)

* feat: (#317) setting @faustjs as framework name

* fix: lint issues

* docs: Initial docs setup for FaustJs (#320)

* feat: docusaurus setup

* chore: clean up docusaurus config

* docs: start data fetching in next

* docs: usePage next hook

* docs: useGeneralSettings hook in next

* docs: WIP params, ssg, ssr, data fetching

* docs: next client generation

* docs: data fetching hooks, custom client usage

* docs: usePages hook

* docs: ssr/ssg

* docs: (#306) create CPT guide

* fix: custom post types guide title

* docs: (#306) clean up CPT guide (#322)

* Reference doc for SSR and SSG (#323)

* doc: (#310) finishing ssr and ssg doc, moving is404 to new file, adding HeadlessProvider information

* doc: adding files and updating packages

* doc: (#307) completing doc for hooks and fetching data (#328)

* doc: (#309) finishing 404 doc (#325)

* Refactor React Hooks (#330)

* refactor: (#327) remove react hooks from client and example

* refactor: (#327) remove `useGeneralSettings` and `usePages` from next client

* Refactor `getNext...` and `is404` config  (#329)

* feat: (#321) Support revalidate config option

* feat: (#321) support `redirect` and `notFound`

* refactor: (#321) destructure revalidate

* test: (#321) create tests for getNextServerSideProps and getNextStaticProps

* refactor: (#324) Update is404 param structure

* docs: (#324) update is404 docs

* refactor: (#324) use `notFound` config key for is404

Co-authored-by: Clay Griffiths <[email protected]>
Co-authored-by: Nick Cernis <[email protected]>
Co-authored-by: Trevan Hetzel <[email protected]>
Co-authored-by: Ryan Meier <[email protected]>
Co-authored-by: John Parris <[email protected]>
Co-authored-by: Ben Greeley <[email protected]>
Co-authored-by: Mark Kelnar <[email protected]>
Co-authored-by: Clay Griffiths <[email protected]>
Co-authored-by: Mateusz Czapliński <[email protected]>
Co-authored-by: Ajit Bohra <[email protected]>
Co-authored-by: Matt Landers <[email protected]>
Co-authored-by: Matt Landers <[email protected]>
Co-authored-by: Matt Landers <[email protected]>
Co-authored-by: Nate Archer <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Brandon DuRette <[email protected]>
Co-authored-by: Blake Wilson <[email protected]>
Co-authored-by: Blake Wilson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants