Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
ffbf332a
Commit
ffbf332a
authored
7 years ago
by
Rhys Arkins
Browse files
Options
Downloads
Patches
Plain Diff
fix: prune past latest versions earlier
parent
5b3d7a9f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/workers/package/versions.js
+18
-8
18 additions, 8 deletions
lib/workers/package/versions.js
with
18 additions
and
8 deletions
lib/workers/package/versions.js
+
18
−
8
View file @
ffbf332a
...
...
@@ -25,9 +25,23 @@ function determineUpgrades(npmDep, config) {
logger
.
warn
({
dependency
},
result
.
message
);
return
[
result
];
}
cons
t
versionList
=
Object
.
keys
(
versions
);
le
t
versionList
=
Object
.
keys
(
versions
);
const
allUpgrades
=
{};
let
{
currentVersion
}
=
config
;
// filter out versions past latest
const
currentIsPastLatest
=
isPastLatest
(
npmDep
,
semver
.
minSatisfying
(
versionList
,
currentVersion
)
);
if
(
currentIsPastLatest
)
{
logger
.
debug
({
name
:
npmDep
.
name
,
currentVersion
},
'
currentIsPastLatest
'
);
}
versionList
=
versionList
.
filter
(
version
=>
currentIsPastLatest
||
// if current is past latest then don't filter any
config
.
respectLatest
===
false
||
// if user has configured respectLatest to false
isPastLatest
(
npmDep
,
version
)
===
false
// if the version is less than or equal to latest
);
let
rangeOperator
;
if
(
config
.
upgradeInRange
&&
semver
.
validRange
(
currentVersion
))
{
logger
.
debug
({
currentVersion
},
'
upgradeInRange is true
'
);
...
...
@@ -124,13 +138,6 @@ function determineUpgrades(npmDep, config) {
!
stable
.
is
(
version
)
&&
semver
.
major
(
version
)
>
semver
.
major
(
changeLogFromVersion
)
)
// Ignore versions newer than "latest", unless current version is newer than the "latest"
.
reject
(
version
=>
config
.
respectLatest
&&
isPastLatest
(
npmDep
,
version
)
&&
!
isPastLatest
(
npmDep
,
changeLogFromVersion
)
)
// Loop through all possible versions
.
forEach
(
newVersion
=>
{
// Group by major versions
...
...
@@ -447,6 +454,9 @@ function isValidVersion(input) {
}
function
isPastLatest
(
npmDep
,
version
)
{
if
(
!
version
)
{
return
false
;
}
if
(
npmDep
[
'
dist-tags
'
]
&&
npmDep
[
'
dist-tags
'
].
latest
)
{
return
semver
.
gt
(
version
,
npmDep
[
'
dist-tags
'
].
latest
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment