Commit dc531c29 authored by HigherOrderLogic's avatar HigherOrderLogic
Browse files

tsx: modernize

parent 87e53c6f
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -2,35 +2,35 @@
  lib,
  stdenv,
  fetchFromGitHub,
  pnpm_9,
  pnpm_10,
  fetchPnpmDeps,
  pnpmConfigHook,
  nodejs_22,
  versionCheckHook,
}:
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";

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

  pnpmDeps = fetchPnpmDeps {
    inherit
    inherit (finalAttrs)
      pname
      version
      src
      ;
    pnpm = pnpm';
    fetcherVersion = 1;
    hash = "sha256-57KDZ9cHb7uqnypC0auIltmYMmIhs4PWyf0HTRWEFiU=";
    hash = "sha256-IDPXEmACa+JbScp+CKJLW9S4MGgfQwS4ZYMvDL++Hy4=";
  };

  nativeBuildInputs = [
@@ -54,7 +54,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 +62,7 @@ stdenv.mkDerivation rec {
  buildPhase = ''
    runHook preBuild

    npm run build
    pnpm run build

    # remove devDependencies that are only required to build
    #  and package the typescript code
@@ -101,4 +101,4 @@ stdenv.mkDerivation rec {
    maintainers = [ lib.maintainers.sdedovic ];
    mainProgram = "tsx";
  };
}
})