Skip to content

Commit

Permalink
pyright: 1.1.382 -> 1.1.391
Browse files Browse the repository at this point in the history
  • Loading branch information
kalekseev committed Dec 20, 2024
1 parent 7c98986 commit 84b4147
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 108 deletions.
133 changes: 37 additions & 96 deletions pkgs/by-name/py/pyright/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions pkgs/by-name/py/pyright/package.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{ lib, buildNpmPackage, fetchFromGitHub, runCommand, jq }:
{
lib,
buildNpmPackage,
fetchFromGitHub,
runCommand,
jq,
}:

let
version = "1.1.382";
version = "1.1.391";

src = fetchFromGitHub {
owner = "Microsoft";
repo = "pyright";
rev = "${version}";
hash = "sha256-/qmDCx1bkqCF/4T3jNz2xiUYwnVYw5IOguRW8DYVQZg=";
hash = "sha256-QtdqMysK1vNqOFv2KQLlTGiCYwb1OWQ1jHITaiKv1hE=";
};

patchedPackageJSON = runCommand "package.json" { } ''
Expand All @@ -20,7 +26,8 @@ let
pyright-root = buildNpmPackage {
pname = "pyright-root";
inherit version src;
npmDepsHash = "sha256-63kUhKrxtJhwGCRBnxBfOFXs2ARCNn+OOGu6+fSJey4=";
sourceRoot = "${src.name}"; # required for update.sh script
npmDepsHash = "sha256-FqEh212Npa2Sye7qeKQJQukNc/nhNVCUp2HoypGGoOA=";
dontNpmBuild = true;
postPatch = ''
cp ${patchedPackageJSON} ./package.json
Expand All @@ -37,7 +44,7 @@ let
pname = "pyright-internal";
inherit version src;
sourceRoot = "${src.name}/packages/pyright-internal";
npmDepsHash = "sha256-zITMHDiZTEbRy/1aqeCrnr9NaO1IUZ1enDw4LXjUjxs=";
npmDepsHash = "sha256-E/zWZnDJd+4HnXYqW1ONoP7Gm+Tmn+8x3y3PIeS3Z3k=";
dontNpmBuild = true;
installPhase = ''
runHook preInstall
Expand All @@ -51,7 +58,7 @@ buildNpmPackage rec {
inherit version src;

sourceRoot = "${src.name}/packages/pyright";
npmDepsHash = "sha256-Ibeg9LgqUhxCgnNryk8ZYu4wNOmVbFHz8ZklNH6msoM=";
npmDepsHash = "sha256-1InoNbKMYNsaAAnlOMutnrwBjM1MroEvR5X9f5id/MA=";

postPatch = ''
chmod +w ../../
Expand Down
20 changes: 14 additions & 6 deletions pkgs/by-name/py/pyright/update.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnused common-updater-scripts jq prefetch-npm-deps
#!nix-shell -i bash -p curl gnused common-updater-scripts jq prefetch-npm-deps nodejs
set -euo pipefail

version=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s https://api.github.com/repos/microsoft/pyright/releases/latest | jq -r '.tag_name | sub("^v"; "")')
Expand All @@ -18,11 +18,19 @@ update_hash() {
local source_root_path="$1"
local existing_hash="$2"

# Formulate download URL
local download_url="${REPO_URL_PREFIX}/${version}${source_root_path}/package-lock.json"

# Download package-lock.json to temporary directory
curl -fsSL -o "${TEMP_DIR}/package-lock.json" "$download_url"
local package_url="${REPO_URL_PREFIX}/${version}${source_root_path}"
if [ "$source_root_path" == "" ]; then
pushd "${TEMP_DIR}"
curl -fsSL "$package_url/package.json" | jq '
.devDependencies |= with_entries(select(.key == "glob" or .key == "jsonc-parser"))
| .scripts = { }
' > package.json
npm install --package-lock
cp package-lock.json "$root/package-lock.json"
popd
else
curl -fsSL -o "${TEMP_DIR}/package-lock.json" "$package_url/package-lock.json"
fi

# Calculate the new hash
local new_hash
Expand Down

0 comments on commit 84b4147

Please sign in to comment.