-
-
Notifications
You must be signed in to change notification settings - Fork 936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
peer dependencies incorrectly resolved after updating interactively in monorepo scheme #8002
Comments
I am having a similar issue: In the dependency I export an interface like this: export interface IName{
/**
* Any Comment
*/
anyKey: string;
} But on the export interface IName{
anyKey: string | undefined;
} |
Since I'm a bit pessimistic that this issue will be picked up anytime soon, I (with GPT assist) created a bash script to upgrade non-breaking (non-major) dependencies to the latest across all workspaces in my monorepo project, which is my use case in using The script assumes you've got
#!/bin/bash
# Set your monorepo root package name here
MONOREPO_ROOT_PKG_NAME="myproject-monorepo"
# Parse JSON data and prepare package upgrades without a major version update
prepare_package_update() {
local package=$1
local package_data=$2
# Get the current and latest version
local current_version=$(echo "$package_data" | jq -r '.current')
local latest_version=$(echo "$package_data" | jq -r '.latest')
# Return if the current and latest version are the same
if [ "$current_version" == "$latest_version" ]; then
return
fi
# Compare major version. Do not upgrade if the major version is different
local current_major_version=${current_version%%.*}
local latest_major_version=${latest_version%%.*}
if [ "$current_major_version" != "$latest_major_version" ]; then
return
fi
# Update the local storage file for every dependent package
local deps=$(echo "$package_data" | jq -r '.dependentPackages[].name')
for dep in $deps; do
local sanitized_dep=$(echo "$dep" | sed "s~/~_~g")
echo "$package@$latest_version" >> "$sanitized_dep.updates"
done
}
# Save the output of the outdated package command
echo "pnpm outdated -r --format json"
data=$(pnpm outdated -r --format json)
echo $data | jq .
# Loop through the JSON object
for package in $(echo "$data" | jq -r 'keys[]'); do
package_data=$(echo "$data" | jq -r --arg package "$package" '.[$package]')
prepare_package_update "$package" "$package_data"
done
# Iterate over each storage file, execute the pnpm update command, and then remove the file
for file in *.updates; do
packages=$(cat "$file")
dep=${file%.updates}
dep=$(echo "$dep" | sed "s~_~/~g")
update_cmd="pnpm up --filter \"$dep\" $packages"
if [ "$dep" == $MONOREPO_ROOT_PKG_NAME ]; then
update_cmd="$update_cmd -w"
fi
# Execute the upgrading command
echo $update_cmd
eval $update_cmd
rm "$file"
done |
Verify latest release
pnpm version
9.0.5
Which area(s) of pnpm are affected? (leave empty if unsure)
Dependencies resolver, Lockfile
Link to the code that reproduces this issue or a replay of the bug
https://github.com/dwiyatci/fiddle/tree/pnpm9-issue-peerdeps
Reproduction steps
pnpm9-issue-peerdeps
)pnpm i
pnpm upgr
, and then upgrade tojquery@3.7.1
inpackage1
pnpm whyeslint9
Describe the Bug
ESLint v9 (which allegedly is a peer dep of
@eslint-community/eslint-utils@4.4.0
) is wrongly installed and being resolved as dev dependencies of a package (react-scripts
) that's incompatible with it.Expected Behavior
ESLint v8 (8.57.0) that's specified in the root should be resolved instead.
Which Node.js version are you using?
18.18.2
Which operating systems have you used?
If your OS is a Linux based, which one it is? (Include the version if relevant)
No response
The text was updated successfully, but these errors were encountered: