FEAT: Package npm
This commit is contained in:
parent
65c7b95ad4
commit
3d6f8c0d1b
2 changed files with 82 additions and 0 deletions
67
packages/npm/Containerfile
Normal file
67
packages/npm/Containerfile
Normal file
|
@ -0,0 +1,67 @@
|
|||
FROM scratch AS base
|
||||
ENV VERSION=10.8.3
|
||||
ENV SRC_HASH=b7dc7eb48d7479b93668e913c7ad686ab2aa71c705d4a56b5323d1bffdba2972
|
||||
ENV SRC_FILE=npm-${VERSION}.tgz
|
||||
ENV SRC_SITE=https://registry.npmjs.org/npm/-/${SRC_FILE}
|
||||
|
||||
FROM base AS fetch
|
||||
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
||||
|
||||
FROM fetch AS build
|
||||
COPY --from=stagex/musl . /
|
||||
COPY --from=stagex/busybox . /
|
||||
RUN tar -xf ${SRC_FILE}
|
||||
WORKDIR /package
|
||||
ADD *.patch .
|
||||
|
||||
FROM build AS install
|
||||
ENV DESTDIR=/rootfs
|
||||
RUN --network=none <<-EOF
|
||||
patch -p1 < dont-check-for-last-version.patch
|
||||
rm bin/npm bin/npx bin/*.cmd
|
||||
rm README.md
|
||||
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 /package
|
||||
destdir="usr/lib/node_modules/npm"
|
||||
|
||||
mkdir -p $DESTDIR/$destdir
|
||||
cp -R ./* $DESTDIR/$destdir
|
||||
|
||||
cd $DESTDIR
|
||||
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/licenses/npm
|
||||
mv ${destdir}/LICENSE usr/share/licenses/npm/
|
||||
|
||||
install -D -m644 "$destdir"/lib/utils/completion.sh \
|
||||
usr/share/bash-completion/completions/npm
|
||||
EOF
|
||||
|
||||
FROM stagex/filesystem AS package
|
||||
COPY --from=install /rootfs/. /
|
||||
|
15
packages/npm/dont-check-for-last-version.patch
Normal file
15
packages/npm/dont-check-for-last-version.patch
Normal file
|
@ -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/cli/update-notifier.js
|
||||
+++ b/lib/cli/update-notifier.js
|
||||
@@ -76,6 +76,8 @@ const updateCheck = async (npm, spec, version, current) => {
|
||||
}
|
||||
|
||||
const updateNotifier = async (npm, spec = 'latest') => {
|
||||
+ // XXX-Patched: Maintained by Alpine's package manager
|
||||
+ return null;
|
||||
// if we're on a prerelease train, then updates are coming fast
|
||||
// check for a new one daily. otherwise, weekly.
|
||||
const { version } = npm
|
Loading…
Reference in a new issue