From 12dfcf887b8d9b1da2da44ba8b0afa88a1521f18 Mon Sep 17 00:00:00 2001 From: nathanhleung Date: Thu, 28 Jan 2021 22:22:45 -0500 Subject: [PATCH 1/2] fix: don't coerce version strings to semver. resolves #71 --- src/install-peerdeps.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/install-peerdeps.js b/src/install-peerdeps.js index 694b710..716b743 100644 --- a/src/install-peerdeps.js +++ b/src/install-peerdeps.js @@ -154,12 +154,9 @@ const getPackageString = ({ name, version }) => { if (version.indexOf(" ") >= 0) { // Semver ranges can have a join of comparator sets // e.g. '^3.0.2 || ^4.0.0' or '>=1.2.7 <1.3.0' - // Take each version in the range and find the maxSatisfying - const rangeSplit = version - .split(" ") - .map(v => coerce(v)) - .filter(v => valid(v)); - const versionToInstall = maxSatisfying(rangeSplit, version); + // Take the last version in the range + const rangeSplit = version.split(" "); + const versionToInstall = rangeSplit[rangeSplit.length - 1]; if (versionToInstall === null) { return name; From fa0b30e5d5b5425290c0514c7f95602a7e96e054 Mon Sep 17 00:00:00 2001 From: nathanhleung Date: Thu, 28 Jan 2021 22:48:07 -0500 Subject: [PATCH 2/2] fix: quote package names, resolves #64 --- src/install-peerdeps.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/install-peerdeps.js b/src/install-peerdeps.js index 716b743..0567d37 100644 --- a/src/install-peerdeps.js +++ b/src/install-peerdeps.js @@ -247,7 +247,8 @@ function installPeerDeps( // Remove -0 return packageName.substr(0, packageName.length - 2); } - return packageName; + // Fix #64 -- add quotes + return `"${packageName}"`; } // If we have spaces in our args spawn() // cries foul so we'll split the packagesString