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
5c386948
You need to sign in or sign up before continuing.
Unverified
Commit
5c386948
authored
1 year ago
by
Rhys Arkins
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
chore(yarn): improve logging for version detection (#27629)
parent
f6fc1284
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/modules/manager/npm/extract/yarn.ts
+14
-1
14 additions, 1 deletion
lib/modules/manager/npm/extract/yarn.ts
lib/modules/manager/npm/post-update/utils.ts
+11
-2
11 additions, 2 deletions
lib/modules/manager/npm/post-update/utils.ts
with
25 additions
and
3 deletions
lib/modules/manager/npm/extract/yarn.ts
+
14
−
1
View file @
5c386948
...
@@ -21,6 +21,9 @@ export async function getYarnLock(filePath: string): Promise<LockFile> {
...
@@ -21,6 +21,9 @@ export async function getYarnLock(filePath: string): Promise<LockFile> {
if
(
key
===
'
__metadata
'
)
{
if
(
key
===
'
__metadata
'
)
{
// yarn 2
// yarn 2
lockfileVersion
=
parseInt
(
val
.
cacheKey
,
10
);
lockfileVersion
=
parseInt
(
val
.
cacheKey
,
10
);
logger
.
once
.
debug
(
`yarn.lock
${
filePath
}
has __metadata.cacheKey=
${
lockfileVersion
}
`
,
);
}
else
{
}
else
{
for
(
const
entry
of
key
.
split
(
'
,
'
))
{
for
(
const
entry
of
key
.
split
(
'
,
'
))
{
try
{
try
{
...
@@ -39,8 +42,18 @@ export async function getYarnLock(filePath: string): Promise<LockFile> {
...
@@ -39,8 +42,18 @@ export async function getYarnLock(filePath: string): Promise<LockFile> {
}
}
}
}
}
}
const
isYarn1
=
!
(
'
__metadata
'
in
parsed
);
if
(
isYarn1
)
{
logger
.
once
.
debug
(
`yarn.lock
${
filePath
}
is has no __metadata so is yarn 1`
,
);
}
else
{
logger
.
once
.
debug
(
`yarn.lock
${
filePath
}
is has __metadata so is yarn 2+`
,
);
}
return
{
return
{
isYarn1
:
!
(
'
__metadata
'
in
parsed
)
,
isYarn1
,
lockfileVersion
,
lockfileVersion
,
lockedVersions
,
lockedVersions
,
};
};
...
...
This diff is collapsed.
Click to expand it.
lib/modules/manager/npm/post-update/utils.ts
+
11
−
2
View file @
5c386948
import
upath
from
'
upath
'
;
import
upath
from
'
upath
'
;
import
{
logger
}
from
'
../../../../logger
'
;
import
{
readLocalFile
}
from
'
../../../../util/fs
'
;
import
{
readLocalFile
}
from
'
../../../../util/fs
'
;
import
{
Lazy
}
from
'
../../../../util/lazy
'
;
import
{
Lazy
}
from
'
../../../../util/lazy
'
;
import
{
PackageJson
,
PackageJsonSchema
}
from
'
../schema
'
;
import
{
PackageJson
,
PackageJsonSchema
}
from
'
../schema
'
;
...
@@ -30,10 +31,18 @@ export function getPackageManagerVersion(
...
@@ -30,10 +31,18 @@ export function getPackageManagerVersion(
pkg
:
PackageJsonSchema
,
pkg
:
PackageJsonSchema
,
):
string
|
null
{
):
string
|
null
{
if
(
pkg
.
packageManager
?.
name
===
name
)
{
if
(
pkg
.
packageManager
?.
name
===
name
)
{
return
pkg
.
packageManager
.
version
;
const
version
=
pkg
.
packageManager
.
version
;
logger
.
debug
(
`Found
${
name
}
constraint in package.json packageManager:
${
version
}
`
,
);
return
version
;
}
}
if
(
pkg
.
engines
?.[
name
])
{
if
(
pkg
.
engines
?.[
name
])
{
return
pkg
.
engines
[
name
];
const
version
=
pkg
.
engines
[
name
];
logger
.
debug
(
`Found
${
name
}
constraint in package.json engines:
${
version
}
`
,
);
return
version
;
}
}
return
null
;
return
null
;
}
}
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