1 #!/usr/bin/env nix-shell
2 #! nix-shell -i bash -p nodejs libarchive prefetch-npm-deps moreutils
3 # shellcheck shell=bash
7 cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
10 trap 'rm -r -- "$TMPDIR"' EXIT
13 npm pack
"@vht/yarn-lock-converter" --json | jq
'.[0] | { version, integrity, filename }' > source.json
14 bsdtar
-x -f "$(jq -r .filename source.json)"
17 npm
install --package-lock-only
20 DEPS
="$(prefetch-npm-deps package/package-lock.json)"
21 jq
".deps = \"$DEPS\"" source.json | sponge
source.json
25 cp -t .
-- "$TMPDIR/source.json" "$TMPDIR/package/package-lock.json"