Luke Granger-Brown
57725ef3ec
git-subtree-dir: third_party/nixpkgs git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
25 lines
645 B
Bash
Executable file
25 lines
645 B
Bash
Executable file
#!/usr/bin/env nix-shell
|
|
#! nix-shell -i bash -p nodejs libarchive prefetch-npm-deps moreutils jq
|
|
# shellcheck shell=bash
|
|
|
|
set -exuo pipefail
|
|
|
|
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
|
|
|
TMPDIR="$(mktemp -d)"
|
|
trap 'rm -r -- "$TMPDIR"' EXIT
|
|
|
|
pushd -- "$TMPDIR"
|
|
npm pack mongosh --json | jq '.[0] | { version, integrity, filename }' > source.json
|
|
bsdtar -x -f "$(jq -r .filename source.json)"
|
|
|
|
pushd package
|
|
npm install --omit=optional --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"
|