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
8a390fbf
Unverified
Commit
8a390fbf
authored
Apr 25, 2026
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Apr 25, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ci] Handle namespaced packages in preview builds (#93241)
parent
854fdb03
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
11 deletions
+48
-11
upload-preview-tarballs.js
scripts/upload-preview-tarballs.js
+48
-11
No files found.
scripts/upload-preview-tarballs.js
View file @
8a390fbf
...
@@ -3,6 +3,50 @@ const { put } = require('@vercel/blob')
...
@@ -3,6 +3,50 @@ const { put } = require('@vercel/blob')
const
fs
=
require
(
'node:fs/promises'
)
const
fs
=
require
(
'node:fs/promises'
)
const
path
=
require
(
'node:path'
)
const
path
=
require
(
'node:path'
)
/**
* Yields one entry per package tarball under `tarballDirectory`. Scoped
* packages are laid out one level deeper (e.g. `@next/env/<name>.tgz`), so the
* walk descends into any directory whose name starts with `@`.
*
* @param {string} tarballDirectory
* @returns {AsyncGenerator<{ packageName: string, tarballPath: string }>}
*/
async
function
*
findTarballs
(
tarballDirectory
)
{
const
entries
=
await
fs
.
readdir
(
tarballDirectory
,
{
withFileTypes
:
true
})
for
(
const
entry
of
entries
)
{
if
(
!
entry
.
isDirectory
())
continue
const
entryPath
=
path
.
join
(
tarballDirectory
,
entry
.
name
)
if
(
entry
.
name
.
startsWith
(
'@'
))
{
const
scopeEntries
=
await
fs
.
readdir
(
entryPath
,
{
withFileTypes
:
true
})
for
(
const
scopeEntry
of
scopeEntries
)
{
if
(
!
scopeEntry
.
isDirectory
())
continue
const
tarballPath
=
await
findTarballInDir
(
path
.
join
(
entryPath
,
scopeEntry
.
name
)
)
if
(
tarballPath
===
null
)
continue
yield
{
packageName
:
`
${
entry
.
name
}
/
${
scopeEntry
.
name
}
`
,
tarballPath
,
}
}
}
else
{
const
tarballPath
=
await
findTarballInDir
(
entryPath
)
if
(
tarballPath
===
null
)
continue
yield
{
packageName
:
entry
.
name
,
tarballPath
}
}
}
}
/**
* @param {string} dir
* @returns {Promise<string | null>}
*/
async
function
findTarballInDir
(
dir
)
{
const
files
=
await
fs
.
readdir
(
dir
)
const
tgzFile
=
files
.
find
((
f
)
=>
f
.
endsWith
(
'.tgz'
))
return
tgzFile
?
path
.
join
(
dir
,
tgzFile
)
:
null
}
async
function
main
()
{
async
function
main
()
{
const
[
githubHeadSha
,
tarballDirectory
]
=
process
.
argv
.
slice
(
2
)
const
[
githubHeadSha
,
tarballDirectory
]
=
process
.
argv
.
slice
(
2
)
if
(
!
githubHeadSha
||
!
tarballDirectory
)
{
if
(
!
githubHeadSha
||
!
tarballDirectory
)
{
...
@@ -15,19 +59,12 @@ async function main() {
...
@@ -15,19 +59,12 @@ async function main() {
throw
new
Error
(
'BLOB_READ_WRITE_TOKEN environment variable is required'
)
throw
new
Error
(
'BLOB_READ_WRITE_TOKEN environment variable is required'
)
}
}
const
packageDirs
=
await
fs
.
readdir
(
tarballDirectory
)
for
await
(
const
{
packageName
,
tarballPath
}
of
findTarballs
(
for
(
const
packageName
of
packageDirs
)
{
tarballDirectory
const
dir
=
path
.
join
(
tarballDirectory
,
packageName
)
))
{
const
stat
=
await
fs
.
stat
(
dir
)
if
(
!
stat
.
isDirectory
())
continue
const
files
=
await
fs
.
readdir
(
dir
)
const
tgzFile
=
files
.
find
((
f
)
=>
f
.
endsWith
(
'.tgz'
))
if
(
!
tgzFile
)
continue
const
blobPathname
=
`next/commits/
${
githubHeadSha
}
/
${
packageName
}
.tgz`
const
blobPathname
=
`next/commits/
${
githubHeadSha
}
/
${
packageName
}
.tgz`
const
fileBuffer
=
await
fs
.
readFile
(
path
.
join
(
dir
,
tgzFile
)
)
const
fileBuffer
=
await
fs
.
readFile
(
tarballPath
)
const
{
url
}
=
await
put
(
blobPathname
,
fileBuffer
,
{
const
{
url
}
=
await
put
(
blobPathname
,
fileBuffer
,
{
access
:
'public'
,
access
:
'public'
,
addRandomSuffix
:
false
,
addRandomSuffix
:
false
,
...
...
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