Skip to content

Commit

Permalink
Merge main into next
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Feb 25, 2025
2 parents 1fd7624 + a666ca3 commit c55b301
Show file tree
Hide file tree
Showing 8 changed files with 223 additions and 0 deletions.
24 changes: 24 additions & 0 deletions demo/build-and-run-site.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Execute this script via `npm run build-and-run-site`
#
# This script builds the site like in the CI and starts it.
#
# Reasons why you want to do this:
# - Check if it builds without warnings
# - Check if there are suggestions from next build
# - Check if it behaves in the same way like the dev-server
# - Check caching behaviour, e.g. Cache-Control header (which is always no-cache in dev-server)

#!/usr/bin/env bash

echo "[1/2] Build site..."
cd site
rm -f .env .env.local .env.site-configs
rm -rf .next
NODE_ENV=production npm run build
ln -sf ../../.env ./
ln -sf ../../.env.local ./
ln -sf ../.env.site-configs ./
echo ""

echo "[2/2] Start site..."
npx dotenv -e .env.secrets -e .env.site-configs -- npm run serve
4 changes: 4 additions & 0 deletions demo/site-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
"graphql-request": "^3.7.0",
"graphql-tag": "^2.12.6",
"next": "^14.2.24",
<<<<<<< HEAD
=======
"pure-react-carousel": "^1.0.0",
>>>>>>> main
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-intl": "^6.8.9",
Expand Down
11 changes: 11 additions & 0 deletions demo/site/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ const nextConfig = {
},
cacheHandler: process.env.REDIS_ENABLED === "true" ? import.meta.resolve("./dist/cache-handler.js").replace("file://", "") : undefined,
cacheMaxMemorySize: process.env.REDIS_ENABLED === "true" ? 0 : undefined, // disable default in-memory caching
rewrites: () => {
return {
afterFiles: [
{
// Show a 404 instead of trying to render page for paths starting with /_next/ or /assets/ as they don't get rewritten in DomainRewriteMiddleware and cause errors in ...path page
source: "/:prefix(_next|assets)/:path*",
destination: "/404",
},
],
};
},
};

export default withBundleAnalyzer(nextConfig);
15 changes: 15 additions & 0 deletions demo/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,28 @@
"@opentelemetry/sdk-node": "^0.53.0",
"cache-manager": "^5.7.6",
"filesize": "^10.1.6",
<<<<<<< HEAD
"graphql": "^15.10.1",
"ioredis": "^5.5.0",
"lru-cache": "^11.0.2",
"next": "^14.2.24",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-intl": "^6.8.9",
=======
"fs-extra": "^9.0.0",
"graphql": "^15.0.0",
"graphql-tag": "^2.12.6",
"ioredis": "^5.4.1",
"lru-cache": "^11.0.1",
"next": "^14.2.24",
"pure-react-carousel": "^1.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-intl": "^6.0.0",
"react-is": "^17.0.2",
"react-select": "^5.8.0",
>>>>>>> main
"redraft": "^0.10.2",
"styled-components": "^6.1.15",
"swiper": "^11.2.4",
Expand Down
10 changes: 10 additions & 0 deletions demo/site/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ app.prepare().then(() => {
};
}

const originalWriteHead = res.writeHead;
res.writeHead = function (statusCode: number, ...args: unknown[]) {
// since writeHead is a callback function, it's called after handle() -> we get the actual response statusCode
if (statusCode >= 400) {
// prevent caching of error responses
res.setHeader("Cache-Control", "private, no-cache, no-store, max-age=0, must-revalidate");
}
return originalWriteHead.apply(this, [statusCode, ...args]);
};

await handle(req, res, parsedUrl);
} catch (err) {
console.error("Error occurred handling", req.url, err);
Expand Down
12 changes: 12 additions & 0 deletions demo/site/src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Link from "next/link";

export default function NotFound404() {
return (
<html lang="en">
<body>
<p>Page not found.</p>
<Link href="/">Return Home</Link>
</body>
</html>
);
}
11 changes: 11 additions & 0 deletions packages/site/cms-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@types/lodash.isequal": "^4.5.8",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
<<<<<<< HEAD
"chokidar-cli": "^3.0.0",
"eslint": "^9.20.1",
"jest": "^29.7.0",
Expand All @@ -49,6 +50,16 @@
"next": "^14.2.24",
"npm-run-all2": "^5.0.2",
"prettier": "^3.5.2",
=======
"chokidar-cli": "^2.0.0",
"eslint": "^8.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-junit": "^15.0.0",
"next": "^14.2.24",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.0",
>>>>>>> main
"react": "^18.3.1",
"react-dom": "^18.3.1",
"styled-components": "^6.1.15",
Expand Down
136 changes: 136 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c55b301

Please sign in to comment.