Skip to content

Commit 28ab191

Browse files
prettierd: 0.25.3 -> 0.26.1 (#383524)
2 parents b5dfb3f + def2a5a commit 28ab191

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

pkgs/by-name/pr/prettierd/package.nix

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,24 @@
77
yarnBuildHook,
88
yarnInstallHook,
99
nodejs,
10+
nix-update-script,
11+
runCommand,
1012
}:
1113

1214
stdenv.mkDerivation (finalAttrs: {
1315
pname = "prettierd";
14-
version = "0.25.3";
16+
version = "0.26.1";
1517

1618
src = fetchFromGitHub {
1719
owner = "fsouza";
1820
repo = "prettierd";
1921
tag = "v${finalAttrs.version}";
20-
hash = "sha256-3lvFZ5/p+1kPnHIR2PlQtCY3SVo1rs8IuBigLaabxAE=";
22+
hash = "sha256-8IlPC4KCFKJAbCVPl+vK9WustevKHOLbh41F6vMwHX4=";
2123
};
2224

2325
offlineCache = fetchYarnDeps {
2426
yarnLock = finalAttrs.src + "/yarn.lock";
25-
hash = "sha256-Ti2b102pzUKB6Xy3LwZ7DlrnW0cRscgNLTUIAKz+6Us=";
27+
hash = "sha256-M7mLkDHJa4iz6u3LSIIq3xCbYbiR0pPAkOK1MjJKstI=";
2628
};
2729

2830
strictDeps = true;
@@ -34,6 +36,26 @@ stdenv.mkDerivation (finalAttrs: {
3436
nodejs
3537
];
3638

39+
# launch the daemon with the same node version used to run the CLI
40+
# fixes "Error: spawn node ENOENT" if node isn't available on the user's path
41+
postInstall = ''
42+
wrapProgram $out/bin/prettierd \
43+
--prefix PATH : ${lib.makeBinPath [ nodejs ]}
44+
'';
45+
46+
passthru = {
47+
updateScript = nix-update-script { };
48+
49+
tests = lib.optionalAttrs (!stdenv.hostPlatform.isDarwin) {
50+
format =
51+
runCommand "prettierd-format-file-test" { nativeBuildInputs = [ finalAttrs.finalPackage ]; }
52+
''
53+
export HOME=$(mktemp -d)
54+
prettierd ${finalAttrs.src}/package.json < ${finalAttrs.src}/package.json > $out
55+
'';
56+
};
57+
};
58+
3759
meta = {
3860
mainProgram = "prettierd";
3961
description = "Prettier, as a daemon, for improved formatting speed";

0 commit comments

Comments
 (0)