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
249d6691
Commit
249d6691
authored
Dec 03, 2025
by
JJ Kasper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lock binary
parent
fa78fa99
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
571 additions
and
572 deletions
+571
-572
build_and_deploy.yml
.github/workflows/build_and_deploy.yml
+455
-455
index.ts
packages/next/src/build/swc/index.ts
+2
-1
publish-native.js
scripts/publish-native.js
+114
-116
No files found.
.github/workflows/build_and_deploy.yml
View file @
249d6691
...
@@ -107,423 +107,423 @@ jobs:
...
@@ -107,423 +107,423 @@ jobs:
key
:
${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt}}
key
:
${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt}}
# Build binaries for publishing
# Build binaries for publishing
build-native
:
#
build-native:
if
:
${{ needs.deploy-target.outputs.value != 'skipped' }}
#
if: ${{ needs.deploy-target.outputs.value != 'skipped' }}
needs
:
#
needs:
-
deploy-target
#
- deploy-target
defaults
:
#
defaults:
run
:
#
run:
shell
:
bash -leo pipefail {0}
#
shell: bash -leo pipefail {0}
strategy
:
#
strategy:
fail-fast
:
false
#
fail-fast: false
matrix
:
#
matrix:
exclude
:
#
exclude:
# only build the binaries we run automated tests against
#
# only build the binaries we run automated tests against
# linux GNU x64
#
# linux GNU x64
-
settings
:
#
- settings:
target
:
${{ needs.deploy-target.outputs.value == 'automated-preview' && 'aarch64-apple-darwin' }}
#
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'aarch64-apple-darwin' }}
-
settings
:
#
- settings:
target
:
${{ needs.deploy-target.outputs.value == 'automated-preview' && 'aarch64-pc-windows-msvc' }}
#
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'aarch64-pc-windows-msvc' }}
-
settings
:
#
- settings:
target
:
${{ needs.deploy-target.outputs.value == 'automated-preview' && 'aarch64-unknown-linux-gnu' }}
#
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'aarch64-unknown-linux-gnu' }}
-
settings
:
#
- settings:
target
:
${{ needs.deploy-target.outputs.value == 'automated-preview' && 'aarch64-unknown-linux-musl' }}
#
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'aarch64-unknown-linux-musl' }}
-
settings
:
#
- settings:
target
:
${{ needs.deploy-target.outputs.value == 'automated-preview' && 'x86_64-pc-windows-msvc' }}
#
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'x86_64-pc-windows-msvc' }}
-
settings
:
#
- settings:
target
:
${{ needs.deploy-target.outputs.value == 'automated-preview' && 'x86_64-unknown-linux-musl' }}
#
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'x86_64-unknown-linux-musl' }}
-
settings
:
#
- settings:
target
:
${{ needs.deploy-target.outputs.value == 'automated-preview' && 'x86_64-apple-darwin' }}
#
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'x86_64-apple-darwin' }}
settings
:
#
settings:
-
host
:
#
- host:
-
'
self-hosted'
#
- 'self-hosted'
-
'
macos'
#
- 'macos'
-
'
arm64'
#
- 'arm64'
target
:
'
x86_64-apple-darwin'
#
target: 'x86_64-apple-darwin'
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
#
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
# TODO: we should add the relevant envs later to to switch to strict mode
#
# TODO: we should add the relevant envs later to to switch to strict mode
build
:
|
#
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" && corepack enable
#
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" && corepack enable
pnpm dlx turbo@${TURBO_VERSION} run build-native-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target x86_64-apple-darwin
#
pnpm dlx turbo@${TURBO_VERSION} run build-native-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target x86_64-apple-darwin
strip -x packages/next-swc/native/next-swc.*.node
#
strip -x packages/next-swc/native/next-swc.*.node
-
host
:
#
- host:
-
'
self-hosted'
#
- 'self-hosted'
-
'
macos'
#
- 'macos'
-
'
arm64'
#
- 'arm64'
target
:
'
aarch64-apple-darwin'
#
target: 'aarch64-apple-darwin'
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
#
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
# TODO: we should add the relevant envs later to to switch to strict mode
#
# TODO: we should add the relevant envs later to to switch to strict mode
build
:
|
#
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" && corepack enable
#
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" && corepack enable
pnpm dlx turbo@${TURBO_VERSION} run build-native-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target aarch64-apple-darwin
#
pnpm dlx turbo@${TURBO_VERSION} run build-native-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target aarch64-apple-darwin
strip -x packages/next-swc/native/next-swc.*.node
#
strip -x packages/next-swc/native/next-swc.*.node
-
host
:
#
- host:
-
'
self-hosted'
#
- 'self-hosted'
-
'
windows'
#
- 'windows'
-
'
x64'
#
- 'x64'
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
#
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
# TODO: we should add the relevant envs later to to switch to strict mode
#
# TODO: we should add the relevant envs later to to switch to strict mode
build
:
|
#
build: |
corepack enable
#
corepack enable
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}"
#
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}"
pnpm dlx turbo@${TURBO_VERSION} run build-native-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target x86_64-pc-windows-msvc
#
pnpm dlx turbo@${TURBO_VERSION} run build-native-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target x86_64-pc-windows-msvc
target
:
'
x86_64-pc-windows-msvc'
#
target: 'x86_64-pc-windows-msvc'
-
host
:
#
- host:
-
'
self-hosted'
#
- 'self-hosted'
-
'
windows'
#
- 'windows'
-
'
x64'
#
- 'x64'
target
:
'
aarch64-pc-windows-msvc'
#
target: 'aarch64-pc-windows-msvc'
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
#
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
# TODO: we should add the relevant envs later to to switch to strict mode
#
# TODO: we should add the relevant envs later to to switch to strict mode
build
:
|
#
build: |
corepack enable
#
corepack enable
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}"
#
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}"
pnpm dlx turbo@${TURBO_VERSION} run build-native-no-plugin-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target aarch64-pc-windows-msvc
#
pnpm dlx turbo@${TURBO_VERSION} run build-native-no-plugin-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target aarch64-pc-windows-msvc
-
host
:
#
- host:
-
'
self-hosted'
#
- 'self-hosted'
-
'
linux'
#
- 'linux'
-
'
x64'
#
- 'x64'
-
'
metal'
#
- 'metal'
target
:
'
x86_64-unknown-linux-gnu'
#
target: 'x86_64-unknown-linux-gnu'
# [NOTE] If you want to update / modify build steps, check these things:
#
# [NOTE] If you want to update / modify build steps, check these things:
# - We use docker images to pin the glibc version to link against,
#
# - We use docker images to pin the glibc version to link against,
# even if host target is identical to the container image (i.e host: x64-linux, image: x64-linux)
#
# even if host target is identical to the container image (i.e host: x64-linux, image: x64-linux)
# - After build `objdump -T` prints out the glibc version next-swc is linked against,
#
# - After build `objdump -T` prints out the glibc version next-swc is linked against,
# to ensure it did not change unexpectedly if docker image, or other dependency changed
#
# to ensure it did not change unexpectedly if docker image, or other dependency changed
# - zig linker with portable glibc is avoided as it has known issues with static tls + node.js + multi threaded
#
# - zig linker with portable glibc is avoided as it has known issues with static tls + node.js + multi threaded
# environment.
#
# environment.
docker
:
ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-x64
#
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-x64
build
:
>-
#
build: >-
set -ex &&
#
set -ex &&
apt update &&
#
apt update &&
apt install -y pkg-config xz-utils dav1d libdav1d-dev &&
#
apt install -y pkg-config xz-utils dav1d libdav1d-dev &&
rustup show &&
#
rustup show &&
rustup target add x86_64-unknown-linux-gnu &&
#
rustup target add x86_64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
#
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
unset CC_x86_64_unknown_linux_gnu && unset CC &&
#
unset CC_x86_64_unknown_linux_gnu && unset CC &&
cd packages/next-swc && npm run build-native-release -- --target x86_64-unknown-linux-gnu &&
#
cd packages/next-swc && npm run build-native-release -- --target x86_64-unknown-linux-gnu &&
strip native/next-swc.*.node &&
#
strip native/next-swc.*.node &&
objdump -T native/next-swc.*.node | grep GLIBC_
#
objdump -T native/next-swc.*.node | grep GLIBC_
-
host
:
#
- host:
-
'
self-hosted'
#
- 'self-hosted'
-
'
linux'
#
- 'linux'
-
'
x64'
#
- 'x64'
-
'
metal'
#
- 'metal'
target
:
'
x86_64-unknown-linux-musl'
#
target: 'x86_64-unknown-linux-musl'
docker
:
ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-alpine
#
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-alpine
build
:
>-
#
build: >-
set -ex &&
#
set -ex &&
apk update &&
#
apk update &&
apk add --no-cache libc6-compat pkgconfig dav1d libdav1d dav1d-dev clang-static llvm-dev &&
#
apk add --no-cache libc6-compat pkgconfig dav1d libdav1d dav1d-dev clang-static llvm-dev &&
rustup show &&
#
rustup show &&
rustup target add x86_64-unknown-linux-musl &&
#
rustup target add x86_64-unknown-linux-musl &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
#
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
export RUSTFLAGS='--cfg tokio_unstable -Zshare-generics=y -Zthreads=8 -Csymbol-mangling-version=v0 -Ctarget-feature=-crt-static' &&
#
export RUSTFLAGS='--cfg tokio_unstable -Zshare-generics=y -Zthreads=8 -Csymbol-mangling-version=v0 -Ctarget-feature=-crt-static' &&
cd packages/next-swc && npm run build-native-release -- --target x86_64-unknown-linux-musl &&
#
cd packages/next-swc && npm run build-native-release -- --target x86_64-unknown-linux-musl &&
strip native/next-swc.*.node
#
strip native/next-swc.*.node
-
host
:
#
- host:
-
'
self-hosted'
#
- 'self-hosted'
-
'
linux'
#
- 'linux'
-
'
x64'
#
- 'x64'
-
'
metal'
#
- 'metal'
target
:
'
aarch64-unknown-linux-gnu'
#
target: 'aarch64-unknown-linux-gnu'
docker
:
ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-aarch64
#
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-aarch64
build
:
>-
#
build: >-
set -ex &&
#
set -ex &&
apt update &&
#
apt update &&
apt install -y pkg-config xz-utils dav1d libdav1d-dev &&
#
apt install -y pkg-config xz-utils dav1d libdav1d-dev &&
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
#
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
rustup show &&
#
rustup show &&
rustup target add aarch64-unknown-linux-gnu &&
#
rustup target add aarch64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
#
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
export CC_aarch64_unknown_linux_gnu=/usr/bin/clang &&
#
export CC_aarch64_unknown_linux_gnu=/usr/bin/clang &&
export CFLAGS_aarch64_unknown_linux_gnu=\"--target=aarch64-unknown-linux-gnu --sysroot=/usr/aarch64-unknown-linux-gnu\" &&
#
export CFLAGS_aarch64_unknown_linux_gnu=\"--target=aarch64-unknown-linux-gnu --sysroot=/usr/aarch64-unknown-linux-gnu\" &&
cd packages/next-swc && npm run build-native-release -- --target aarch64-unknown-linux-gnu &&
#
cd packages/next-swc && npm run build-native-release -- --target aarch64-unknown-linux-gnu &&
llvm-strip -x native/next-swc.*.node &&
#
llvm-strip -x native/next-swc.*.node &&
objdump -T native/next-swc.*.node | grep GLIBC_
#
objdump -T native/next-swc.*.node | grep GLIBC_
-
host
:
#
- host:
-
'
self-hosted'
#
- 'self-hosted'
-
'
linux'
#
- 'linux'
-
'
x64'
#
- 'x64'
-
'
metal'
#
- 'metal'
target
:
'
aarch64-unknown-linux-musl'
#
target: 'aarch64-unknown-linux-musl'
docker
:
ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-alpine
#
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-alpine
build
:
>-
#
build: >-
set -ex &&
#
set -ex &&
apk update &&
#
apk update &&
apk add --no-cache libc6-compat pkgconfig dav1d libdav1d dav1d-dev clang-static llvm-dev &&
#
apk add --no-cache libc6-compat pkgconfig dav1d libdav1d dav1d-dev clang-static llvm-dev &&
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
#
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
#
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
rustup show &&
#
rustup show &&
rustup target add aarch64-unknown-linux-musl &&
#
rustup target add aarch64-unknown-linux-musl &&
export RUSTFLAGS='--cfg tokio_unstable -Zshare-generics=y -Zthreads=8 -Zunstable-options -Csymbol-mangling-version=v0 -Clinker-flavor=gnu-lld-cc -Clink-self-contained=+linker' &&
#
export RUSTFLAGS='--cfg tokio_unstable -Zshare-generics=y -Zthreads=8 -Zunstable-options -Csymbol-mangling-version=v0 -Clinker-flavor=gnu-lld-cc -Clink-self-contained=+linker' &&
cd packages/next-swc && npm run build-native-release -- --target aarch64-unknown-linux-musl &&
#
cd packages/next-swc && npm run build-native-release -- --target aarch64-unknown-linux-musl &&
llvm-strip -x native/next-swc.*.node
#
llvm-strip -x native/next-swc.*.node
name
:
stable - ${{ matrix.settings.target }} - node@16
#
name: stable - ${{ matrix.settings.target }} - node@16
runs-on
:
${{ matrix.settings.host }}
#
runs-on: ${{ matrix.settings.host }}
timeout-minutes
:
45
#
timeout-minutes: 45
steps
:
#
steps:
# https://github.com/actions/virtual-environments/issues/1187
#
# https://github.com/actions/virtual-environments/issues/1187
-
name
:
tune linux network
#
- name: tune linux network
run
:
sudo ethtool -K eth0 tx off rx off
#
run: sudo ethtool -K eth0 tx off rx off
if
:
${{ matrix.settings.host == 'ubuntu-latest' }}
#
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
-
name
:
tune linux network
#
- name: tune linux network
run
:
sudo ethtool -K eth0 tx off rx off
#
run: sudo ethtool -K eth0 tx off rx off
if
:
${{ matrix.settings.host == 'ubuntu-latest' }}
#
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
-
name
:
tune windows network
#
- name: tune windows network
run
:
Disable-NetAdapterChecksumOffload -Name * -TcpIPv4 -UdpIPv4 -TcpIPv6 -UdpIPv6
#
run: Disable-NetAdapterChecksumOffload -Name * -TcpIPv4 -UdpIPv4 -TcpIPv6 -UdpIPv6
if
:
${{ matrix.settings.host == 'windows-latest' }}
#
if: ${{ matrix.settings.host == 'windows-latest' }}
-
name
:
tune mac network
#
- name: tune mac network
run
:
sudo sysctl -w net.link.generic.system.hwcksum_tx=0 && sudo sysctl -w net.link.generic.system.hwcksum_rx=0
#
run: sudo sysctl -w net.link.generic.system.hwcksum_tx=0 && sudo sysctl -w net.link.generic.system.hwcksum_rx=0
if
:
${{ matrix.settings.host == 'macos-latest' }}
#
if: ${{ matrix.settings.host == 'macos-latest' }}
# we use checkout here instead of the build cache since
#
# we use checkout here instead of the build cache since
# it can fail to restore in different OS'
#
# it can fail to restore in different OS'
-
uses
:
actions/checkout@v4
#
- uses: actions/checkout@v4
with
:
#
with:
# crates/napi/build.rs uses git-describe to find the most recent git tag. It's okay if
#
# crates/napi/build.rs uses git-describe to find the most recent git tag. It's okay if
# this fails, but fetch with enough depth that we're likely to find a recent tag.
#
# this fails, but fetch with enough depth that we're likely to find a recent tag.
fetch-depth
:
100
#
fetch-depth: 100
-
name
:
Setup node
#
- name: Setup node
uses
:
actions/setup-node@v4
#
uses: actions/setup-node@v4
if
:
${{ !matrix.settings.docker }}
#
if: ${{ !matrix.settings.docker }}
with
:
#
with:
node-version
:
${{ env.NODE_LTS_VERSION }}
#
node-version: ${{ env.NODE_LTS_VERSION }}
check-latest
:
true
#
check-latest: true
-
name
:
Setup corepack
#
- name: Setup corepack
run
:
|
#
run: |
npm i -g corepack@0.31
#
npm i -g corepack@0.31
corepack enable
#
corepack enable
# we always want to run this to set environment variables
#
# we always want to run this to set environment variables
-
name
:
Install Rust
#
- name: Install Rust
uses
:
./.github/actions/setup-rust
#
uses: ./.github/actions/setup-rust
with
:
#
with:
targets
:
${{ matrix.settings.target }}
#
targets: ${{ matrix.settings.target }}
-
name
:
normalize versions
#
- name: normalize versions
run
:
node scripts/normalize-version-bump.js
#
run: node scripts/normalize-version-bump.js
-
name
:
Setup toolchain
#
- name: Setup toolchain
run
:
${{ matrix.settings.setup }}
#
run: ${{ matrix.settings.setup }}
if
:
${{ matrix.settings.setup }}
#
if: ${{ matrix.settings.setup }}
-
name
:
Cache on ${{ github.ref_name }}
#
- name: Cache on ${{ github.ref_name }}
uses
:
ijjk/rust-cache@turbo-cache-v1.0.8
#
uses: ijjk/rust-cache@turbo-cache-v1.0.8
with
:
#
with:
save-if
:
'
true'
#
save-if: 'true'
cache-provider
:
'
turbo'
#
cache-provider: 'turbo'
shared-key
:
build-${{ matrix.settings.target }}-${{ hashFiles('.cargo/config.toml') }}
#
shared-key: build-${{ matrix.settings.target }}-${{ hashFiles('.cargo/config.toml') }}
-
name
:
Clear native build
#
- name: Clear native build
run
:
rm -rf packages/next-swc/native
#
run: rm -rf packages/next-swc/native
# we only need custom caching for docker builds
#
# we only need custom caching for docker builds
# as they are on an older Node.js version and have
#
# as they are on an older Node.js version and have
# issues with turbo caching
#
# issues with turbo caching
-
name
:
pull build cache
#
- name: pull build cache
if
:
${{ matrix.settings.docker }}
#
if: ${{ matrix.settings.docker }}
run
:
TURBO_VERSION=${TURBO_VERSION} node ./scripts/pull-turbo-cache.js ${{ matrix.settings.target }}
#
run: TURBO_VERSION=${TURBO_VERSION} node ./scripts/pull-turbo-cache.js ${{ matrix.settings.target }}
-
name
:
check build exists
#
- name: check build exists
if
:
${{ matrix.settings.docker }}
#
if: ${{ matrix.settings.docker }}
run
:
if [ -f packages/next-swc/native/next-swc.*.node ]; then echo "BUILD_EXISTS=yes" >> $GITHUB_OUTPUT; else echo "BUILD_EXISTS=no" >> $GITHUB_OUTPUT; fi
#
run: if [ -f packages/next-swc/native/next-swc.*.node ]; then echo "BUILD_EXISTS=yes" >> $GITHUB_OUTPUT; else echo "BUILD_EXISTS=no" >> $GITHUB_OUTPUT; fi
id
:
build-exists
#
id: build-exists
-
name
:
Build in docker
#
- name: Build in docker
if
:
${{ matrix.settings.docker && steps.build-exists.outputs.BUILD_EXISTS == 'no' }}
#
if: ${{ matrix.settings.docker && steps.build-exists.outputs.BUILD_EXISTS == 'no' }}
run
:
|
#
run: |
docker run -v "/var/run/docker.sock":"/var/run/docker.sock" \
#
docker run -v "/var/run/docker.sock":"/var/run/docker.sock" \
-e CI -e RUST_BACKTRACE -e NAPI_CLI_VERSION -e CARGO_TERM_COLOR -e CARGO_INCREMENTAL \
#
-e CI -e RUST_BACKTRACE -e NAPI_CLI_VERSION -e CARGO_TERM_COLOR -e CARGO_INCREMENTAL \
-e CARGO_PROFILE_RELEASE_LTO -e CARGO_REGISTRIES_CRATES_IO_PROTOCOL -e TURBO_API \
#
-e CARGO_PROFILE_RELEASE_LTO -e CARGO_REGISTRIES_CRATES_IO_PROTOCOL -e TURBO_API \
-e TURBO_TEAM -e TURBO_TOKEN -e TURBO_VERSION -e TURBO_CACHE="remote:rw" \
#
-e TURBO_TEAM -e TURBO_TOKEN -e TURBO_VERSION -e TURBO_CACHE="remote:rw" \
-v ${{ env.HOME }}/.cargo/git:/root/.cargo/git \
#
-v ${{ env.HOME }}/.cargo/git:/root/.cargo/git \
-v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry \
#
-v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry \
-v ${{ github.workspace }}:/build \
#
-v ${{ github.workspace }}:/build \
-w /build \
#
-w /build \
--entrypoint=bash ${{ matrix.settings.docker }} \
#
--entrypoint=bash ${{ matrix.settings.docker }} \
-c "${{ matrix.settings.build }}"
#
-c "${{ matrix.settings.build }}"
-
name
:
cache build
#
- name: cache build
if
:
${{ matrix.settings.docker && steps.build-exists.outputs.BUILD_EXISTS == 'no' }}
#
if: ${{ matrix.settings.docker && steps.build-exists.outputs.BUILD_EXISTS == 'no' }}
run
:
pnpm dlx turbo@${TURBO_VERSION} run cache-build-native --force -- ${{ matrix.settings.target }}
#
run: pnpm dlx turbo@${TURBO_VERSION} run cache-build-native --force -- ${{ matrix.settings.target }}
-
name
:
'
Build'
#
- name: 'Build'
run
:
${{ matrix.settings.build }}
#
run: ${{ matrix.settings.build }}
if
:
${{ !matrix.settings.docker }}
#
if: ${{ !matrix.settings.docker }}
-
name
:
'
check
build
cache
status'
#
- name: 'check build cache status'
id
:
check-did-build
#
id: check-did-build
run
:
if [[ ! -z $(ls packages/next-swc/native) ]]; then echo "DID_BUILD=true" >> $GITHUB_OUTPUT; fi
#
run: if [[ ! -z $(ls packages/next-swc/native) ]]; then echo "DID_BUILD=true" >> $GITHUB_OUTPUT; fi
# Try to upload metrics for Turbopack to datadog's CI pipeline execution
#
# Try to upload metrics for Turbopack to datadog's CI pipeline execution
-
name
:
'
Collect
turbopack
build
metrics'
#
- name: 'Collect turbopack build metrics'
id
:
check-turbopack-bytesize
#
id: check-turbopack-bytesize
if
:
${{ steps.check-did-build.outputs.DID_BUILD == 'true' }}
#
if: ${{ steps.check-did-build.outputs.DID_BUILD == 'true' }}
continue-on-error
:
true
#
continue-on-error: true
run
:
|
#
run: |
mkdir -p ./turbopack-bin-size
#
mkdir -p ./turbopack-bin-size
shopt -s nullglob
#
shopt -s nullglob
for filename in packages/next-swc/native/next-swc.*.node; do
#
for filename in packages/next-swc/native/next-swc.*.node; do
# Strip out filename to extract target triple
#
# Strip out filename to extract target triple
export FILENAME=$(basename ${filename})
#
export FILENAME=$(basename ${filename})
export FILENAME=${FILENAME#*.}
#
export FILENAME=${FILENAME#*.}
export FILENAME=${FILENAME%.node}
#
export FILENAME=${FILENAME%.node}
export BYTESIZE=$(wc -c < $filename | xargs)
#
export BYTESIZE=$(wc -c < $filename | xargs)
echo "Reporting $FILENAME:$BYTESIZE for Turbopack bytesize"
#
echo "Reporting $FILENAME:$BYTESIZE for Turbopack bytesize"
echo "turbopack.bytesize.$FILENAME:$BYTESIZE" > ./turbopack-bin-size/${{ matrix.settings.target }}
#
echo "turbopack.bytesize.$FILENAME:$BYTESIZE" > ./turbopack-bin-size/${{ matrix.settings.target }}
done
#
done
-
name
:
Upload turbopack bytesize artifact
#
- name: Upload turbopack bytesize artifact
if
:
${{ steps.check-did-build.outputs.DID_BUILD == 'true' }}
#
if: ${{ steps.check-did-build.outputs.DID_BUILD == 'true' }}
uses
:
actions/upload-artifact@v4
#
uses: actions/upload-artifact@v4
with
:
#
with:
name
:
turbopack-bytesize-${{ matrix.settings.target }}
#
name: turbopack-bytesize-${{ matrix.settings.target }}
path
:
turbopack-bin-size/*
#
path: turbopack-bin-size/*
-
name
:
Upload swc artifact
#
- name: Upload swc artifact
uses
:
actions/upload-artifact@v4
#
uses: actions/upload-artifact@v4
with
:
#
with:
name
:
next-swc-binaries-${{ matrix.settings.target }}
#
name: next-swc-binaries-${{ matrix.settings.target }}
path
:
packages/next-swc/native/next-swc.*.node
#
path: packages/next-swc/native/next-swc.*.node
-
name
:
Upload turbo summary artifact
#
- name: Upload turbo summary artifact
uses
:
actions/upload-artifact@v4
#
uses: actions/upload-artifact@v4
with
:
#
with:
name
:
turbo-run-summary-${{ matrix.settings.target }}
#
name: turbo-run-summary-${{ matrix.settings.target }}
path
:
.turbo/runs
#
path: .turbo/runs
build-wasm
:
#
build-wasm:
if
:
${{ needs.deploy-target.outputs.value != 'skipped' }}
#
if: ${{ needs.deploy-target.outputs.value != 'skipped' }}
needs
:
#
needs:
-
deploy-target
#
- deploy-target
strategy
:
#
strategy:
matrix
:
#
matrix:
target
:
[
web
,
nodejs
]
#
target: [web, nodejs]
runs-on
:
#
runs-on:
-
'
self-hosted'
#
- 'self-hosted'
-
'
linux'
#
- 'linux'
-
'
x64'
#
- 'x64'
-
'
metal'
#
- 'metal'
steps
:
#
steps:
-
uses
:
actions/checkout@v4
#
- uses: actions/checkout@v4
-
name
:
Setup node
#
- name: Setup node
uses
:
actions/setup-node@v4
#
uses: actions/setup-node@v4
with
:
#
with:
node-version
:
${{ env.NODE_LTS_VERSION }}
#
node-version: ${{ env.NODE_LTS_VERSION }}
check-latest
:
true
#
check-latest: true
-
run
:
corepack enable
#
- run: corepack enable
-
name
:
Install Rust
#
- name: Install Rust
uses
:
./.github/actions/setup-rust
#
uses: ./.github/actions/setup-rust
with
:
#
with:
targets
:
wasm32-unknown-unknown
#
targets: wasm32-unknown-unknown
-
name
:
Install wasm-pack
#
- name: Install wasm-pack
run
:
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
#
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
-
name
:
normalize versions
#
- name: normalize versions
run
:
node scripts/normalize-version-bump.js
#
run: node scripts/normalize-version-bump.js
-
name
:
Build
#
- name: Build
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
#
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
# TODO: we should add the relevant envs later to to switch to strict mode
#
# TODO: we should add the relevant envs later to to switch to strict mode
run
:
pnpm dlx turbo@${TURBO_VERSION} run build-wasm -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target ${{ matrix.target }}
#
run: pnpm dlx turbo@${TURBO_VERSION} run build-wasm -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target ${{ matrix.target }}
-
name
:
Add target to folder name
#
- name: Add target to folder name
run
:
'
[[
-d
"crates/wasm/pkg"
]]
&&
mv
crates/wasm/pkg
crates/wasm/pkg-${{
matrix.target
}}
||
ls
crates/wasm'
#
run: '[[ -d "crates/wasm/pkg" ]] && mv crates/wasm/pkg crates/wasm/pkg-${{ matrix.target }} || ls crates/wasm'
-
name
:
Upload turbo summary artifact
#
- name: Upload turbo summary artifact
uses
:
actions/upload-artifact@v4
#
uses: actions/upload-artifact@v4
with
:
#
with:
name
:
turbo-run-summary-wasm-${{matrix.target}}
#
name: turbo-run-summary-wasm-${{matrix.target}}
path
:
.turbo/runs
#
path: .turbo/runs
-
name
:
Upload swc artifact
#
- name: Upload swc artifact
uses
:
actions/upload-artifact@v4
#
uses: actions/upload-artifact@v4
with
:
#
with:
name
:
wasm-binaries-${{matrix.target}}
#
name: wasm-binaries-${{matrix.target}}
path
:
crates/wasm/pkg-*
#
path: crates/wasm/pkg-*
deploy-tarball
:
#
deploy-tarball:
if
:
${{ needs.deploy-target.outputs.value != 'production' }}
#
if: ${{ needs.deploy-target.outputs.value != 'production' }}
name
:
Deploy preview tarball
#
name: Deploy preview tarball
runs-on
:
ubuntu-latest
#
runs-on: ubuntu-latest
needs
:
#
needs:
-
deploy-target
#
- deploy-target
-
build
#
- build
-
build-wasm
#
- build-wasm
-
build-native
#
- build-native
steps
:
#
steps:
-
name
:
Setup node
#
- name: Setup node
uses
:
actions/setup-node@v4
#
uses: actions/setup-node@v4
with
:
#
with:
node-version
:
${{ env.NODE_LTS_VERSION }}
#
node-version: ${{ env.NODE_LTS_VERSION }}
check-latest
:
true
#
check-latest: true
-
name
:
Setup corepack
#
- name: Setup corepack
run
:
|
#
run: |
npm i -g corepack@0.31
#
npm i -g corepack@0.31
corepack enable
#
corepack enable
# https://github.com/actions/virtual-environments/issues/1187
#
# https://github.com/actions/virtual-environments/issues/1187
-
name
:
tune linux network
#
- name: tune linux network
run
:
sudo ethtool -K eth0 tx off rx off
#
run: sudo ethtool -K eth0 tx off rx off
-
uses
:
actions/cache@v4
#
- uses: actions/cache@v4
timeout-minutes
:
5
#
timeout-minutes: 5
id
:
restore-build
#
id: restore-build
with
:
#
with:
path
:
./*
#
path: ./*
# Cache includes repo checkout which is required for later scripts
#
# Cache includes repo checkout which is required for later scripts
fail-on-cache-miss
:
true
#
fail-on-cache-miss: true
key
:
${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }}
#
key: ${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys
:
|
#
restore-keys: |
${{ github.sha }}-${{ github.run_number }}
#
${{ github.sha }}-${{ github.run_number }}
${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt}}
#
${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt}}
-
uses
:
actions/download-artifact@v4
#
- uses: actions/download-artifact@v4
with
:
#
with:
pattern
:
next-swc-binaries-*
#
pattern: next-swc-binaries-*
merge-multiple
:
true
#
merge-multiple: true
path
:
packages/next-swc/native
#
path: packages/next-swc/native
-
uses
:
actions/download-artifact@v4
#
- uses: actions/download-artifact@v4
with
:
#
with:
pattern
:
wasm-binaries-*
#
pattern: wasm-binaries-*
merge-multiple
:
true
#
merge-multiple: true
path
:
crates/wasm
#
path: crates/wasm
-
name
:
Create tarballs
#
- name: Create tarballs
run
:
node scripts/create-preview-tarballs.js "${{ github.sha }}" "${{ runner.temp }}/preview-tarballs"
#
run: node scripts/create-preview-tarballs.js "${{ github.sha }}" "${{ runner.temp }}/preview-tarballs"
-
name
:
Upload tarballs
#
- name: Upload tarballs
uses
:
actions/upload-artifact@v4
#
uses: actions/upload-artifact@v4
with
:
#
with:
# Update all mentions of this name in vercel-packages when changing.
#
# Update all mentions of this name in vercel-packages when changing.
name
:
preview-tarballs
#
name: preview-tarballs
path
:
${{ runner.temp }}/preview-tarballs/*
#
path: ${{ runner.temp }}/preview-tarballs/*
publishRelease
:
publishRelease
:
if
:
${{ needs.deploy-target.outputs.value == 'production' }}
if
:
${{ needs.deploy-target.outputs.value == 'production' }}
...
@@ -532,8 +532,8 @@ jobs:
...
@@ -532,8 +532,8 @@ jobs:
needs
:
needs
:
-
deploy-target
-
deploy-target
-
build
-
build
-
build-wasm
#
- build-wasm
-
build-native
#
- build-native
permissions
:
permissions
:
contents
:
write
contents
:
write
id-token
:
write
id-token
:
write
...
@@ -566,17 +566,17 @@ jobs:
...
@@ -566,17 +566,17 @@ jobs:
${{ github.sha }}-${{ github.run_number }}
${{ github.sha }}-${{ github.run_number }}
${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt}}
${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt}}
-
uses
:
actions/download-artifact@v4
#
- uses: actions/download-artifact@v4
with
:
#
with:
pattern
:
next-swc-binaries-*
#
pattern: next-swc-binaries-*
merge-multiple
:
true
#
merge-multiple: true
path
:
packages/next-swc/native
#
path: packages/next-swc/native
-
uses
:
actions/download-artifact@v4
#
- uses: actions/download-artifact@v4
with
:
#
with:
pattern
:
wasm-binaries-*
#
pattern: wasm-binaries-*
merge-multiple
:
true
#
merge-multiple: true
path
:
crates/wasm
#
path: crates/wasm
-
run
:
npm i -g npm@10.4.0
# need latest version for provenance (pinning to avoid bugs)
-
run
:
npm i -g npm@10.4.0
# need latest version for provenance (pinning to avoid bugs)
-
run
:
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
-
run
:
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
...
@@ -679,29 +679,29 @@ jobs:
...
@@ -679,29 +679,29 @@ jobs:
PR_STATS_COMMENT_TOKEN
:
${{ secrets.PR_STATS_COMMENT_TOKEN }}
PR_STATS_COMMENT_TOKEN
:
${{ secrets.PR_STATS_COMMENT_TOKEN }}
NEXT_SKIP_NATIVE_POSTINSTALL
:
1
NEXT_SKIP_NATIVE_POSTINSTALL
:
1
upload_turbopack_bytesize
:
#
upload_turbopack_bytesize:
if
:
${{ needs.deploy-target.outputs.value != 'automated-preview'}}
#
if: ${{ needs.deploy-target.outputs.value != 'automated-preview'}}
name
:
Upload Turbopack Bytesize metrics to Datadog
#
name: Upload Turbopack Bytesize metrics to Datadog
runs-on
:
ubuntu-latest
#
runs-on: ubuntu-latest
needs
:
[
build-native
,
deploy-target
]
#
needs: [build-native, deploy-target]
env
:
#
env:
DATADOG_API_KEY
:
${{ secrets.DATA_DOG_API_KEY }}
#
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
steps
:
#
steps:
-
name
:
Collect bytesize metrics
#
- name: Collect bytesize metrics
uses
:
actions/download-artifact@v4
#
uses: actions/download-artifact@v4
with
:
#
with:
pattern
:
turbopack-bytesize-*
#
pattern: turbopack-bytesize-*
merge-multiple
:
true
#
merge-multiple: true
path
:
turbopack-bin-size
#
path: turbopack-bin-size
-
name
:
Upload to Datadog
#
- name: Upload to Datadog
run
:
|
#
run: |
ls -al turbopack-bin-size
#
ls -al turbopack-bin-size
for filename in turbopack-bin-size/*; do
#
for filename in turbopack-bin-size/*; do
export BYTESIZE+=" --metrics $(cat $filename)"
#
export BYTESIZE+=" --metrics $(cat $filename)"
done
#
done
echo "Reporting $BYTESIZE"
#
echo "Reporting $BYTESIZE"
npx @datadog/datadog-ci@2.23.1 metric --no-fail --level pipeline $BYTESIZE
#
npx @datadog/datadog-ci@2.23.1 metric --no-fail --level pipeline $BYTESIZE
packages/next/src/build/swc/index.ts
View file @
249d6691
...
@@ -48,7 +48,8 @@ type RawWasmBindings = typeof import('./generated-wasm') & {
...
@@ -48,7 +48,8 @@ type RawWasmBindings = typeof import('./generated-wasm') & {
default
?():
Promise
<
typeof
import
(
'./generated-wasm'
)
>
default
?():
Promise
<
typeof
import
(
'./generated-wasm'
)
>
}
}
const
nextVersion
=
process
.
env
.
__NEXT_VERSION
as
string
// locked version as binaries are locked
const
nextVersion
=
'15.3.5'
const
ArchName
=
arch
()
const
ArchName
=
arch
()
const
PlatformName
=
platform
()
const
PlatformName
=
platform
()
...
...
scripts/publish-native.js
View file @
249d6691
#!/usr/bin/env node
#!/usr/bin/env node
const
path
=
require
(
'path'
)
const
path
=
require
(
'path'
)
const
execa
=
require
(
'execa'
)
//
const execa = require('execa')
const
{
Sema
}
=
require
(
'async-sema'
)
//
const { Sema } = require('async-sema')
const
{
readFile
,
readdir
,
writeFile
,
cp
}
=
require
(
'fs/promises'
)
const
{
readFile
,
readdir
,
writeFile
}
=
require
(
'fs/promises'
)
const
cwd
=
process
.
cwd
()
const
cwd
=
process
.
cwd
()
;(
async
function
()
{
;(
async
function
()
{
try
{
try
{
const
publishSema
=
new
Sema
(
2
)
//
const publishSema = new Sema(2)
let
version
=
JSON
.
parse
(
let
version
=
'15.3.5'
await
readFile
(
path
.
join
(
cwd
,
'lerna.json'
))
).
version
// Copy binaries to package folders, update version, and publish
// Copy binaries to package folders, update version, and publish
let
nativePackagesDir
=
path
.
join
(
cwd
,
'crates/napi/npm'
)
let
nativePackagesDir
=
path
.
join
(
cwd
,
'crates/napi/npm'
)
...
@@ -21,118 +19,118 @@ const cwd = process.cwd()
...
@@ -21,118 +19,118 @@ const cwd = process.cwd()
(
name
)
=>
!
name
.
startsWith
(
'.'
)
(
name
)
=>
!
name
.
startsWith
(
'.'
)
)
)
await
Promise
.
all
(
//
await Promise.all(
platforms
.
map
(
async
(
platform
)
=>
{
//
platforms.map(async (platform) => {
await
publishSema
.
acquire
()
//
await publishSema.acquire()
let
output
=
''
//
let output = ''
try
{
//
try {
let
binaryName
=
`next-swc.
${
platform
}
.node`
//
let binaryName = `next-swc.${platform}.node`
await
cp
(
//
await cp(
path
.
join
(
cwd
,
'packages/next-swc/native'
,
binaryName
),
//
path.join(cwd, 'packages/next-swc/native', binaryName),
path
.
join
(
nativePackagesDir
,
platform
,
binaryName
)
//
path.join(nativePackagesDir, platform, binaryName)
)
//
)
let
pkg
=
JSON
.
parse
(
//
let pkg = JSON.parse(
await
readFile
(
//
await readFile(
path
.
join
(
nativePackagesDir
,
platform
,
'package.json'
)
//
path.join(nativePackagesDir, platform, 'package.json')
)
//
)
)
//
)
pkg
.
version
=
version
//
pkg.version = version
await
writeFile
(
//
await writeFile(
path
.
join
(
nativePackagesDir
,
platform
,
'package.json'
),
//
path.join(nativePackagesDir, platform, 'package.json'),
JSON
.
stringify
(
pkg
,
null
,
2
)
//
JSON.stringify(pkg, null, 2)
)
//
)
const
child
=
execa
(
//
const child = execa(
`npm`
,
//
`npm`,
[
//
[
`publish`
,
//
`publish`,
`
${
path
.
join
(
nativePackagesDir
,
platform
)}
`
,
//
`${path.join(nativePackagesDir, platform)}`,
`--access`
,
//
`--access`,
`public`
,
//
`public`,
...(
version
.
includes
(
'canary'
)
//
...(version.includes('canary')
?
[
'--tag'
,
'canary'
]
//
? ['--tag', 'canary']
:
[
'--tag'
,
'next-15-3'
]),
//
: ['--tag', 'next-15-3']),
],
//
],
{
stdio
:
'inherit'
}
//
{ stdio: 'inherit' }
)
//
)
const
handleData
=
(
type
)
=>
(
chunk
)
=>
{
//
const handleData = (type) => (chunk) => {
process
[
type
].
write
(
chunk
)
//
process[type].write(chunk)
output
+=
chunk
.
toString
()
//
output += chunk.toString()
}
//
}
child
.
stdout
?.
on
(
'data'
,
handleData
(
'stdout'
))
//
child.stdout?.on('data', handleData('stdout'))
child
.
stderr
?.
on
(
'data'
,
handleData
(
'stderr'
))
//
child.stderr?.on('data', handleData('stderr'))
await
child
//
await child
}
catch
(
err
)
{
//
} catch (err) {
// don't block publishing other versions on single platform error
//
// don't block publishing other versions on single platform error
console
.
error
(
`Failed to publish`
,
platform
,
err
)
//
console.error(`Failed to publish`, platform, err)
if
(
//
if (
output
.
includes
(
//
output.includes(
'cannot publish over the previously published versions'
//
'cannot publish over the previously published versions'
)
//
)
)
{
//
) {
console
.
error
(
'Ignoring already published error'
,
platform
,
err
)
//
console.error('Ignoring already published error', platform, err)
}
else
{
//
} else {
// throw err
//
// throw err
}
//
}
}
finally
{
//
} finally {
publishSema
.
release
()
//
publishSema.release()
}
//
}
})
//
})
)
//
)
// Update name/version of wasm packages and publish
//
//
Update name/version of wasm packages and publish
const
pkgDirectory
=
'crates/wasm'
//
const pkgDirectory = 'crates/wasm'
let
wasmDir
=
path
.
join
(
cwd
,
pkgDirectory
)
//
let wasmDir = path.join(cwd, pkgDirectory)
await
Promise
.
all
(
//
await Promise.all(
[
'web'
,
'nodejs'
].
map
(
async
(
wasmTarget
)
=>
{
//
['web', 'nodejs'].map(async (wasmTarget) => {
await
publishSema
.
acquire
()
//
await publishSema.acquire()
let
wasmPkg
=
JSON
.
parse
(
//
let wasmPkg = JSON.parse(
await
readFile
(
path
.
join
(
wasmDir
,
`pkg-
${
wasmTarget
}
/package.json`
))
//
await readFile(path.join(wasmDir, `pkg-${wasmTarget}/package.json`))
)
//
)
wasmPkg
.
name
=
`@next/swc-wasm-
${
wasmTarget
}
`
//
wasmPkg.name = `@next/swc-wasm-${wasmTarget}`
wasmPkg
.
version
=
version
//
wasmPkg.version = version
wasmPkg
.
repository
=
{
//
wasmPkg.repository = {
type
:
'git'
,
//
type: 'git',
url
:
'https://github.com/vercel/next.js'
,
//
url: 'https://github.com/vercel/next.js',
directory
:
pkgDirectory
,
//
directory: pkgDirectory,
}
//
}
await
writeFile
(
//
await writeFile(
path
.
join
(
wasmDir
,
`pkg-
${
wasmTarget
}
/package.json`
),
//
path.join(wasmDir, `pkg-${wasmTarget}/package.json`),
JSON
.
stringify
(
wasmPkg
,
null
,
2
)
//
JSON.stringify(wasmPkg, null, 2)
)
//
)
try
{
//
try {
await
execa
(
//
await execa(
`npm`
,
//
`npm`,
[
//
[
'publish'
,
//
'publish',
`
${
path
.
join
(
wasmDir
,
`pkg-
${
wasmTarget
}
`
)}
`
,
//
`${path.join(wasmDir, `pkg-${wasmTarget}`)}`,
'--access'
,
//
'--access',
'public'
,
//
'public',
...(
version
.
includes
(
'canary'
)
//
...(version.includes('canary')
?
[
'--tag'
,
'canary'
]
//
? ['--tag', 'canary']
:
[
'--tag'
,
'next-15-3'
]),
//
: ['--tag', 'next-15-3']),
],
//
],
{
stdio
:
'inherit'
}
//
{ stdio: 'inherit' }
)
//
)
}
catch
(
err
)
{
//
} catch (err) {
// don't block publishing other versions on single platform error
//
// don't block publishing other versions on single platform error
console
.
error
(
`Failed to publish`
,
wasmTarget
,
err
)
//
console.error(`Failed to publish`, wasmTarget, err)
if
(
//
if (
err
.
message
&&
//
err.message &&
err
.
message
.
includes
(
//
err.message.includes(
'You cannot publish over the previously published versions'
//
'You cannot publish over the previously published versions'
)
//
)
)
{
//
) {
console
.
error
(
'Ignoring already published error'
,
wasmTarget
)
//
console.error('Ignoring already published error', wasmTarget)
}
else
{
//
} else {
// throw err
//
// throw err
}
//
}
}
finally
{
//
} finally {
publishSema
.
release
()
//
publishSema.release()
}
//
}
})
//
})
)
//
)
// Update optional dependencies versions
// Update optional dependencies versions
let
nextPkg
=
JSON
.
parse
(
let
nextPkg
=
JSON
.
parse
(
...
...
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