Skip to content

Instantly share code, notes, and snippets.

@9oelM
Created November 21, 2024 03:53
Show Gist options
  • Save 9oelM/32cd5c4cf7a0c6c05acc6795d2d61d49 to your computer and use it in GitHub Desktop.
Save 9oelM/32cd5c4cf7a0c6c05acc6795d2d61d49 to your computer and use it in GitHub Desktop.

Revisions

  1. 9oelM renamed this gist Nov 21, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. 9oelM created this gist Nov 21, 2024.
    35 changes: 35 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    #!/bin/bash

    set -euv

    # Get outdated dependencies
    result=$(npm outdated | tail -n +2 | awk '{print $1}')

    # Exit early if there are no outdated dependencies
    if [ -z "$result" ]; then
    echo "No outdated dependencies found."
    exit 0
    fi

    # Ignore list for specific packages
    ignore_list=(
    "^@eslint/js$"
    "^eslint$"
    "^ethers$"
    )

    # Filter out ignored dependencies
    for i in "${ignore_list[@]}"; do
    result=$(echo "$result" | grep -v -E "$i" || true)
    done

    # Check if result is still non-empty
    if [ -n "$result" ]; then
    echo "Outdated dependencies found:"
    echo "$result"
    exit 1
    fi

    echo "No outdated dependencies found."

    set +euv