typescript: cleanup

- add updateScript

- prefer finalAttrs

- remove `with lib;`

- prefer tag rather than rev for fetchFromGitHub

authored by Kenichi Kamiya and committed by Masum Reza 6262669c c2e3ef65

+15 -6
+15 -6
pkgs/by-name/ty/typescript/package.nix
··· 3 3 buildNpmPackage, 4 4 fetchFromGitHub, 5 5 versionCheckHook, 6 + nix-update-script, 6 7 }: 7 8 8 - buildNpmPackage rec { 9 + buildNpmPackage (finalAttrs: { 9 10 pname = "typescript"; 10 11 version = "5.8.2"; 11 12 12 13 src = fetchFromGitHub { 13 14 owner = "microsoft"; 14 15 repo = "TypeScript"; 15 - rev = "v${version}"; 16 + tag = "v${finalAttrs.version}"; 16 17 hash = "sha256-fOA5IblxUd+C9ST3oI8IUmTTRL3exC63MPqW5hoWN0M="; 17 18 }; 18 19 ··· 29 30 versionCheckProgram = "${placeholder "out"}/bin/tsc"; 30 31 versionCheckProgramArg = "--version"; 31 32 32 - meta = with lib; { 33 + passthru = { 34 + updateScript = nix-update-script { 35 + extraArgs = [ 36 + "--version-regex=^v([\\d.]+)$" 37 + ]; 38 + }; 39 + }; 40 + 41 + meta = { 33 42 description = "Superset of JavaScript that compiles to clean JavaScript output"; 34 43 homepage = "https://www.typescriptlang.org/"; 35 - changelog = "https://github.com/microsoft/TypeScript/releases/tag/v${version}"; 36 - license = licenses.asl20; 44 + changelog = "https://github.com/microsoft/TypeScript/releases/tag/v${finalAttrs.version}"; 45 + license = lib.licenses.asl20; 37 46 maintainers = [ ]; 38 47 mainProgram = "tsc"; 39 48 }; 40 - } 49 + })