Unverified Commit eb3f83fb authored by dish's avatar dish Committed by GitHub
Browse files

cspell: 9.2.1 -> 9.3.2, cleanup (#464734)

parents 25a3ad80 ad02cb58
Loading
Loading
Loading
Loading
+0 −799

File deleted.

Preview size limit exceeded, changes collapsed.

+29 −14
Original line number Diff line number Diff line
@@ -4,40 +4,32 @@
  nodejs,
  pnpm_10,
  fetchFromGitHub,
  gitMinimal,
  nix-update-script,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "cspell";
  version = "9.2.1";
  version = "9.3.2";

  src = fetchFromGitHub {
    owner = "streetsidesoftware";
    repo = "cspell";
    tag = "v${finalAttrs.version}";
    hash = "sha256-xQCE6YWCvlWjcpf2nCBjbdI76qejlvHdWiUCD4SZhRg=";
    hash = "sha256-XF94Bkxx+OAEldRD4L8TBokuzgGil0LaPBUbNBiEcVE=";
  };

  patches = [
    ./inject-workplace-deps.patch
  ];

  pnpmWorkspaces = [ "cspell..." ];

  prePnpmInstall = ''
    pnpm config set --location=project inject-workplace-packages true
  '';

  pnpmDeps = pnpm_10.fetchDeps {
    inherit (finalAttrs)
      pname
      version
      src
      pnpmWorkspaces
      patches
      prePnpmInstall
      ;
    fetcherVersion = 2;
    hash = "sha256-aE7DHyXPLziVjW9bBL98fFRiPwOFIyU5edbj8rEws6U=";
    hash = "sha256-lp3rXW16/w3ZPXTg/B951SL/WN+QpUQLPjlvc6QaU20=";
  };

  nativeBuildInputs = [
@@ -47,6 +39,7 @@ stdenv.mkDerivation (finalAttrs: {

  buildInputs = [
    nodejs
    gitMinimal
  ];

  buildPhase = ''
@@ -57,18 +50,40 @@ stdenv.mkDerivation (finalAttrs: {
    runHook postBuild
  '';

  # Make PNPM happy to re-install deps for prod
  env.CI = true;

  installPhase = ''
    runHook preInstall

    mkdir -p $out/lib/node_modules/cspell
    mkdir $out/bin
    pnpm --filter="cspell" --offline --prod deploy $out/lib/node_modules/cspell

    # Re-install only production dependencies
    rm -rf node_modules packages/*/node_modules scripts/node_modules
    pnpm config set nodeLinker hoisted
    pnpm config set preferSymlinkedExecutables false
    pnpm --filter="cspell..." --offline --prod install

    mv ./package.json ./packages ./bin.mjs ./node_modules $out/lib/node_modules/cspell
    # Clean up unneeded files
    pushd $out/lib/node_modules/cspell/packages
    rm -rf */*.md */tsconfig.* */LICENSE Samples */**/*.test.{j,t}s */**/*.map */__snapshots__ */src */Samples
    # These are example dictionaries, and are not needed
    rm -rf hunspell-reader/dictionaries
    pushd cspell
    rm -rf dist/tsc
    rm -rf samples/ fixtures/ tools/ static/
    popd
    popd

    ln -s $out/lib/node_modules/cspell/bin.mjs $out/bin/cspell

    runHook postInstall
  '';

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

  meta = {
    description = "Spell checker for code";
    homepage = "https://cspell.org";