Unverified Commit 9ebfe6d2 authored by Michael Daniels's avatar Michael Daniels Committed by GitHub
Browse files

tsx: modernize, 4.19.3 -> 4.21.0, add self as maintainer (#458471)

parents e2914ac8 8db56aee
Loading
Loading
Loading
Loading
+21 −12
Original line number Diff line number Diff line
@@ -2,35 +2,36 @@
  lib,
  stdenv,
  fetchFromGitHub,
  pnpm_9,
  pnpm_10,
  fetchPnpmDeps,
  pnpmConfigHook,
  nodejs_22,
  versionCheckHook,
  nix-update-script,
}:
let
  pnpm' = pnpm_9.override { nodejs = nodejs_22; };
  pnpm' = pnpm_10.override { nodejs = nodejs_22; };
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "tsx";
  version = "4.19.3";
  version = "4.21.0";

  src = fetchFromGitHub {
    owner = "privatenumber";
    repo = "tsx";
    tag = "v${version}";
    hash = "sha256-wdv2oqJNc6U0Fyv4jT+0LUcYaDfodHk1vQZGMdyFF/E=";
    tag = "v${finalAttrs.version}";
    hash = "sha256-vlVRq637l84xi9Og0ryzYuu+1b/eBq13jQJIptY0u0o=";
  };

  pnpmDeps = fetchPnpmDeps {
    inherit
    inherit (finalAttrs)
      pname
      version
      src
      ;
    pnpm = pnpm';
    fetcherVersion = 1;
    hash = "sha256-57KDZ9cHb7uqnypC0auIltmYMmIhs4PWyf0HTRWEFiU=";
    hash = "sha256-6ZizQtZC43yXrz634VXksRCKGkDKryICvT3Q+JCuIEw=";
  };

  nativeBuildInputs = [
@@ -54,7 +55,7 @@ stdenv.mkDerivation rec {
    # because tsx uses semantic-release, the package.json has a placeholder
    #  version number. this patches it to match the version of the nix package,
    #  which in turn is the release version in github.
    substituteInPlace package.json --replace-fail "0.0.0-semantic-release" "${version}"
    substituteInPlace package.json --replace-fail "0.0.0-semantic-release" "${finalAttrs.version}"

    runHook postPatch
  '';
@@ -62,7 +63,10 @@ stdenv.mkDerivation rec {
  buildPhase = ''
    runHook preBuild

    npm run build
    pnpm run build

    # remove unneeded files
    find dist -type f \( -name '*.cts' -or -name '*.mts' -or -name '*.ts' \) -delete

    # remove devDependencies that are only required to build
    #  and package the typescript code
@@ -93,11 +97,16 @@ stdenv.mkDerivation rec {
  ];
  doInstallCheck = true;

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "TypeScript Execute (tsx): The easiest way to run TypeScript in Node.js";
    homepage = "https://tsx.is";
    license = lib.licenses.mit;
    maintainers = [ lib.maintainers.sdedovic ];
    maintainers = with lib.maintainers; [
      sdedovic
      higherorderlogic
    ];
    mainProgram = "tsx";
  };
}
})