Skip to content

Commit 77552f7

Browse files
ahuseynjosephfusco
andauthored
chore: Update starter example (#2268)
* update packages * migrate example into Nextjs v16 * implement multiple queries into starter example * revert @wordpress/block-library upgrade, due to npm issue * upgrade node version in for the bundle analysis workflow * add default values to the queries * fix(ci): resolve Next.js 16 CI failures for starter example Pin @wordpress/block-library to exact 9.10.0 to prevent SCSS import breakage in E2E tests, add --webpack flag to bundle analysis build for Turbopack compatibility, and drop Node 18 from E2E matrix to match engines requirement. * fix(starter): remove dead :global block to fix CSS Modules purity error The :global(.component *) block in ContentWrapper.module.scss targeted the literal un-mangled class .component, while ContentWrapper.js applies the mangled CSS module class — so these styles never matched. The block styles already work via global.scss importing _blocks.scss. Simply removing the dead :global block fixes the Next.js 16 purity error without needing any webpack overrides. --------- Co-authored-by: Joe Fusco <hello@josephfus.co>
1 parent 7b05d91 commit 77552f7

18 files changed

Lines changed: 707 additions & 4370 deletions

File tree

.github/workflows/e2e-next-faustwp-example.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
PR_BRANCH: ${{github.event.pull_request.head.ref}}
1515
strategy:
1616
matrix:
17-
node: ['18', '20', '22']
17+
node: ['20', '22']
1818
defaults:
1919
run:
2020
working-directory: ./

.github/workflows/nextjs-bundle-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Install Node.js
3636
uses: actions/setup-node@v4
3737
with:
38-
node-version: 18
38+
node-version: 20
3939

4040
- name: Install bundle analyzer dependency globally
4141
run: npm install -g @next/bundle-analyzer
@@ -79,7 +79,7 @@ jobs:
7979

8080
- name: Build Next.js example app
8181
working-directory: ${{ matrix.next-dir }}
82-
run: npm run build
82+
run: npm run build -- --webpack
8383

8484
# Here's the first place where next-bundle-analysis' own script is used
8585
# This step pulls the raw bundle stats for the current bundle

examples/next/faustwp-getting-started/components/ContentWrapper/ContentWrapper.module.scss

Lines changed: 0 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -2,133 +2,4 @@
22
max-width: var(--wpe--content--max-width);
33
margin: 0 auto;
44
line-height: 1.6875;
5-
6-
:global {
7-
// Scope WordPress block styles within ContentWrapper.
8-
@import 'styles/blocks';
9-
10-
* {
11-
max-width: 100%;
12-
}
13-
14-
figure {
15-
margin-left: 0;
16-
margin-right: 0;
17-
}
18-
19-
h1,
20-
h2,
21-
h3,
22-
h4,
23-
h5,
24-
h6 {
25-
margin: 4.8rem 0;
26-
}
27-
28-
strong {
29-
font-weight: 700;
30-
}
31-
32-
a {
33-
color: var(--wpe--link--color);
34-
text-decoration: underline;
35-
36-
&:hover,
37-
&:focus {
38-
color: var(--wpe--link--color);
39-
text-decoration: none;
40-
}
41-
}
42-
43-
li {
44-
font-size: 1.6rem;
45-
}
46-
47-
img {
48-
display: block;
49-
height: auto;
50-
max-width: 100%;
51-
}
52-
53-
.alignleft {
54-
display: inline;
55-
float: left;
56-
margin-right: 1.5em;
57-
}
58-
59-
.alignright {
60-
display: inline;
61-
float: right;
62-
margin-left: 1.5em;
63-
}
64-
65-
.aligncenter {
66-
clear: both;
67-
display: block;
68-
margin-left: auto;
69-
margin-right: auto;
70-
}
71-
72-
code,
73-
pre {
74-
color: var(--color-white);
75-
background: var(--color-black);
76-
}
77-
78-
code {
79-
padding: 0.25rem 0.5rem;
80-
}
81-
82-
pre {
83-
max-width: 100%;
84-
overflow: auto;
85-
padding: 1rem;
86-
}
87-
88-
blockquote {
89-
border-top: 1px solid var(--color-black);
90-
border-bottom: 1px solid var(--color-black);
91-
font-style: italic;
92-
margin-top: 0;
93-
margin-left: 0;
94-
margin-right: 0;
95-
padding: 4rem 1rem 4rem;
96-
text-align: center;
97-
98-
&::before {
99-
content: '';
100-
display: block;
101-
font-size: 6rem;
102-
line-height: 0;
103-
margin: 2rem 0;
104-
}
105-
106-
> *:last-child {
107-
margin-bottom: 0;
108-
}
109-
}
110-
111-
table {
112-
border-collapse: collapse;
113-
width: 100%;
114-
}
115-
116-
thead th {
117-
border-bottom: 1px solid var(--wpe--color--border);
118-
padding-bottom: 0.5em;
119-
}
120-
121-
th {
122-
padding: 0.4rem 0;
123-
text-align: left;
124-
}
125-
126-
tr {
127-
border-bottom: 1px solid var(--wpe--color--border);
128-
}
129-
130-
td {
131-
padding: 0.4em;
132-
}
133-
}
1345
}

examples/next/faustwp-getting-started/components/EntryHeader/EntryHeader.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import 'styles/breakpoints';
1+
@import '../../styles/breakpoints';
22

33
.component {
44
color: var(--wpe--color--white);

examples/next/faustwp-getting-started/components/Header/Header.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import 'styles/breakpoints';
1+
@import '../../styles/breakpoints';
22

33
.component {
44
color: var(--wpe--header--color);

examples/next/faustwp-getting-started/components/Hero/Hero.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "styles/breakpoints";
1+
@import "../../styles/breakpoints";
22

33
.component {
44
text-align: center;

examples/next/faustwp-getting-started/components/NavigationMenu/NavigationMenu.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import 'styles/breakpoints';
1+
@import '../../styles/breakpoints';
22

33
%visible {
44
visibility: visible;

examples/next/faustwp-getting-started/components/NavigationMenu/NavigationMenuClassesFromWP.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Classes in this file can be optionally added to menu items from within WordPress.
22
// Appearance --> Menus --> Screen Options --> CSS Classes
33

4-
@import 'styles/breakpoints';
4+
@import '../../styles/breakpoints';
55

66
.button {
77
a {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { gql } from '@apollo/client';
2+
import { BlogInfoFragment } from './GeneralSettings';
3+
import { NavigationMenu } from '../components';
4+
5+
export const GET_LAYOUT_QUERY = gql`
6+
${BlogInfoFragment}
7+
${NavigationMenu.fragments.entry}
8+
query GetLayout(
9+
$headerLocation: MenuLocationEnum
10+
$footerLocation: MenuLocationEnum
11+
) {
12+
generalSettings {
13+
...BlogInfoFragment
14+
}
15+
headerMenuItems: menuItems(where: { location: $headerLocation }) {
16+
nodes {
17+
...NavigationMenuItemFragment
18+
}
19+
}
20+
footerMenuItems: menuItems(where: { location: $footerLocation }) {
21+
nodes {
22+
...NavigationMenuItemFragment
23+
}
24+
}
25+
}
26+
`;

examples/next/faustwp-getting-started/next.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ const { createSecureHeaders } = require('next-secure-headers');
77
module.exports = withFaust({
88
reactStrictMode: true,
99
sassOptions: {
10-
includePaths: ['node_modules'],
10+
includePaths: ['node_modules', '.'],
1111
},
1212
images: {
13-
domains: [getWpHostname()],
13+
remotePatterns: [
14+
{
15+
hostname: getWpHostname(),
16+
},
17+
],
1418
},
1519
i18n: {
1620
locales: ['en'],

0 commit comments

Comments
 (0)