Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
d7d6d43b
Unverified
Commit
d7d6d43b
authored
2 years ago
by
Michael Kriese
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(manager/npm): don't warn for empty `.yarnrc.yml` (#20149)
parent
fabb1bba
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/modules/manager/npm/extract/yarnrc.spec.ts
+11
-0
11 additions, 0 deletions
lib/modules/manager/npm/extract/yarnrc.spec.ts
lib/modules/manager/npm/extract/yarnrc.ts
+8
-5
8 additions, 5 deletions
lib/modules/manager/npm/extract/yarnrc.ts
with
19 additions
and
5 deletions
lib/modules/manager/npm/extract/yarnrc.spec.ts
+
11
−
0
View file @
d7d6d43b
...
...
@@ -43,6 +43,16 @@ describe('modules/manager/npm/extract/yarnrc', () => {
});
expect
(
registryUrl
).
toBeNull
();
});
it
(
'
ignores missing scope registryServer
'
,
()
=>
{
const
registryUrl
=
resolveRegistryUrl
(
'
@scope/a-package
'
,
{
npmScopes
:
{
scope
:
{},
},
npmRegistryServer
:
'
https://private.example.com/npm
'
,
});
expect
(
registryUrl
).
toBeNull
();
});
});
describe
(
'
loadConfigFromYarnrcYml()
'
,
()
=>
{
...
...
@@ -91,6 +101,7 @@ describe('modules/manager/npm/extract/yarnrc', () => {
`
,
null
,
],
[
''
,
null
],
])(
'
produces expected config (%s)
'
,
(
yarnrcYml
,
expectedConfig
)
=>
{
const
config
=
loadConfigFromYarnrcYml
(
yarnrcYml
);
...
...
This diff is collapsed.
Click to expand it.
lib/modules/manager/npm/extract/yarnrc.ts
+
8
−
5
View file @
d7d6d43b
...
...
@@ -17,11 +17,14 @@ export type YarnConfig = z.infer<typeof YarnrcYmlSchema>;
export
function
loadConfigFromYarnrcYml
(
yarnrcYml
:
string
):
YarnConfig
|
null
{
try
{
return
YarnrcYmlSchema
.
parse
(
load
(
yarnrcYml
,
{
json
:
true
,
})
);
const
obj
=
load
(
yarnrcYml
,
{
json
:
true
,
});
if
(
!
obj
)
{
// emtpy yaml file
return
null
;
}
return
YarnrcYmlSchema
.
parse
(
obj
);
}
catch
(
err
)
{
logger
.
warn
({
yarnrcYml
,
err
},
`Failed to load yarnrc file`
);
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