Releases: patronage/bubs-next
Q2 2023 - Version 1.4.0
1.4.0 (2023-08-10)
This is primarily a dependency update release:
- Bump WP to 6.2
- Bump Next to 13.4
- Bump Bootstrap to 5.3
Features
One refactor in this release is to have our WordPress API functions accept options instead of function arguments. This allows flexibility when you need to pass in additional parameters -- something we've used in multilingual and multisite implementations. We also slightly adjusted the syntax of the exports in constants.js to export CONFIG AND THEME objects. These are then retrieved via const SETTINGS = getSettings({});
. Again this is paving the way for more advanced configurations.
Bug Fixes
Q1 2023 - Version 1.3.0
This primarily a maintenance and bug fix release centered around updating Next to 13.1, and WordPress to version 6.1.
New Features
Super Editor User Role
We’ve added a new “Super Editor” user role in WordPress which can be helpful for giving someone full editing privileges, without the ability to customize permalinks, or add plugins. Either of those tend to have frustrating results on headless WP sites.
Manual Changes
Next 13 and Node 18
With these new versions, there are several things you’ll need to manually update:
- Update
.nvmrc
and yourpackage.json
engines.node
variables to Node 18. - the Link component no longer likes
<a>
children. See this article, and run the codemod. - the Image component has been rewritten. In our main repo we’ve updated to the new format, but upgrades might benefit from sticking with the legacy images (there is a codemod) — see the next docs.
- You may see local dev hydration errors as documented here.These are related to React 18.
Update functions.php and point to dashboard-customize.php
We’ve renamed dashboard-preview.php to dashboard-customize.php to better reflect what the file is doing. This file has a few bug-fixes to better take editors to their site, and allows for a docs_link to be defined in version control (in functions.php) should you want to link up external documentation.
ContentNode check
Previously, we would every request as if it were a contentNode. When it was a different type (for example a termNode for a taxonomy), we’d get a 500 error, which would trigger graphql notifications with Stellate.
This PR adds an additional check inside of getStaticContent which verifies that a pathname is actually a contentNode before we try querying contentNode for that path. It will require a manual patch to your [[..slug.js]]
https://github.com/patronage/bubs-next/pull/256/files
Renaming Wordpress ENV Variables
While not required, we recommend updating the syntax of your lib/constants file to allow for NEXT_PUBLIC_
prefixed variables, and to update yours. This fixes bugs in client-side components that need them, namely preview mode, but also future components that will fetch data client side.
What's Changed
- Db export task, use env vars by @ccorda in #232
- feat: super editor role that allows for safe permissions in headless wp by @ccorda in #233
- using our new db script, updating docs and tasks to use by @ccorda in #237
- in local dev, grab image from remote host if not found locally by @ccorda in #247
- Wp 6.1 by @ccorda in #252
- switch wpe target from master to main by @ccorda in #254
- don't restart docker containers by @ccorda in #257
- 404 check before trying to grab the current file by @ccorda in #260
- feat: NPM/Yarn Dependency Pinning by @kylehotchkiss in #259
- chore: wpgraphql.php cleaned up/updated with helpful examples by @kylehotchkiss in #262
- refactor: don't duplicate data in props by @ccorda in #258
- feat: default robots.txt for wordpress by @ccorda in #263
- chore: Update to Node 18, Next 13, remove , fix lingering eslint issues by @kylehotchkiss in #261
- fix: use public versions of wp env vars by @ccorda in #253
- fix: upstream dashbaord customizations so title is preserved by @ccorda in #272
- fix: nodeByUri/graphcdn fix by @kylehotchkiss in #256
Full Changelog: v1.2.0...v1.3.0
Q2 2022 - Version 1.2.0
In this release we’ve updated Next to 12.1, and WordPress to version 6.0.
Features
Sitemaps, RSS Feeds and Robots.txt
To implement sitemaps, we’ve built a simple proxy that pulls in the sitemap output by Yoast SEO in WordPress. We found this approach simpler than coding sitemaps ourselves in Next, and offer editors an interface to manage via Yoast, and a wide variety of plugins.
We’re using a similar approach to pull in RSS feeds.
We’ve also introduced a dynamic robots.txt file that will set allow or disallow rules depending on whether you’re in production or staging.
Manual Changes
Caching Fix
Previous versions had a bug where once a page entered the cache, it wouldn’t update if the underlying post was published or removed. In any [[..slug]].js
routes, you’ll want to update the return to include properties for revalidate and an empty props object:
if (!preview && !data?.contentNode?.slug) {
return {
notFound: true,
revalidate: 60,
props: {},
};
}
Simplified ESLint
We now have a simpler ESLint setup more aligned with the default eslint-config-next
.
In your package.json, you can remove any other eslint packages, then replace with:
"eslint": "^8.17.0",
"eslint-config-next": "^12.1.6",
"eslint-config-prettier": "^8.5.0",
Then you’ll also want to run this command to grab the latest configs:rsync -a ../bubs-next/website/(.eslintrc.json|.stylelintrc.json|.prettierrc) website
Stylelint 14
VS Code Stylelint now requires version 14.
We’ve made a few changes to .vscode/settings.json
to reflect this you’ll want to copy over.
Additionally, you’ll need to yarn add postcss
since it’s not bundled
Bug Fixes
Q4 2021
Features
- bumping husky to version 7 (#179) (9558618)
- log wp admin users into front-end preview mode (#173) (cd143c4)
- new convenience plugins in wordpress admin (#166) (81e95b8)
- Next 12 upgrade (#180) (c6f5dcd)
- theme mod instead of acf options for preview mode url (#163) (65bf637), closes #162
- wordpress: 📦 Upgrade Wordpress to 5.5.3; upgrade other WP plugins. (0a6d5c9)
Bug Fixes
- bug where prettier wasn't formatting JS files. (c5ce6c5), closes #95
- don't include privacy scaffold, it sometimes forgets to be removed (4722e4a)
- Get stylelint working again (#182) (d3d73ca)
- meta not respecting social variables, customized title (#176) (c041759), closes #174 #172 #177 #183
- vscode eslint plugin wasn't picking up next config without specifying directory (020f378)
Breaking Changes
Next 12
See the Next docs to be aware of all changes in version 12.
The one we’ve run into the most is their change from wrapping next/image
with a span from a div. We’ve targeted this element in SCSS files before, and needed to manually update.
Redirects
To make our redirects more DRY (and the logic easier to fix bugs with), we have a new lib/checkRedirects.js
file. To use, you’ll need to make slight changes to any ..slug.js
files (example).
We’ve also added cache expiration when redirects change. You’ll want to add the custom variables to your functions.php
, then you can simply drop in an updated webhooks.php
Add to functions.php
:
// webhook config
$headless_webhooks_password_protected = true;
$headless_webhooks_graphcdn_purge_api = 'http://host.docker.internal:3000/api/graphcdn/'; // Docker to host computer endpoint
$headless_webhooks_acf_options = ['acf-options-theme-settings'];
$headless_webhooks_post_types = ['page', 'post'];
$headless_webhooks_redirects_redirection = true;
$headless_webhooks_redirects_yoast = false;
Stylelint Upgrade and VS Code
VS Code made changes that require an updated stylelint. We’ve made these changes, but there is one you’ll need to make to your package.json: cd website && yarn add stylelint-config-standard-scss -D && yarn remove styleint-config-standard
Graphql restructure
We’ve moved lib/wordpress.js
to lib/wordpress/index.js
, and now import customizable queryContent.js
and queryGlobals.js
files. This allows us to separate bubs-next scaffolding from per project customizations.
To upgrade, you’ll want to clone the structure from a recent version of bubs-next, and copy your specific graphql the content and global files. If you’ve customized more heavily and written additional custom queries, you’ll need to incorporate those as well.
Husky 7
See the Husky docs for steps on upgrading: https://typicode.github.io/husky/#/?id=migrate-from-v4-to-v7
At a minimum, you’ll want to copy over the .husky folder (a part of our automated instructions), and add this line to scripts: "prepare": "cd .. && husky install website/.husky && chmod ug+x website/.husky/* || true"
.
You can also remove any legacy husky code, e.g. this block:
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"post-merge": "./.githooks/post-merge.sh"
}
},