diff options
Diffstat (limited to 'repo/npm')
-rw-r--r-- | repo/npm/dont-check-for-last-version.patch | 15 | ||||
-rw-r--r-- | repo/npm/npm.xibuild | 89 | ||||
-rw-r--r-- | repo/npm/npmrc | 6 |
3 files changed, 110 insertions, 0 deletions
diff --git a/repo/npm/dont-check-for-last-version.patch b/repo/npm/dont-check-for-last-version.patch new file mode 100644 index 0000000..d2b5981 --- /dev/null +++ b/repo/npm/dont-check-for-last-version.patch @@ -0,0 +1,15 @@ +Don't check for last version + +Patch based on https://sources.debian.org/src/npm/7.5.2+ds-2/debian/patches/dont-check-for-last-version.patch + +--- a/lib/utils/update-notifier.js ++++ b/lib/utils/update-notifier.js +@@ -34,6 +34,8 @@ + } + + const updateNotifier = async (npm, spec = 'latest') => { ++ // XXX-Patched: Maintained by Alpine's package manager ++ return null; + // never check for updates in CI, when updating npm already, or opted out + if (!npm.config.get('update-notifier') || + isGlobalNpmUpdate(npm) || diff --git a/repo/npm/npm.xibuild b/repo/npm/npm.xibuild new file mode 100644 index 0000000..34232d3 --- /dev/null +++ b/repo/npm/npm.xibuild @@ -0,0 +1,89 @@ +#!/bin/sh + +NAME="npm" +DESC="The package manager for JavaScript" + +MAKEDEPS="" + +PKG_VER=8.6.0 +SOURCE="https://registry.npmjs.org/npm/-/npm-$PKG_VER.tgz" + +ADDITIONAL=" +dont-check-for-last-version.patch +npmrc +" + +prepare() { + export SRC_ROOT=npm-$PKG_VER + tar xf npm-$PKG_VER.tgz + cd $SRC_ROOT + apply_patches + + # Remove bunch of unnecessary files to reduce size of the package. + + # Wrapper scripts written in Bash and CMD. + rm bin/npm bin/npx bin/*.cmd bin/node-gyp-bin/*.cmd + rm README.md + # HTML docs + rm -rf docs + + cd node_modules + + find . -type f \( \ + -name '.*' -o \ + -name '*.cmd' -o \ + -name '*.bat' -o \ + -name '*.map' -o \ + -name '*.md' -o \ + \( -name '*.ts' -a ! -name '*.d.ts' \) -o \ + -name 'AUTHORS*' -o \ + -name 'LICENSE*' -o \ + -name 'license' -o \ + -name 'Makefile' -o \ + -name 'README*' -o \ + -name 'readme.markdown' \) -delete + rm -rf ./*/.git* ./*/doc ./*/docs ./*/examples ./*/scripts ./*/test + rm -rf ./node-gyp/gyp/.git* + + # No files should be executable here, except node-gyp. + find . -type f -executable ! -name 'node-gyp*' -exec chmod -x {} \; + + cd ../man + + # XXX: Workaround for https://github.com/npm/cli/issues/780. + local f name sec title + for f in man5/folders.5 man5/install.5 man7/*.7; do + sec=${f##*.} + name=$(basename $f .$sec) + title=$(echo "$name" | tr '[a-z]' '[A-Z]') + + sed -Ei "s/^\.TH \"$title\"/.TH \"NPM-$title\"/" "$f" + mv "$f" "${f%/*}/npm-$name.$sec" + done +} + +package() { + local destdir="$PKG_DEST/usr/lib/node_modules/npm" + + mkdir -p "$destdir" + cp -r "$SRC_ROOT"/* "$destdir"/ + cp "$SRCBUILD_ROOT"/npmrc "$destdir"/ + + cd "$PKG_DEST" + + mkdir -p usr/bin + ln -s ../lib/node_modules/npm/bin/npm-cli.js usr/bin/npm + ln -s ../lib/node_modules/npm/bin/npx-cli.js usr/bin/npx + ln -s ../lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js usr/bin/node-gyp + + mkdir -p usr/share + mv "$destdir"/man usr/share/ + ln -s ../../../share/man "$destdir"/man + + mkdir -p usr/share/licenses/npm + mv "$destdir"/LICENSE usr/share/licenses/npm/ + + install -D -m644 "$destdir"/lib/utils/completion.sh \ + "$PKG_DEST"/usr/share/bash-completion/completions/npm +} + diff --git a/repo/npm/npmrc b/repo/npm/npmrc new file mode 100644 index 0000000..4355e96 --- /dev/null +++ b/repo/npm/npmrc @@ -0,0 +1,6 @@ +# Do not modify this file - use /etc/npmrc instead! + +globalconfig=/etc/npmrc +globalignorefile=/etc/npmignore +prefix=/usr/local +python=/usr/bin/python3 |