# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: npm.eclass # @MAINTAINER: # Emily Love Watson # @AUTHOR: # Emily Love Watson # @BLURB: Helpful defaults for bundling npm packages # @DESCRIPTION: # This eclass provides helpers and default values for building node package # ebuilds. if [[ -z ${_NPM_ECLASS} ]]; then _NPM_ECLASS=1 fi case ${EAPI} in 8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac RDEPEND=" net-libs/nodejs[npm] " # @ECLASS_VARIABLE: ENPM_REGISTRY # @USER_VARIABLE # @DESCRIPTION: # The npm registry host to use. Defaults to registry.npmjs.org. : "${ENPM_REGISTRY:=registry.npmjs.org}" # @ECLASS_VARIABLE: ENPM_PN # @USER_VARIABLE # @DESCRIPTION: # The package name as seen by npm. Can be used if this package name does not # align with ebuild naming standards. Defaults to ${PN}. : "${ENPM_PN:=${PN}}" # @ECLASS_VARIABLE: ENPM_PV # @USER_VARIABLE # @DESCRIPTION: # The package version as seen by npm. Can be used if this package versioning # does not align with ebuild standards. Defaults to ${PV}. : "${ENPM_PV:=${PV}}" # @ECLASS_VARIABLE: ENPM_P # @USER_VARIABLE # @DESCRIPTION: # The package name and version as seen by npm. Can be used if this package # versioning does not align with ebuild standards. Defaults to ${ENPM_PN}-${ENPM_PV}. : "${ENPM_P:=${ENPM_PN}-${ENPM_PV}}" # @ECLASS_VARIABLE: ENPM_ARGs # @DESCRIPTION: # The default arguments that will be passed to NPM commands. Defaults to # --fund=false --update-notifier=false --loglevel=info --offline : "${ENPM_ARGS:=--fund=false --update-notifier=false --loglevel=info --offline}" # @ECLASS_VARIABLE: ENPM_BIN # @DESCRIPTION: # The binary to execute when executing nvm. Defaults to /usr/bin/npm : "${ENPM_BIN:=/usr/bin/npm}" # @ECLASS_VARIABLE: ENPM # @DESCRIPTION: # The command that will be executed to invoke npm. Defaults to # ${ENPM_BIN} ${ENPM_ARGS} : "${ENPM:=${ENPM_BIN} ${ENPM_ARGS}}" : "${SRC_URI:="http://${ENPM_REGISTRY}/${ENPM_PN}/-/${ENPM_P}.tgz -> ${ENPM_REGISTRY}-${ENPM_P}.tgz"}" # @FUNCTION: npm_src_unpack # @DESCRIPTION: # Extracts the downloaded archive npm_src_unpack() { default mv package ${P} } EXPORT_FUNCTIONS src_unpack