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
fa42f0db
Unverified
Commit
fa42f0db
authored
May 22, 2024
by
Sebastian Silbermann
Committed by
GitHub
May 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
React sync: Reduce manual tasks (#66095)
parent
8b360afb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
sync-react.js
scripts/sync-react.js
+14
-3
No files found.
scripts/sync-react.js
View file @
fa42f0db
...
@@ -57,6 +57,7 @@ Or, run this command with no arguments to use the most recently published versio
...
@@ -57,6 +57,7 @@ Or, run this command with no arguments to use the most recently published versio
await
fsp
.
readFile
(
path
.
join
(
cwd
,
'package.json'
),
'utf-8'
)
await
fsp
.
readFile
(
path
.
join
(
cwd
,
'package.json'
),
'utf-8'
)
)
)
const
devDependencies
=
pkgJson
.
devDependencies
const
devDependencies
=
pkgJson
.
devDependencies
const
resolutions
=
pkgJson
.
resolutions
const
baseVersionStr
=
devDependencies
[
const
baseVersionStr
=
devDependencies
[
useExperimental
?
'react-experimental-builtin'
:
'react-builtin'
useExperimental
?
'react-experimental-builtin'
:
'react-builtin'
].
replace
(
/^npm:react@/
,
''
)
].
replace
(
/^npm:react@/
,
''
)
...
@@ -93,9 +94,19 @@ Or, run this command with no arguments to use the most recently published versio
...
@@ -93,9 +94,19 @@ Or, run this command with no arguments to use the most recently published versio
)
)
}
}
}
}
for
(
const
[
dep
,
version
]
of
Object
.
entries
(
resolutions
))
{
if
(
version
.
endsWith
(
`
${
baseReleaseLabel
}
-
${
baseSha
}
-
${
baseDateString
}
`
))
{
resolutions
[
dep
]
=
version
.
replace
(
`
${
baseReleaseLabel
}
-
${
baseSha
}
-
${
baseDateString
}
`
,
`
${
newReleaseLabel
}
-
${
newSha
}
-
${
newDateString
}
`
)
}
}
await
fsp
.
writeFile
(
await
fsp
.
writeFile
(
path
.
join
(
cwd
,
'package.json'
),
path
.
join
(
cwd
,
'package.json'
),
JSON
.
stringify
(
pkgJson
,
null
,
2
)
JSON
.
stringify
(
pkgJson
,
null
,
2
)
+
// Prettier would add a newline anyway so do it manually to skip the additional `pnpm prettier-write`
'
\
n'
)
)
console
.
log
(
'Successfully updated React dependencies in package.json.
\
n'
)
console
.
log
(
'Successfully updated React dependencies in package.json.
\
n'
)
...
@@ -117,7 +128,7 @@ Or, run this command with no arguments to use the most recently published versio
...
@@ -117,7 +128,7 @@ Or, run this command with no arguments to use the most recently published versio
}
}
console
.
log
(
'Building vendored React files...
\
n'
)
console
.
log
(
'Building vendored React files...
\
n'
)
const
nccSubprocess
=
execa
(
'pnpm'
,
[
'
taskr'
,
'copy_vendor_react
'
],
{
const
nccSubprocess
=
execa
(
'pnpm'
,
[
'
ncc-compiled
'
],
{
cwd
:
path
.
join
(
cwd
,
'packages'
,
'next'
),
cwd
:
path
.
join
(
cwd
,
'packages'
,
'next'
),
})
})
if
(
nccSubprocess
.
stdout
)
{
if
(
nccSubprocess
.
stdout
)
{
...
@@ -161,7 +172,7 @@ Or, run this command with no arguments to use the most recently published versio
...
@@ -161,7 +172,7 @@ Or, run this command with no arguments to use the most recently published versio
To finish upgrading, complete the following steps:
To finish upgrading, complete the following steps:
- Install the updated dependencies: pnpm install
- Install the updated dependencies: pnpm install
- Build the vendored React files: (inside packages/next dir) pnpm
taskr ncc
- Build the vendored React files: (inside packages/next dir) pnpm
ncc-compiled
Or run this command again without the --no-install flag to do both automatically.
Or run this command again without the --no-install flag to do both automatically.
`
`
...
...
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