-
Notifications
You must be signed in to change notification settings - Fork 98
fix: compatability for [email protected] #3300
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
Changes from 4 commits
f6c7490
4a44ca3
12380a4
4c0edcd
c22d123
dc9fe45
00c8d5e
5e9f2af
222c189
7355322
ccf79b7
0b6bf13
e77689b
5aa4654
23265fb
358727b
2dc2d3f
291e879
ee2e0d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,6 +106,10 @@ export const createFixture = async (fixture: string, ctx: FixtureTestContext) => | |
| delete globalThis[Symbol.for('next-patch')] | ||
| } | ||
|
|
||
| // due to changes in https://github.com/vercel/next.js/pull/86591 , this global is specific to instance of application and we to clean it up | ||
| // from any previous function invocations that might have run in the same process | ||
| delete globalThis[Symbol.for('next.server.manifests')] | ||
|
|
||
|
Comment on lines
+109
to
+112
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is integration test setup - only change, doesn't impact deployed apps |
||
| ctx.cwd = await mkdtemp(join(tmpdir(), 'opennextjs-netlify-')) | ||
| vi.spyOn(process, 'cwd').mockReturnValue(ctx.cwd) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| import { readFile, writeFile } from 'node:fs/promises' | ||
|
|
||
| import fg from 'fast-glob' | ||
| import { coerce, gt, gte, satisfies, valid } from 'semver' | ||
| import { coerce, gt, gte, parse as parseSemver, satisfies, valid } from 'semver' | ||
| import { execaCommand } from 'execa' | ||
|
|
||
| const FUTURE_NEXT_PATCH_VERSION = '16.999.0' | ||
|
|
@@ -193,7 +193,7 @@ export async function setNextVersionInFixture( | |
| const nextPeerDependencies = JSON.parse(stdout) | ||
|
|
||
| if (updateReact && nextVersionRequiresReact19(checkVersion)) { | ||
| // canaries started reporting peerDependencies as `^18.2.0 || 19.0.0-rc-<hash>-<date>` | ||
| // canaries started reporting peerDependencies as `^18.2.0 || 19.0.0-rc-<hash>-<date> || ^19.0.0` | ||
| // with https://github.com/vercel/next.js/pull/70219 which is valid range for package managers | ||
| // but not for @nx/next which checks dependencies and tries to assure that at least React 18 is used | ||
| // but the check doesn't handle the alternative in version selector which thinks it's not valid: | ||
|
|
@@ -205,14 +205,22 @@ export async function setNextVersionInFixture( | |
| .split('||') | ||
| .map((alternative) => { | ||
| const selector = alternative.trim() | ||
| const coerced = coerce(selector)?.format() | ||
| // we need to pick the highest version from alternatives and to handle | ||
| // comparison of both range selectors (^) and pinned prerelease version (-rc-<hash>-<date>) | ||
| // we need to use couple of tricks: | ||
| // 1. we do try to parse semver - this only works for pinned versions and will handle prereleases, it will return null for ranges | ||
| // 2. if parsing returns null, we coerce | ||
| // this will allow us to preserve prerelease identifiers for comparisons (as coercing prerelease version strip those) | ||
|
|
||
| const versionToCompare = (parseSemver(selector) ?? coerce(selector))?.format() | ||
|
Comment on lines
+208
to
+215
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not actually solving a particular problem (actually it doesn't solve any I could see), but as I was debugging I failures I did notice we were using react 19 rc instead of stable for our tests against next versions that allowed stable 19. The rc was over a year old and unlikely that would be used by users, so this is mostly to increase confidence in results. |
||
|
|
||
| return { | ||
| selector, | ||
| coerced, | ||
| versionToCompare, | ||
| } | ||
| }) | ||
| .sort((a, b) => { | ||
| return gt(a.coerced, b.coerced) ? -1 : 1 | ||
| return gt(a.versionToCompare, b.versionToCompare) ? -1 : 1 | ||
| })[0].selector | ||
|
|
||
| const reactVersion = | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.