Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
61fa3c63
Unverified
Commit
61fa3c63
authored
Feb 25, 2026
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Feb 25, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[sync-react] Allow syncing from a React commit (#90283)
parent
09135201
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
9 deletions
+67
-9
sync-react.js
scripts/sync-react.js
+67
-9
No files found.
scripts/sync-react.js
View file @
61fa3c63
...
@@ -19,6 +19,8 @@ const yargs = require('yargs')
...
@@ -19,6 +19,8 @@ const yargs = require('yargs')
//
//
// Sync from a local checkout of React (requires having React built first):
// Sync from a local checkout of React (requires having React built first):
// pnpm run sync-react --version /path/to/react/checkout/
// pnpm run sync-react --version /path/to/react/checkout/
// Sync from a React commit (can be a commit on a PR)
// pnpm run sync-react --version vp:///commit-sha
const
repoOwner
=
'vercel'
const
repoOwner
=
'vercel'
const
repoName
=
'next.js'
const
repoName
=
'next.js'
...
@@ -57,6 +59,9 @@ async function getSchedulerVersion(reactVersion) {
...
@@ -57,6 +59,9 @@ async function getSchedulerVersion(reactVersion) {
if
(
reactVersion
.
startsWith
(
'file://'
))
{
if
(
reactVersion
.
startsWith
(
'file://'
))
{
return
reactVersion
return
reactVersion
}
}
if
(
reactVersion
.
startsWith
(
'vp:'
))
{
return
reactVersion
}
const
url
=
`https://registry.npmjs.org/react-dom/
${
reactVersion
}
`
const
url
=
`https://registry.npmjs.org/react-dom/
${
reactVersion
}
`
const
response
=
await
fetch
(
url
,
{
const
response
=
await
fetch
(
url
,
{
...
@@ -84,6 +89,14 @@ function getPackageVersion(packageName, versionStr) {
...
@@ -84,6 +89,14 @@ function getPackageVersion(packageName, versionStr) {
if
(
versionStr
.
startsWith
(
'file://'
))
{
if
(
versionStr
.
startsWith
(
'file://'
))
{
return
new
URL
(
packageName
,
versionStr
).
href
return
new
URL
(
packageName
,
versionStr
).
href
}
}
if
(
versionStr
.
startsWith
(
'vp:'
))
{
const
{
pathname
}
=
new
URL
(
versionStr
)
const
[,
commit
,
releaseChannel
]
=
pathname
.
split
(
'/'
)
return
new
URL
(
`/react/commits/
${
commit
}
/
${
packageName
}
@
${
releaseChannel
}
`
,
'https://vercel-packages.vercel.app'
).
href
}
return
`npm:
${
packageName
}
@
${
versionStr
}
`
return
`npm:
${
packageName
}
@
${
versionStr
}
`
}
}
...
@@ -139,10 +152,14 @@ async function sync({ channel, newVersionStr, noInstall }) {
...
@@ -139,10 +152,14 @@ async function sync({ channel, newVersionStr, noInstall }) {
// TODO: Should be handled like the other React packages
// TODO: Should be handled like the other React packages
devDependencies
[
'react-is-builtin'
]
=
newVersionStr
.
startsWith
(
'file://'
)
devDependencies
[
'react-is-builtin'
]
=
newVersionStr
.
startsWith
(
'file://'
)
?
new
URL
(
'react-is'
,
newVersionStr
).
href
?
new
URL
(
'react-is'
,
newVersionStr
).
href
:
`npm:react-is@
${
newVersionStr
}
`
:
newVersionStr
.
startsWith
(
'vp:'
)
?
getPackageVersion
(
'react-is'
,
newVersionStr
)
:
`npm:react-is@
${
newVersionStr
}
`
pnpmOverrides
[
'react-is'
]
=
newVersionStr
.
startsWith
(
'file://'
)
pnpmOverrides
[
'react-is'
]
=
newVersionStr
.
startsWith
(
'file://'
)
?
new
URL
(
'react-is'
,
newVersionStr
).
href
?
new
URL
(
'react-is'
,
newVersionStr
).
href
:
`npm:react-is@
${
newVersionStr
}
`
:
newVersionStr
.
startsWith
(
'vp:'
)
?
getPackageVersion
(
'react-is'
,
newVersionStr
)
:
`npm:react-is@
${
newVersionStr
}
`
}
}
await
fsp
.
writeFile
(
await
fsp
.
writeFile
(
...
@@ -170,6 +187,32 @@ function extractInfoFromReactVersion(versionStr) {
...
@@ -170,6 +187,32 @@ function extractInfoFromReactVersion(versionStr) {
sha
:
'local'
,
sha
:
'local'
,
}
}
}
}
if
(
versionStr
.
startsWith
(
'vp:'
))
{
const
{
pathname
}
=
new
URL
(
versionStr
)
const
[,
commit
]
=
pathname
.
split
(
'/'
)
return
{
dateString
:
new
Date
().
toISOString
().
split
(
'T'
)[
0
],
releaseLabel
:
'vercel-packages'
,
semverVersion
:
'0.0.0'
,
sha
:
commit
,
}
}
if
(
versionStr
.
startsWith
(
'https:'
))
{
const
url
=
new
URL
(
versionStr
)
if
(
url
.
hostname
===
'vercel-packages.vercel.app'
)
{
// e.g https://vercel-packages.vercel.app/react/commits/bc50ab4bffa17f507386554a8ef3c3ed4f37fe1b/react@canary
const
[,
,
,
commit
]
=
url
.
pathname
.
split
(
'/'
)
return
{
dateString
:
new
Date
().
toISOString
().
split
(
'T'
)[
0
],
releaseLabel
:
`vercel-packages`
,
semverVersion
:
'0.0.0'
,
sha
:
commit
,
}
}
throw
new
Error
(
`Unsupported URL '
${
versionStr
}
'. Only vercel-packages.vercel.app URLs are supported.`
)
}
const
match
=
versionStr
.
match
(
const
match
=
versionStr
.
match
(
/
(?<
semverVersion>.*
)
-
(?<
releaseLabel>.*
)
-
(?<
sha>.*
)
-
(?<
dateString>.*
)
$/
/
(?<
semverVersion>.*
)
-
(?<
releaseLabel>.*
)
-
(?<
sha>.*
)
-
(?<
dateString>.*
)
$/
...
@@ -276,7 +319,12 @@ async function main() {
...
@@ -276,7 +319,12 @@ async function main() {
'Creates commits for each intermediate step. Useful to create better diffs for GitHub.'
,
'Creates commits for each intermediate step. Useful to create better diffs for GitHub.'
,
})
})
.
options
(
'install'
,
{
default
:
true
,
type
:
'boolean'
})
.
options
(
'install'
,
{
default
:
true
,
type
:
'boolean'
})
.
options
(
'version'
,
{
default
:
null
,
type
:
'string'
}).
argv
.
options
(
'version'
,
{
default
:
null
,
type
:
'string'
,
description
:
'e.g. 19.3.0-canary-?-? or vp:///commit-sha for a build from a specific React commit (can be a commit on a PR)'
,
}).
argv
let
{
actor
,
createPull
,
commit
,
install
,
version
}
=
argv
let
{
actor
,
createPull
,
commit
,
install
,
version
}
=
argv
if
(
version
!==
null
&&
version
.
startsWith
(
'/'
))
{
if
(
version
!==
null
&&
version
.
startsWith
(
'/'
))
{
version
=
pathToFileURL
(
version
).
href
version
=
pathToFileURL
(
version
).
href
...
@@ -334,12 +382,19 @@ Or, run this command with no arguments to use the most recently published versio
...
@@ -334,12 +382,19 @@ Or, run this command with no arguments to use the most recently published versio
`
`
)
)
}
}
const
{
sha
:
newSha
,
dateString
:
newDateString
}
=
newVersionInfo
const
{
sha
:
newSha
,
const
branchName
=
newVersionStr
.
startsWith
(
'file://'
)
dateString
:
newDateString
,
?
// left to user to name their local sync branch
releaseLabel
,
`update/react/local`
}
=
newVersionInfo
:
`update/react/
${
newVersionStr
}
`
const
branchName
=
releaseLabel
===
'local'
?
// left to user to name their local sync branch
`update/react/local`
:
releaseLabel
===
'vercel-packages'
?
`update/react/remote/vercel-packages/
${
newSha
}
`
:
`update/react/
${
newVersionStr
}
`
if
(
createPull
)
{
if
(
createPull
)
{
const
{
exitCode
,
all
,
command
}
=
await
execa
(
const
{
exitCode
,
all
,
command
}
=
await
execa
(
'git'
,
'git'
,
...
@@ -381,6 +436,9 @@ Or, run this command with no arguments to use the most recently published versio
...
@@ -381,6 +436,9 @@ Or, run this command with no arguments to use the most recently published versio
if
(
version
!==
null
&&
version
.
startsWith
(
'file://'
))
{
if
(
version
!==
null
&&
version
.
startsWith
(
'file://'
))
{
experimentalNewVersionStr
=
new
URL
(
'build/oss-experimental/'
,
version
).
href
experimentalNewVersionStr
=
new
URL
(
'build/oss-experimental/'
,
version
).
href
newVersionStr
=
new
URL
(
'build/oss-stable/'
,
version
).
href
newVersionStr
=
new
URL
(
'build/oss-stable/'
,
version
).
href
}
else
if
(
releaseLabel
===
'vercel-packages'
)
{
experimentalNewVersionStr
=
`vp:///
${
newSha
}
/experimental`
newVersionStr
=
`vp:///
${
newSha
}
/canary`
}
}
await
sync
({
await
sync
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment