surge-deploy
Arguments: $ARGUMENTS (required). Path to a directory containing static files
to deploy. Optionally followed by a custom subdomain (without .surge.sh).
Steps
- Resolve the deploy directory from
$ARGUMENTS. Confirm it exists and contains at least one file. - Generate a domain:
- If a custom subdomain was provided, use
<subdomain>.surge.sh. - Otherwise, generate one:
$(uuidgen | tr '[:upper:]' '[:lower:]').surge.sh
- If a custom subdomain was provided, use
- Deploy:
bunx surge "$DEPLOY_DIR" --domain "$DOMAIN" - Print the live URL:
https://$DOMAIN