Skip to content

Instantly share code, notes, and snippets.

@mxcl
Last active October 31, 2023 17:22
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mxcl/046e6005328b13a53108d267df3b087a to your computer and use it in GitHub Desktop.
Save mxcl/046e6005328b13a53108d267df3b087a to your computer and use it in GitHub Desktop.
All-in-one Script to Generate your @pomber/stargazer video
#!/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
@denjell-crabnebula
Copy link

I had to install the deps first, maybe a smart thing to do after line 12.

@mxcl
Copy link
Author

mxcl commented Oct 31, 2023

@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

@denjell-crabnebula
Copy link

I meant the node dependencies inside the stargazer repo... the script didn't complete. It showed me:

> stargazer@1.0.0 build
> remotion render main out/Main.mp4 --log verbose --props=./stargazer.json

sh: remotion: command not found

@mxcl
Copy link
Author

mxcl commented Oct 31, 2023

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