-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243432 from felschr/protoc-gen-connect-es
protoc-gen-es: init at 1.10.0, protoc-gen-connect-es: init at 1.4.0
- Loading branch information
Showing
5 changed files
with
145 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
lib, | ||
buildNpmPackage, | ||
fetchFromGitHub, | ||
npm-lockfile-fix, | ||
}: | ||
|
||
buildNpmPackage rec { | ||
pname = "protoc-gen-connect-es"; | ||
version = "1.4.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "connectrpc"; | ||
repo = "connect-es"; | ||
rev = "refs/tags/v${version}"; | ||
hash = "sha256-qCIwr4Hyc5PARUa7tMntuyWRmO6ognmtjxN0myo8FXc="; | ||
|
||
postFetch = '' | ||
${lib.getExe npm-lockfile-fix} $out/package-lock.json | ||
''; | ||
}; | ||
|
||
npmDepsHash = "sha256-OGwEpXZqzMSIES+cmseQlo6/vzkx5ztO0gM/rUB0tGY="; | ||
|
||
npmWorkspace = "packages/protoc-gen-connect-es"; | ||
|
||
passthru.updateScript = ./update.sh; | ||
|
||
meta = with lib; { | ||
description = "Protobuf plugin for generating Connect-ecompatiblenabled ECMAScript code"; | ||
homepage = "https://github.com/connectrpc/connect-es"; | ||
changelog = "https://github.com/connectrpc/connect-es/releases/tag/v${version}"; | ||
license = licenses.asl20; | ||
maintainers = with maintainers; [ | ||
felschr | ||
jtszalay | ||
]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#! /usr/bin/env -S nix shell nixpkgs#gnugrep nixpkgs#gnused nixpkgs#coreutils nixpkgs#curl nixpkgs#wget nixpkgs#jq nixpkgs#nix-update nixpkgs#prefetch-npm-deps nixpkgs#npm-lockfile-fix nixpkgs#nodejs --command bash | ||
|
||
set -euo pipefail | ||
|
||
version="$( | ||
curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https://api.github.com/repos/connectrpc/connect-es/releases" | | ||
jq -r 'map(select(.prerelease == false)) | .[0].tag_name' | | ||
grep -oP "^v\K.*" | ||
)" | ||
url="https://raw.githubusercontent.com/connectrpc/connect-es/v$version/" | ||
|
||
if [[ "$UPDATE_NIX_OLD_VERSION" == "$version" ]]; then | ||
echo "Already up to date!" | ||
exit 0 | ||
fi | ||
|
||
tmp="$(mktemp -d)" | ||
trap 'rm -rf -- "$tmp"' EXIT | ||
|
||
pushd -- "$tmp" | ||
wget "$url/package-lock.json" | ||
npm-lockfile-fix package-lock.json | ||
npm_hash=$(prefetch-npm-deps package-lock.json) | ||
popd | ||
|
||
pushd "$(dirname "${BASH_SOURCE[0]}")" | ||
sed -i 's#npmDepsHash = "[^"]*"#npmDepsHash = "'"$npm_hash"'"#' package.nix | ||
popd | ||
|
||
nix-update protoc-gen-connect-es --version "$version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
lib, | ||
buildNpmPackage, | ||
fetchFromGitHub, | ||
npm-lockfile-fix, | ||
}: | ||
|
||
buildNpmPackage rec { | ||
pname = "protoc-gen-es"; | ||
version = "1.10.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "bufbuild"; | ||
repo = "protobuf-es"; | ||
rev = "refs/tags/v${version}"; | ||
hash = "sha256-bHl8gqNrTm1+Cnj43RWmrLDUz+G11C4gprEiNOpyOdQ="; | ||
|
||
postFetch = '' | ||
${lib.getExe npm-lockfile-fix} $out/package-lock.json | ||
''; | ||
}; | ||
|
||
npmDepsHash = "sha256-ozkkakfSBycu83gTs8Orhm5Tg8kRSrF/vMJxVnPjhIw="; | ||
|
||
npmWorkspace = "packages/protoc-gen-es"; | ||
|
||
preBuild = '' | ||
npm run --workspace=packages/protobuf build | ||
npm run --workspace=packages/protoplugin build | ||
''; | ||
|
||
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 | ||
]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#! /usr/bin/env -S nix shell nixpkgs#gnugrep nixpkgs#gnused nixpkgs#coreutils nixpkgs#curl nixpkgs#wget nixpkgs#jq nixpkgs#nix-update nixpkgs#prefetch-npm-deps nixpkgs#npm-lockfile-fix nixpkgs#nodejs --command bash | ||
|
||
set -euo pipefail | ||
|
||
version="$( | ||
curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https://api.github.com/repos/bufbuild/protobuf-es/releases" | | ||
jq -r 'map(select(.prerelease == false)) | .[0].tag_name' | | ||
grep -oP "^v\K.*" | ||
)" | ||
url="https://raw.githubusercontent.com/bufbuild/protobuf-es/v$version/" | ||
|
||
if [[ "$UPDATE_NIX_OLD_VERSION" == "$version" ]]; then | ||
echo "Already up to date!" | ||
exit 0 | ||
fi | ||
|
||
tmp="$(mktemp -d)" | ||
trap 'rm -rf -- "$tmp"' EXIT | ||
|
||
pushd -- "$tmp" | ||
wget "$url/package-lock.json" | ||
npm-lockfile-fix package-lock.json | ||
npm_hash=$(prefetch-npm-deps package-lock.json) | ||
popd | ||
|
||
pushd "$(dirname "${BASH_SOURCE[0]}")" | ||
sed -i 's#npmDepsHash = "[^"]*"#npmDepsHash = "'"$npm_hash"'"#' package.nix | ||
popd | ||
|
||
nix-update protoc-gen-es --version "$version" |