Skip to content

Instantly share code, notes, and snippets.

@TooTallNate
Last active September 5, 2022 21:54

Revisions

  1. TooTallNate renamed this gist Jan 28, 2022. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions now-files.sh → vc-files.sh
    100644 → 100755
    Original file line number Diff line number Diff line change
    @@ -14,10 +14,10 @@ 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 the `vercel.json` file
    jq -n --arg file "$input" '{ version: 2, rewrites: [ { "source": "/", "destination": @uri "/\($file)" } ], builds: [ { src: "**/*", use: "@vercel/static" } ] }' > vercel.json

    # Create deployment, copying the root `url` to clipboard instead of the aliased URL
    url="$(now --prod --no-clipboard)"
    url="$(vercel --prod --no-clipboard)"
    printf "%s" "$url" | pbcopy
    echo "Unique URL: $url"
  2. TooTallNate revised this gist Apr 16, 2020. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion now-files.sh
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,6 @@ cd "$files_dir"
    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
    now --prod --no-clipboard | pbcopy
    url="$(now --prod --no-clipboard)"
    printf "%s" "$url" | pbcopy
    echo "Unique URL: $url"
  3. TooTallNate created this gist Apr 16, 2020.
    21 changes: 21 additions & 0 deletions now-files.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/bin/bash
    set -euo pipefail

    input="$1"
    shift
    files_dir="$HOME/files"
    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
    now --prod --no-clipboard | pbcopy