2024-06-24 18:47:55 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildNpmPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
npm-lockfile-fix,
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildNpmPackage rec {
|
|
|
|
pname = "protoc-gen-es";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "2.0.0";
|
2024-06-24 18:47:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bufbuild";
|
|
|
|
repo = "protobuf-es";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-foPt++AZjBfqKepzi2mKXB7zbpCqjmPftN9wyk5Yk8g=";
|
2024-06-24 18:47:55 +00:00
|
|
|
|
|
|
|
postFetch = ''
|
|
|
|
${lib.getExe npm-lockfile-fix} $out/package-lock.json
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
npmDepsHash = "sha256-4m3xeiid+Ag9l1qNoBH08hu3wawWfNw1aqeniFK0Byc=";
|
2024-06-24 18:47:55 +00:00
|
|
|
|
|
|
|
npmWorkspace = "packages/protoc-gen-es";
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
npm run --workspace=packages/protobuf build
|
|
|
|
npm run --workspace=packages/protoplugin build
|
|
|
|
'';
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
# copy npm workspace modules while properly resolving symlinks
|
|
|
|
# TODO: workaround can be removed once this is merged: https://github.com/NixOS/nixpkgs/pull/333759
|
|
|
|
postInstall = ''
|
|
|
|
rm -rf $out/lib/node_modules/protobuf-es/node_modules/@bufbuild
|
|
|
|
cp -rL node_modules/@bufbuild $out/lib/node_modules/protobuf-es/node_modules/
|
|
|
|
'';
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Protobuf plugin for generating ECMAScript code";
|
|
|
|
homepage = "https://github.com/bufbuild/protobuf-es";
|
|
|
|
changelog = "https://github.com/bufbuild/protobuf-es/releases/tag/v${version}";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
felschr
|
|
|
|
jtszalay
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|