From a48590feb70aec5ba0e0f96d6bef34e16700382f Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sun, 13 Oct 2024 14:55:10 -0400 Subject: [PATCH] packages(nadesiko3): add updateScript --- packages/nadesiko3.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/nadesiko3.nix b/packages/nadesiko3.nix index 347dc1ef..305a95e5 100644 --- a/packages/nadesiko3.nix +++ b/packages/nadesiko3.nix @@ -21,6 +21,28 @@ buildNpmPackage rec { dontNpmBuild = true; + passthru.updateScript = # fish + '' + set VERSION $(npm view nadesiko3 version) + and set TARBALL "nadesiko3-$VERSION.tgz" + and set URL "https://registry.npmjs.org/nadesiko3/-/$TARBALL" + and set HASH $(nix hash convert --to sri sha256:$(nix-prefetch-url "$URL")) + + and xh -d "$URL" + and tar xf "$TARBALL" --strip-components=1 package/package.json + and npm install --package-lock-only --ignore-scripts + and set NPM_HASH $(nix run nixpkgs#prefetch-npm-deps package-lock.json) + + and sd -n 1 'version = "[^"]*"' "version = \"$VERSION\"" ./packages/nadesiko3.nix + and sd -n 1 'hash = "[^"]*"' "hash = \"$HASH\"" ./packages/nadesiko3.nix + and sd -n 1 'npmDepsHash = "[^"]*"' "npmDepsHash = \"$NPM_HASH\"" ./packages/nadesiko3.nix + + and mv package-lock.json ./assets/nadesiko3-package-lock.json + + and rm package.json + and rm nadesiko3-*.tgz + ''; + meta = { description = "Japanese Programming Language Nadesiko v3 (JavaScript/TypeScript)"; homepage = "https://nadesi.com";