pnpm-lock-export: use fork with v6 support

This commit is contained in:
Bruno BELANYI 2023-07-30 13:39:24 +01:00 committed by Anderson Torres
parent 24a04f48c1
commit 1e0ff6105a
3 changed files with 2521 additions and 928 deletions

View File

@ -1,16 +1,16 @@
{ lib, buildNpmPackage, fetchFromGitHub }:
buildNpmPackage rec {
pname = "pnpm-lock-export";
version = "0.4.0";
version = "unstable-2023-07-31";
src = fetchFromGitHub {
owner = "cvent";
owner = "adamcstephens";
repo = "pnpm-lock-export";
rev = "v${version}";
hash = "sha256-vS6AW3R4go1Fdr3PBOCnuN4JDrDkl1lWVF7q+q+xDGg=";
rev = "cc03755d6718a9c0d268d0f375907328ac15dc92";
hash = "sha256-9OlFgmdKjvz4pB36Wm/fUAQDsD8zs32OSA3m2IAgrH8=";
};
npmDepsHash = "sha256-3uW/lzB+UDhFQtRb3X8szNlgAWTcSdwVdtyZvLu+cjI=";
npmDepsHash = "sha256-nqkH7vFD78YvYr9Klguk2o7qHr5wr3ZjaywUKRRRjJo=";
postPatch = ''
cp ${./package-lock.json} package-lock.json

File diff suppressed because it is too large Load Diff

View File

@ -16,22 +16,19 @@ fi
set -x
cd "$(dirname "$0")"
version="$1"
rev="$1"
set -euo pipefail
if [ -z "$version" ]; then
version="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/cvent/pnpm-lock-export/releases?per_page=1" | jq -r '.[0].tag_name')"
if [ -z "$rev" ]; then
rev="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/adamcstephens/pnpm-lock-export/commits?per_page=1" | jq -r '.[0].sha')"
fi
# strip leading "v"
version="${version#v}"
# pnpm-lock-export repository
src_hash=$(nix-prefetch-github cvent pnpm-lock-export --rev "v${version}" | jq -r .hash)
src_hash=$(nix-prefetch-github adamcstephens pnpm-lock-export --rev "${rev}" | jq -r .hash)
# Front-end dependencies
upstream_src="https://raw.githubusercontent.com/cvent/pnpm-lock-export/v$version"
upstream_src="https://raw.githubusercontent.com/adamcstephens/pnpm-lock-export/${rev}"
trap 'rm -rf package.json' EXIT
wget "${TOKEN_ARGS[@]}" "$upstream_src/package.json"
@ -41,6 +38,6 @@ deps_hash=$(prefetch-npm-deps package-lock.json)
# Use friendlier hashes
deps_hash=$(nix hash to-sri --type sha256 "$deps_hash")
sed -i -E -e "s#version = \".*\"#version = \"$version\"#" default.nix
sed -i -E -e "s#rev = \".*\"#rev = \"$rev\"#" default.nix
sed -i -E -e "s#hash = \".*\"#hash = \"$src_hash\"#" default.nix
sed -i -E -e "s#npmDepsHash = \".*\"#npmDepsHash = \"$deps_hash\"#" default.nix