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
98a2448e
Unverified
Commit
98a2448e
authored
Jan 19, 2023
by
JJ Kasper
Committed by
GitHub
Jan 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix release stats (#45027)
parent
a4d9373b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
22 deletions
+133
-22
constants.js
.github/actions/next-stats-action/src/constants.js
+2
-2
repo-setup.js
.github/actions/next-stats-action/src/prepare/repo-setup.js
+131
-20
No files found.
.github/actions/next-stats-action/src/constants.js
View file @
98a2448e
...
@@ -5,8 +5,8 @@ const benchTitle = 'Page Load Tests'
...
@@ -5,8 +5,8 @@ const benchTitle = 'Page Load Tests'
const
workDir
=
path
.
join
(
os
.
tmpdir
(),
'next-stats'
)
const
workDir
=
path
.
join
(
os
.
tmpdir
(),
'next-stats'
)
const
mainRepoName
=
'main-repo'
const
mainRepoName
=
'main-repo'
const
diffRepoName
=
'diff-repo'
const
diffRepoName
=
'diff-repo'
const
mainRepoDir
=
path
.
join
(
os
.
tmpdir
()
,
mainRepoName
)
const
mainRepoDir
=
path
.
join
(
workDir
,
mainRepoName
)
const
diffRepoDir
=
path
.
join
(
os
.
tmpdir
()
,
diffRepoName
)
const
diffRepoDir
=
path
.
join
(
workDir
,
diffRepoName
)
const
statsAppDir
=
path
.
join
(
workDir
,
'stats-app'
)
const
statsAppDir
=
path
.
join
(
workDir
,
'stats-app'
)
const
diffingDir
=
path
.
join
(
workDir
,
'diff'
)
const
diffingDir
=
path
.
join
(
workDir
,
'diff'
)
const
yarnEnvValues
=
{
const
yarnEnvValues
=
{
...
...
.github/actions/next-stats-action/src/prepare/repo-setup.js
View file @
98a2448e
...
@@ -55,27 +55,138 @@ module.exports = (actionInfo) => {
...
@@ -55,27 +55,138 @@ module.exports = (actionInfo) => {
}
}
},
},
async
linkPackages
({
repoDir
,
nextSwcVersion
})
{
async
linkPackages
({
repoDir
,
nextSwcVersion
})
{
execa
.
sync
(
'pnpm'
,
[
'turbo'
,
'run'
,
'test-pack'
],
{
let
hasTestPack
=
false
cwd
:
repoDir
,
env
:
{
NEXT_SWC_VERSION
:
nextSwcVersion
},
try
{
})
hasTestPack
=
Boolean
(
((
await
fs
.
readJSON
(
path
.
join
(
repoDir
,
'package.json'
))).
scripts
||
const
pkgPaths
=
new
Map
()
{})[
'test-pack'
]
const
pkgs
=
await
fs
.
readdir
(
path
.
join
(
repoDir
,
'packages'
))
pkgs
.
forEach
((
pkgDirname
)
=>
{
const
{
name
}
=
require
(
path
.
join
(
repoDir
,
'packages'
,
pkgDirname
,
'package.json'
))
pkgPaths
.
set
(
name
,
path
.
join
(
repoDir
,
'packages'
,
pkgDirname
,
`packed-
${
pkgDirname
}
.tgz`
)
)
)
})
}
catch
(
err
)
{
return
pkgPaths
console
.
error
(
err
)
}
if
(
hasTestPack
)
{
execa
.
sync
(
'pnpm'
,
[
'turbo'
,
'run'
,
'test-pack'
],
{
cwd
:
repoDir
,
env
:
{
NEXT_SWC_VERSION
:
nextSwcVersion
},
})
const
pkgPaths
=
new
Map
()
const
pkgs
=
await
fs
.
readdir
(
path
.
join
(
repoDir
,
'packages'
))
pkgs
.
forEach
((
pkgDirname
)
=>
{
const
{
name
}
=
require
(
path
.
join
(
repoDir
,
'packages'
,
pkgDirname
,
'package.json'
))
pkgPaths
.
set
(
name
,
path
.
join
(
repoDir
,
'packages'
,
pkgDirname
,
`packed-
${
pkgDirname
}
.tgz`
)
)
})
return
pkgPaths
}
else
{
// TODO: remove after next stable release (current v13.1.2)
const
pkgPaths
=
new
Map
()
const
pkgDatas
=
new
Map
()
let
pkgs
try
{
pkgs
=
await
fs
.
readdir
(
path
.
join
(
repoDir
,
'packages'
))
}
catch
(
err
)
{
if
(
err
.
code
===
'ENOENT'
)
{
require
(
'console'
).
log
(
'no packages to link'
)
return
pkgPaths
}
throw
err
}
for
(
const
pkg
of
pkgs
)
{
const
pkgPath
=
path
.
join
(
repoDir
,
'packages'
,
pkg
)
const
packedPkgPath
=
path
.
join
(
pkgPath
,
`
${
pkg
}
-packed.tgz`
)
const
pkgDataPath
=
path
.
join
(
pkgPath
,
'package.json'
)
if
(
!
fs
.
existsSync
(
pkgDataPath
))
{
require
(
'console'
).
log
(
`Skipping
${
pkgDataPath
}
`
)
continue
}
const
pkgData
=
require
(
pkgDataPath
)
const
{
name
}
=
pkgData
pkgDatas
.
set
(
name
,
{
pkgDataPath
,
pkg
,
pkgPath
,
pkgData
,
packedPkgPath
,
})
pkgPaths
.
set
(
name
,
packedPkgPath
)
}
for
(
const
pkg
of
pkgDatas
.
keys
())
{
const
{
pkgDataPath
,
pkgData
}
=
pkgDatas
.
get
(
pkg
)
for
(
const
pkg
of
pkgDatas
.
keys
())
{
const
{
packedPkgPath
}
=
pkgDatas
.
get
(
pkg
)
if
(
!
pkgData
.
dependencies
||
!
pkgData
.
dependencies
[
pkg
])
continue
pkgData
.
dependencies
[
pkg
]
=
packedPkgPath
}
// make sure native binaries are included in local linking
if
(
pkg
===
'@next/swc'
)
{
if
(
!
pkgData
.
files
)
{
pkgData
.
files
=
[]
}
pkgData
.
files
.
push
(
'native'
)
require
(
'console'
).
log
(
'using swc binaries: '
,
await
exec
(
`ls
${
path
.
join
(
path
.
dirname
(
pkgDataPath
),
'native'
)}
`
)
)
}
if
(
pkg
===
'next'
)
{
if
(
nextSwcVersion
)
{
Object
.
assign
(
pkgData
.
dependencies
,
{
'@next/swc-linux-x64-gnu'
:
nextSwcVersion
,
})
}
else
{
if
(
pkgDatas
.
get
(
'@next/swc'
))
{
pkgData
.
dependencies
[
'@next/swc'
]
=
pkgDatas
.
get
(
'@next/swc'
).
packedPkgPath
}
else
{
pkgData
.
files
.
push
(
'native'
)
}
}
}
await
fs
.
writeFile
(
pkgDataPath
,
JSON
.
stringify
(
pkgData
,
null
,
2
),
'utf8'
)
}
// wait to pack packages until after dependency paths have been updated
// to the correct versions
await
Promise
.
all
(
Array
.
from
(
pkgDatas
.
keys
()).
map
(
async
(
pkgName
)
=>
{
const
{
pkg
,
pkgPath
}
=
pkgDatas
.
get
(
pkgName
)
await
exec
(
`cd
${
pkgPath
}
&& yarn pack -f '
${
pkg
}
-packed.tgz'`
,
true
)
})
)
return
pkgPaths
}
},
},
}
}
}
}
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