You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
clone the repo above (branch: pnpm9-issue-peerdeps)
pnpm i
pnpm upgr, and then upgrade to jquery@3.7.1 in package1
evaluate the lock file and/or 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?
macOS
Windows
Linux
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:
dwiyatci
changed the title
peer dependencies wrongly resolved after updating interactively in monorepo scheme
peer dependencies incorrectly resolved after updating interactively in monorepo scheme
Apr 23, 2024
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 pnpm up --recursive --latest --interactive (before it's broken 😭).
The script assumes you've got jq installed, and capitalize the output of pnpm outdated -r --format json.
upgrade_nonbreaking_deps.sh
#!/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 updateprepare_package_update() {
local package=$1local package_data=$2# Get the current and latest versionlocal 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 sameif [ "$current_version"=="$latest_version" ];thenreturnfi# Compare major version. Do not upgrade if the major version is differentlocal current_major_version=${current_version%%.*}local latest_major_version=${latest_version%%.*}if [ "$current_major_version"!="$latest_major_version" ];thenreturnfi# Update the local storage file for every dependent packagelocal deps=$(echo "$package_data"| jq -r '.dependentPackages[].name')fordepin$deps;dolocal sanitized_dep=$(echo "$dep"| sed "s~/~_~g")echo"$package@$latest_version">>"$sanitized_dep.updates"done
}
# Save the output of the outdated package commandecho"pnpm outdated -r --format json"
data=$(pnpm outdated -r --format json)echo$data| jq .# Loop through the JSON objectforpackagein$(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 fileforfilein*.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 commandecho$update_cmdeval$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: