Skip to content

Commit 74d5b6f

Browse files
committed
refactor: simplify updateDeps internal ver resolver
1 parent 001e344 commit 74d5b6f

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

lib/updateDeps.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { writeFileSync } = require("fs");
22
const semver = require("semver");
3-
const { isObject, isEqual, transform } = require("lodash");
3+
const { isObject, isEqual, transform, get } = require("lodash");
44
const recognizeFormat = require("./recognizeFormat");
55
const getManifest = require("./getManifest");
66
const { getHighestVersion, getLatestVersion } = require("./utils");
@@ -305,7 +305,12 @@ const updateManifestDeps = (pkg, writeOut = true, bumpStrategy = "override", pre
305305
const scopes = [dependencies, devDependencies, peerDependencies, optionalDependencies];
306306
scopes.forEach((scope) => {
307307
if (scope[dependency.name]) {
308-
scope[dependency.name] = bumpStrategy === "override" ? prefix + release.version : release.version;
308+
scope[dependency.name] = resolveNextVersion(
309+
get(dependency, "_lastRelease.version", "0.0.0"),
310+
release.version,
311+
bumpStrategy,
312+
prefix
313+
);
309314
}
310315
});
311316
});

yarn.lock

+8-1
Original file line numberDiff line numberDiff line change
@@ -4773,7 +4773,7 @@ lodash.without@~4.4.0:
47734773
resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac"
47744774
integrity sha1-PNRXSgC2e643OpS3SHcmQFB7eqw=
47754775

4776-
lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17.4:
4776+
lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.7.0:
47774777
version "4.17.21"
47784778
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
47794779
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@@ -7086,6 +7086,13 @@ tough-cookie@~2.5.0:
70867086
psl "^1.1.28"
70877087
punycode "^2.1.1"
70887088

7089+
tr46@^2.1.0:
7090+
version "2.1.0"
7091+
resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.1.0.tgz#fa87aa81ca5d5941da8cbf1f9b749dc969a4e240"
7092+
integrity sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==
7093+
dependencies:
7094+
punycode "^2.1.1"
7095+
70897096
tr46@~0.0.3:
70907097
version "0.0.3"
70917098
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"

0 commit comments

Comments
 (0)