nixpkgs/pkgs/tools/admin/manta/update.sh
teutat3s 60737bc2d1
nodePackages.manta: convert to buildNpmPackage
Renamed package to node-manta, because manta is already taken
2023-05-06 17:51:19 +02:00

26 lines
624 B
Bash
Executable File

#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nodejs libarchive prefetch-npm-deps moreutils
# shellcheck shell=bash
set -exuo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
TMPDIR="$(mktemp -d)"
trap 'rm -r -- "$TMPDIR"' EXIT
pushd -- "$TMPDIR"
npm pack manta --json | jq '.[0] | { version, integrity, filename }' > source.json
bsdtar -x -f "$(jq -r .filename source.json)"
pushd package
npm install --package-lock-only
popd
DEPS="$(prefetch-npm-deps package/package-lock.json)"
jq ".deps = \"$DEPS\"" source.json | sponge source.json
popd
cp -t . -- "$TMPDIR/source.json" "$TMPDIR/package/package-lock.json"