Skip to content

Instantly share code, notes, and snippets.



Last active Apr 16, 2020
What would you like to do?
Uploads a single file as a Now deployment
set -euo pipefail
mkdir -p "$files_dir"
# Delete old files
rm -f "$files_dir"/*
# Copy in the source file
cp "$input" "$files_dir"
cd "$files_dir"
# Create the `now.json` file
jq -n --arg file "$input" '{ version: 2, rewrites: [ { "source": "/", "destination": @uri "/\($file)" } ], builds: [ { src: "**/*", use: "@now/static" } ] }' > now.json
# Create deployment, copying the root `url` to clipboard instead of the aliased URL
url="$(now --prod --no-clipboard)"
printf "%s" "$url" | pbcopy
echo "Unique URL: $url"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.