git: 8a2e817ddae3 - main - Mk/Uses/npm.mk: Add support for pnpm >= 12
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 30 Sep 2026 11:50:33 UTC
The branch main has been updated by tagattie:
URL: https://cgit.FreeBSD.org/ports/commit/?id=8a2e817ddae3c8ecbb4d30869f753f6ea53ee43d
commit 8a2e817ddae3c8ecbb4d30869f753f6ea53ee43d
Author: Hiroki Tagato <tagattie@FreeBSD.org>
AuthorDate: 2026-09-30 11:44:23 +0000
Commit: Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2026-09-30 11:50:25 +0000
Mk/Uses/npm.mk: Add support for pnpm >= 12
pnpm 12 has been rewritten in Rust and introduced an
architecture-dependent node module, which is required to be installed
separately from the main node module.
By default, the installation occurs upon the first pnpm execution and
breaks poudriere builds. So prefetch and extract the native executable
to the expected location in advance to avoid breakage.
---
Mk/Uses/npm.mk | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/Mk/Uses/npm.mk b/Mk/Uses/npm.mk
index 1343c00d6120..fc6849d73138 100644
--- a/Mk/Uses/npm.mk
+++ b/Mk/Uses/npm.mk
@@ -249,6 +249,10 @@ _USES_fetch+= 490:npm-fetch-node-package-manager
DISTFILES+= ${NPM_CMDNAME}-${NPM_VER}.tgz:prefetch
FETCH_DEPENDS+= ${_NODEJS_PKGNAME}>0:${_NODEJS_PORT}
+. if ${_NPM_NAME} == pnpm && ${NPM_VER_MAJOR} >= 12
+DISTFILES+= ${NPM_CMDNAME}-exe.freebsd-${NPM_NODEJS_ARCH}-${NPM_VER}.tgz:prefetch
+. endif
+
npm-fetch-node-package-manager:
@${ECHO_MSG} "===> Fetching and setting up ${NPM_CMDNAME} version ${NPM_VER}"
@${MKDIR} ${DISTDIR}/${DIST_SUBDIR} ${WRKDIR}/.bin
@@ -263,7 +267,21 @@ npm-fetch-node-package-manager:
${TAR} -cz --options 'gzip:!timestamp' \
-f ${DISTDIR}/${DIST_SUBDIR}/${NPM_CMDNAME}-${NPM_VER}.tgz @${NPM_CMDNAME}.mtree; \
fi
+. if ${_NPM_NAME} == pnpm && ${NPM_VER_MAJOR} >= 12
+ @if [ ! -f ${DISTDIR}/${DIST_SUBDIR}/${NPM_CMDNAME}-exe.freebsd-${NPM_NODEJS_ARCH}-${NPM_VER}.tgz ]; then \
+ ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} \
+ https://registry.npmjs.org/@pnpm/exe.freebsd-${NPM_NODEJS_ARCH}/-/exe.freebsd-${NPM_NODEJS_ARCH}-${NPM_VER}.tgz \
+ -o ${DISTDIR}/${DIST_SUBDIR}/${NPM_CMDNAME}-exe.freebsd-${NPM_NODEJS_ARCH}-${NPM_VER}.tgz; \
+ fi
+. endif
@${SETENV} ${MAKE_ENV} corepack install -g ${DISTDIR}/${DIST_SUBDIR}/${NPM_CMDNAME}-${NPM_VER}.tgz
+. if ${_NPM_NAME} == pnpm && ${NPM_VER_MAJOR} >= 12
+ @${TAR} -xf ${DISTDIR}/${DIST_SUBDIR}/${NPM_CMDNAME}-exe.freebsd-${NPM_NODEJS_ARCH}-${NPM_VER}.tgz \
+ -C ${WRKDIR}/.cache/node/corepack/v1/${_NPM_NAME}/${NPM_VER} \
+ --strip-components 1 \
+ --include package/pnpm \
+ -s /pnpm$$/pnpm-native/
+. endif
. endif
. if ${NPM_PREFETCH:tl} == yes
@@ -470,6 +488,13 @@ npm-extract-node-package-manager:
@${MKDIR} ${WRKDIR}/.bin
@${SETENV} ${MAKE_ENV} corepack enable --install-directory ${WRKDIR}/.bin
@${SETENV} ${MAKE_ENV} corepack install -g ${DISTDIR}/${DIST_SUBDIR}/${NPM_CMDNAME}-${NPM_VER}.tgz
+. if ${_NPM_NAME} == pnpm && ${NPM_VER_MAJOR} >= 12
+ @${TAR} -xf ${DISTDIR}/${DIST_SUBDIR}/${NPM_CMDNAME}-exe.freebsd-${NPM_NODEJS_ARCH}-${NPM_VER}.tgz \
+ -C ${WRKDIR}/.cache/node/corepack/v1/${_NPM_NAME}/${NPM_VER} \
+ --strip-components 1 \
+ --include package/pnpm \
+ -s /pnpm$$/pnpm-native/
+. endif
. else
@${DO_NADA}
. endif