-
-
Save vaibhavsagar/24b1754b8a269fd8c54a89cb73e64fa8 to your computer and use it in GitHub Desktop.
Simple reflex-platform app with JavaScript interop.
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
#! /usr/bin/env nix-shell | |
#! nix-shell -i bash | |
#! nix-shell -p curl jq nix | |
set -eufo pipefail | |
FILE=$1 | |
PROJECT=$2 | |
OWNER=$(jq -r '.[$project].owner' --arg project "$PROJECT" < "$FILE") | |
REPO=$(jq -r '.[$project].repo' --arg project "$PROJECT" < "$FILE") | |
DEFAULT_BRANCH=$(jq -r '.[$project].branch // "master"' --arg project "$PROJECT" < "$FILE") | |
BRANCH=${3:-$DEFAULT_BRANCH} | |
REV=$(curl "https://api.github.com/repos/$OWNER/$REPO/branches/$BRANCH" | jq -r '.commit.sha') | |
SHA256=$(nix-prefetch-url --unpack "https://github.com/$OWNER/$REPO/tarball/$REV") | |
TJQ=$(jq '.[$project] = {owner: $owner, repo: $repo, branch: $branch, rev: $rev, sha256: $sha256}' \ | |
--arg project "$PROJECT" \ | |
--arg owner "$OWNER" \ | |
--arg repo "$REPO" \ | |
--arg branch "$BRANCH" \ | |
--arg rev "$REV" \ | |
--arg sha256 "$SHA256" \ | |
< "$FILE") | |
[[ $? == 0 ]] && echo "${TJQ}" >| "$FILE" |
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
{ | |
"reflex-platform": { | |
"owner": "reflex-frp", | |
"repo": "reflex-platform", | |
"branch": "develop", | |
"rev": "8f4b8973a06f78c7aaf1a222f8f8443cd934569f", | |
"sha256": "167smg7dyvg5yf1wn9bx6yxvazlk0qk64rzgm2kfzn9mx873s0vp" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment