Created
June 28, 2023 19:38
-
-
Save lubieowoce/b030f6bae2a2c62089467a2e013ddca8 to your computer and use it in GitHub Desktop.
A bash function that prints out the latest canary/experimental releases of React and links to the relevant commits
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
# Usage: | |
# | |
# react-latest [tag] | |
# | |
function react-latest { | |
local TAG=${1-experimental} | |
echo "react@$TAG" | |
echo | |
which jq > /dev/null || { echo 'please install jq'; return 1; } | |
npm view react versions --json \ | |
| jq -r '.[] | select(. | contains("'$TAG'"))' \ | |
| sort --reverse -k4 -t'-' \ | |
| head -n3 \ | |
| { | |
while read VER; do | |
HASH=$(echo $VER | cut -d- -f3); | |
DATE=$(echo $VER | cut -d- -f4 | sed -E 's/(.{4})(.{2})(.{2})/\1-\2-\3/'); | |
echo "published: $DATE"; | |
echo $VER; | |
echo "https://github.com/facebook/react/commit/$HASH"; | |
echo; | |
done | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
here's an updated version actually just uses node for everything for some fancier functionality like "diff to previous" and "since " (was too annoying to write in bash)