Closed Whoaa512 closed 1 year ago
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
@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
I added a cli option
--ignore pkg1 --ignore pkg2
in version 4.1.0
Oh nice! Thanks I will check it out.
@christopherthielen That new cli option works for me so I no longer need my bash script. Thanks.
I'm closing this for now, but would gladly merge a reasonable PR.
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.
I'd like to use this within a larger set of CI checks that I currently have in a custom script.
As is I need to spawn this via exec and parse the output, would be great if I could import and call it directly without all the console.logs and get an object back