contrib/npm/Pkgfile

49 lines
1.4 KiB
Plaintext

# Description: nodejs package manager
# URL: https://nodejs.org/
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: nodejs
name=npm
version=8.13.1
release=1
source=(https://github.com/npm/cli/archive/v$version/$name-$version.tar.gz
destdir.patch)
build() {
cd cli-$version
prt-get isinst ccache && \
PATH="$(echo ${PATH} | \
awk -v RS=: -v ORS=: '/ccache/ {next} {print}' | sed 's/:*$//')"
export npm_config_cache="$SRC/.npm/cache"
export npm_config_userconfig="$SRC/.npm/cache"
export GATSBY_TELEMETRY_DISABLED="1"
# fix some build issues
# starting with 8.6.0, `make mandocs` would remove the node_modules dir
awk -i inplace \
'/node bin\/npm-cli.js run resetdeps/ gsub(/resetdeps/, "dumpconf")' \
Makefile
node bin/npm-cli.js install marked-man --no-global --no-timing --no-save
patch -Np1 -i $SRC/destdir.patch
make mandocs
NODE_PATH=/usr/lib/node_modules node bin/npm-cli.js pack
NODE_PATH=/usr/lib/node_modules DESTDIR=$PKG node bin/npm-cli.js \
install -g -f npm-$version.tgz
mkdir -p $PKG/usr/share
mv $PKG/usr/lib/node_modules/npm/man $PKG/usr/share/
find $PKG \(\
-iname "README*" -o \
-iname "LICENCE" -o \
-iname "LICENSE" -o \
-iname "CHANGELOG" -o \
-iname "AUTHORS*" \)\
-exec rm '{}' \+
rm -r $PKG/usr/lib/node_modules/npm/docs
#$PKG/usr/lib/node_modules/npm/changelogs
}