Last active
October 31, 2023 17:22
-
-
Save mxcl/046e6005328b13a53108d267df3b087a to your computer and use it in GitHub Desktop.
All-in-one Script to Generate your @pomber/stargazer video
This file contains hidden or 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 -S pkgx +git +gum +gh +npm +jq bash | |
# ^^ curl https://pkgx.sh | sh | |
# ^^ pkgx makes all those tools (including bash!) available to the script | |
# no packages are installed; your system remains pristine | |
set -eo pipefail | |
if [ -d stargazer/.git ]; then | |
cd stargazer | |
elif [ ! -d .git ] && gum confirm 'clone to ./stargazer?'; then | |
git clone https://github.com/pomber/stargazer | |
cd stargazer | |
npm i | |
fi | |
export REMOTION_GITHUB_TOKEN=$(gh auth token) | |
if [ -f stargazer.json ]; then | |
user=$(cat stargazer.json | jq --raw-output .repoOrg) | |
repo=$(cat stargazer.json | jq --raw-output .repoName) | |
stars=$(cat stargazer.json | jq --raw-output .starCount) | |
duration=$(cat stargazer.json | jq --raw-output .duration) | |
else | |
duration=15 | |
fi | |
user=$(gum input --prompt='user or org > ' --value=${user}) | |
repo=$(gum input --prompt='repo name > ' --value=${repo}) | |
stars=$(gum input --prompt='stars to stop at > ' --value=${stars}) | |
duration=$(gum input --prompt='duration in seconds > ' --value=${duration}) | |
cat << EoCAT >stargazer.json | |
{ | |
"repoOrg": "${user}", | |
"repoName": "${repo}", | |
"starCount": ${stars}, | |
"duration": ${duration} | |
} | |
EoCAT | |
npm run build -- --props=./stargazer.json |
I meant the node dependencies inside the stargazer repo... the script didn't complete. It showed me:
> [email protected] build
> remotion render main out/Main.mp4 --log verbose --props=./stargazer.json
sh: remotion: command not found
oh, my bad. will fix. Thanks for the headsup. Edit: fixed and tested
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@denjell-crabnebula for sure you can source the deps yourself, though this script is mean to illustrate the power of the
pkgx
shebang: https://docs.pkgx.sh/run-anywhere/scripts#shebangs