Skip to content

Commit 976888c

Browse files
authored
Merge branch 'main' into michalpiechowiak/frb-1363-nextjs-i18n-middleware-redirect-not-working
2 parents f9e7f3a + be952a7 commit 976888c

File tree

3 files changed

+74
-48
lines changed

3 files changed

+74
-48
lines changed

package-lock.json

+43-43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
"devDependencies": {
5151
"@fastly/http-compute-js": "1.1.4",
5252
"@netlify/blobs": "^8.0.1",
53-
"@netlify/build": "^29.54.7",
53+
"@netlify/build": "^29.54.8",
5454
"@netlify/edge-bundler": "^12.2.3",
5555
"@netlify/edge-functions": "^2.11.0",
5656
"@netlify/eslint-config-node": "^7.0.1",
5757
"@netlify/functions": "^2.8.2",
58-
"@netlify/serverless-functions-api": "^1.27.0",
59-
"@netlify/zip-it-and-ship-it": "^9.39.5",
58+
"@netlify/serverless-functions-api": "^1.28.1",
59+
"@netlify/zip-it-and-ship-it": "^9.39.6",
6060
"@opentelemetry/api": "^1.8.0",
6161
"@opentelemetry/exporter-trace-otlp-http": "^0.51.0",
6262
"@opentelemetry/resources": "^1.24.0",

tests/utils/next-version-helpers.mjs

+28-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { readFile, writeFile } from 'node:fs/promises'
44

55
import fg from 'fast-glob'
6-
import { gte, satisfies, valid } from 'semver'
6+
import { coerce, gt, gte, satisfies, valid } from 'semver'
77
import { execaCommand } from 'execa'
88

99
const FUTURE_NEXT_PATCH_VERSION = '14.999.0'
@@ -105,10 +105,36 @@ export async function setNextVersionInFixture(
105105
const nextPeerDependencies = JSON.parse(stdout)
106106

107107
if (updateReact && nextVersionRequiresReact19(checkVersion)) {
108+
// canaries started reporting peerDependencies as `^18.2.0 || 19.0.0-rc-<hash>-<date>`
109+
// with https://github.com/vercel/next.js/pull/70219 which is valid range for package managers
110+
// but not for @nx/next which checks dependencies and tries to assure that at least React 18 is used
111+
// but the check doesn't handle the alternative in version selector which thinks it's not valid:
112+
// https://github.com/nrwl/nx/blob/8fa7065cf14df6a90896442f90659b00baa1b5b9/packages/next/src/executors/build/build.impl.ts#L48
113+
// https://github.com/nrwl/nx/blob/8fa7065cf14df6a90896442f90659b00baa1b5b9/packages/devkit/src/utils/semver.ts#L17
114+
// so to workaround this nx/next issue we modify next peerDeps to extract highest version alternative to use
115+
const nextReactPeerDependency = nextPeerDependencies['react'] ?? '^18.2.0'
116+
const highestNextReactPeerDependencySelector = nextReactPeerDependency
117+
.split('||')
118+
.map((alternative) => {
119+
const selector = alternative.trim()
120+
const coerced = coerce(selector)?.format()
121+
return {
122+
selector,
123+
coerced,
124+
}
125+
})
126+
.sort((a, b) => {
127+
return gt(a.coerced, b.coerced) ? -1 : 1
128+
})[0].selector
129+
108130
const reactVersion =
109-
operation === 'update' ? nextPeerDependencies['react'] : REACT_18_VERSION
131+
operation === 'update' ? highestNextReactPeerDependencySelector : REACT_18_VERSION
110132
packageJson.dependencies.react = reactVersion
111133
packageJson.dependencies['react-dom'] = reactVersion
134+
135+
if (!silent) {
136+
console.log(`${logPrefix}▲ Setting react(-dom)@${reactVersion}`)
137+
}
112138
}
113139

114140
await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n')

0 commit comments

Comments
 (0)