Coder Social home page Coder Social logo

Comments (6)

christopherthielen avatar christopherthielen commented on April 27, 2024 1

I'm closing this for now, but would gladly merge a reasonable PR.

from check-peer-dependencies.

jpnelson avatar jpnelson commented on April 27, 2024 1

Hi! Thanks for making and supporting a really useful library!

My use case is somewhat similar to what was originally described, but a little more particular – I'd like to ignore, but also restrict the violations to a specific set of known violations. We're effectively creating an allow-list of exceptions, so we can ratchet down those exceptions over time.

For that I made a custom script that does what was originally described here, but a node API that returned strings and statuses (rather than console.log / process.exit) would be helpful for that purpose. I imagine this use case is a little bit too niche to support as cli arguments, but maybe a node API would be useful for it. I've similarly made do with using exec and parsing the output in the meantime though, so it's not a blocker for us using this library.

from check-peer-dependencies.

internalsystemerror avatar internalsystemerror commented on April 27, 2024

likewise for use with renovate... there are certain peer dependencies that I would like to skip, and to fail for anything else...

For reference, here is the bash script I'm using at the moment:

#!/bin/bash

set -e

# Set allowed missing peer dependencies
ALLOWED_MISSING=(
    "jquery"
    "popper.js"
)

# Set allowed incorrect peer dependencies
ALLOWED_INCORRECT=(
)

# Perform check for peer dependencies
if ! PEERCHECK=$(yarn check-peer-dependencies --yarn 2>&1); then
    # Gather packages that are not installed
    mapfile -t MISSING < <((grep '' <<<"$PEERCHECK") | grep -oP '(?<=\()[^ \(]+(?= is not installed)')
    for PACKAGE in ${!MISSING[*]}; do
        # Check if the missing package is not allowed to be
        if ! [[ ${ALLOWED_MISSING[*]} =~ ${MISSING[$PACKAGE]} ]]; then
            # Show full output and error
            printf "%s\n" "${PEERCHECK[*]}"
            exit 1
        fi
    done
    # Gather packages that are the wrong version
    mapfile -t WRONGVERSION < <((grep '' <<<"$PEERCHECK") | grep -oP '(?<= is required by ).+(?=@[^ ]+ \([^ ]+ is installed)')
    for PACKAGE in ${!WRONGVERSION[*]}; do
        # Check if the missing package is not allowed to be
        if ! [[ ${ALLOWED_INCORRECT[*]} =~ ${WRONGVERSION[$PACKAGE]} ]]; then
            # Show full output and error
            printf "%s\n" "${PEERCHECK[*]}"
            exit 1
        fi
    done
fi

Edits: Updating bash script

from check-peer-dependencies.

christopherthielen avatar christopherthielen commented on April 27, 2024

@internalsystemerror

likewise for use with renovate... there are certain peer dependencies that I would like to skip, and to fail for anything else...

I added a cli option --ignore pkg1 --ignore pkg2 in version 4.1.0

from check-peer-dependencies.

internalsystemerror avatar internalsystemerror commented on April 27, 2024

I added a cli option --ignore pkg1 --ignore pkg2 in version 4.1.0

Oh nice! Thanks I will check it out.

from check-peer-dependencies.

internalsystemerror avatar internalsystemerror commented on April 27, 2024

@christopherthielen That new cli option works for me so I no longer need my bash script. Thanks.

from check-peer-dependencies.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.