blade-formatter: switch to yarnHooks
This commit is contained in:
parent
7783e118af
commit
caa7a66dda
13221
pkgs/by-name/bl/blade-formatter/package-lock.json
generated
13221
pkgs/by-name/bl/blade-formatter/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,33 +1,44 @@
|
|||||||
{
|
{
|
||||||
|
stdenvNoCC,
|
||||||
lib,
|
lib,
|
||||||
buildNpmPackage,
|
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
|
fetchYarnDeps,
|
||||||
|
yarnConfigHook,
|
||||||
|
yarnBuildHook,
|
||||||
|
yarnInstallHook,
|
||||||
|
nodejs,
|
||||||
|
nix-update-script,
|
||||||
testers,
|
testers,
|
||||||
writeText,
|
writeText,
|
||||||
runCommand,
|
runCommand,
|
||||||
blade-formatter,
|
blade-formatter,
|
||||||
nodejs,
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildNpmPackage rec {
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||||
pname = "blade-formatter";
|
pname = "blade-formatter";
|
||||||
version = "1.41.1";
|
version = "1.41.1";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "shufo";
|
owner = "shufo";
|
||||||
repo = "blade-formatter";
|
repo = "blade-formatter";
|
||||||
rev = "v${version}";
|
rev = "v${finalAttrs.version}";
|
||||||
hash = "sha256-iaWpIa+H+ocAXGc042PfmCu9UcJZeso9ripWB2/1oTs=";
|
hash = "sha256-iaWpIa+H+ocAXGc042PfmCu9UcJZeso9ripWB2/1oTs=";
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = ''
|
yarnOfflineCache = fetchYarnDeps {
|
||||||
cp ${./package-lock.json} ./package-lock.json
|
yarnLock = finalAttrs.src + "/yarn.lock";
|
||||||
'';
|
hash = "sha256-zn0PgLIWk23EhYeOKF2RkpvLOusVrqoBazKcJpIAzm8=";
|
||||||
|
};
|
||||||
|
|
||||||
npmDepsHash = "sha256-wEz0DTbg+Fdmsf0Qyeu9QS+I8gkPJeaJC/3HuP913og=";
|
nativeBuildInputs = [
|
||||||
|
yarnConfigHook
|
||||||
|
yarnBuildHook
|
||||||
|
yarnInstallHook
|
||||||
|
nodejs
|
||||||
|
];
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
updateScript = ./update.sh;
|
updateScript = nix-update-script { };
|
||||||
tests = {
|
tests = {
|
||||||
version = testers.testVersion {
|
version = testers.testVersion {
|
||||||
package = blade-formatter;
|
package = blade-formatter;
|
||||||
@ -64,4 +75,4 @@ buildNpmPackage rec {
|
|||||||
mainProgram = "blade-formatter";
|
mainProgram = "blade-formatter";
|
||||||
inherit (nodejs.meta) platforms;
|
inherit (nodejs.meta) platforms;
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
#!/usr/bin/env nix-shell
|
|
||||||
#!nix-shell -i bash -p ripgrep common-updater-scripts prefetch-npm-deps jq sd
|
|
||||||
|
|
||||||
set -xeu -o pipefail
|
|
||||||
|
|
||||||
PACKAGE_DIR="$(realpath "$(dirname "$0")")"
|
|
||||||
cd "$PACKAGE_DIR/.."
|
|
||||||
while ! test -f default.nix; do cd .. ; done
|
|
||||||
NIXPKGS_DIR="$PWD"
|
|
||||||
|
|
||||||
new_version="$(
|
|
||||||
list-git-tags --url=https://github.com/shufo/blade-formatter \
|
|
||||||
| rg '^v([\d.]*)' -r '$1' \
|
|
||||||
| sort --version-sort \
|
|
||||||
| tail -n1
|
|
||||||
)"
|
|
||||||
|
|
||||||
cd "$NIXPKGS_DIR"
|
|
||||||
update-source-version blade-formatter "$new_version"
|
|
||||||
|
|
||||||
TMPDIR="$(mktemp -d)"
|
|
||||||
cd "$TMPDIR"
|
|
||||||
|
|
||||||
src="$(nix-build --no-link "$NIXPKGS_DIR" -A blade-formatter.src)"
|
|
||||||
cp $src/package.json .
|
|
||||||
npm update
|
|
||||||
cp ./package-lock.json "$PACKAGE_DIR"
|
|
||||||
|
|
||||||
prev_npm_hash="$(nix-instantiate "$NIXPKGS_DIR" \
|
|
||||||
--eval --json \
|
|
||||||
-A blade-formatter.npmDepsHash \
|
|
||||||
| jq -r .
|
|
||||||
)"
|
|
||||||
new_npm_hash="$(prefetch-npm-deps ./package-lock.json)"
|
|
||||||
|
|
||||||
sd --fixed-strings "$prev_npm_hash" "$new_npm_hash" "$PACKAGE_DIR/package.nix"
|
|
||||||
|
|
||||||
rm -rf "$TMPDIR"
|
|
Loading…
Reference in New Issue
Block a user