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
33e865c9
Unverified
Commit
33e865c9
authored
3 years ago
by
Sergei Zharinov
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
refactor: Match all project sections to its dep type (#10477)
Co-authored-by:
Michael Kriese
<
michael.kriese@visualon.de
>
parent
256fc3ee
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/manager/leiningen/extract.ts
+14
-29
14 additions, 29 deletions
lib/manager/leiningen/extract.ts
with
14 additions
and
29 deletions
lib/manager/leiningen/extract.ts
+
14
−
29
View file @
33e865c9
...
@@ -22,7 +22,6 @@ export function expandDepName(name: string): string {
...
@@ -22,7 +22,6 @@ export function expandDepName(name: string): string {
export
function
extractFromVectors
(
export
function
extractFromVectors
(
str
:
string
,
str
:
string
,
offset
=
0
,
ctx
:
ExtractContext
=
{}
ctx
:
ExtractContext
=
{}
):
PackageDependency
[]
{
):
PackageDependency
[]
{
if
(
!
str
.
startsWith
(
'
[
'
))
{
if
(
!
str
.
startsWith
(
'
[
'
))
{
...
@@ -34,7 +33,6 @@ export function extractFromVectors(
...
@@ -34,7 +33,6 @@ export function extractFromVectors(
let
vecPos
=
0
;
let
vecPos
=
0
;
let
artifactId
=
''
;
let
artifactId
=
''
;
let
version
=
''
;
let
version
=
''
;
let
fileReplacePosition
:
number
=
null
;
const
isSpace
=
(
ch
:
string
):
boolean
=>
ch
&&
/
[\s
,
]
/
.
test
(
ch
);
const
isSpace
=
(
ch
:
string
):
boolean
=>
ch
&&
/
[\s
,
]
/
.
test
(
ch
);
...
@@ -42,7 +40,7 @@ export function extractFromVectors(
...
@@ -42,7 +40,7 @@ export function extractFromVectors(
s
.
replace
(
/^"/
,
''
).
replace
(
/"$/
,
''
);
s
.
replace
(
/^"/
,
''
).
replace
(
/"$/
,
''
);
const
yieldDep
=
():
void
=>
{
const
yieldDep
=
():
void
=>
{
if
(
artifactId
&&
version
&&
fileReplacePosition
)
{
if
(
artifactId
&&
version
)
{
result
.
push
({
result
.
push
({
...
ctx
,
...
ctx
,
datasource
:
ClojureDatasource
.
id
,
datasource
:
ClojureDatasource
.
id
,
...
@@ -77,9 +75,6 @@ export function extractFromVectors(
...
@@ -77,9 +75,6 @@ export function extractFromVectors(
}
else
if
(
vecPos
===
0
)
{
}
else
if
(
vecPos
===
0
)
{
artifactId
+=
char
;
artifactId
+=
char
;
}
else
if
(
vecPos
===
1
)
{
}
else
if
(
vecPos
===
1
)
{
if
(
isSpace
(
prevChar
))
{
fileReplacePosition
=
offset
+
idx
+
1
;
}
version
+=
char
;
version
+=
char
;
}
}
}
}
...
@@ -122,12 +117,18 @@ function extractLeinRepos(content: string): string[] {
...
@@ -122,12 +117,18 @@ function extractLeinRepos(content: string): string[] {
}
}
export
function
extractPackageFile
(
content
:
string
):
PackageFile
{
export
function
extractPackageFile
(
content
:
string
):
PackageFile
{
const
collect
=
(
key
:
string
,
ctx
:
ExtractContext
):
PackageDependency
[]
=>
{
const
collect
=
(
key
:
string
,
registryUrls
:
string
[]
):
PackageDependency
[]
=>
{
const
ctx
=
{
depType
:
key
,
registryUrls
,
};
let
result
:
PackageDependency
[]
=
[];
let
result
:
PackageDependency
[]
=
[];
let
restContent
=
trimAtKey
(
content
,
key
);
let
restContent
=
trimAtKey
(
content
,
key
);
while
(
restContent
)
{
while
(
restContent
)
{
const
offset
=
content
.
length
-
restContent
.
length
;
result
=
[...
result
,
...
extractFromVectors
(
restContent
,
ctx
)];
result
=
[...
result
,
...
extractFromVectors
(
restContent
,
offset
,
ctx
)];
restContent
=
trimAtKey
(
restContent
,
key
);
restContent
=
trimAtKey
(
restContent
,
key
);
}
}
return
result
;
return
result
;
...
@@ -136,26 +137,10 @@ export function extractPackageFile(content: string): PackageFile {
...
@@ -136,26 +137,10 @@ export function extractPackageFile(content: string): PackageFile {
const
registryUrls
=
extractLeinRepos
(
content
);
const
registryUrls
=
extractLeinRepos
(
content
);
const
deps
:
PackageDependency
[]
=
[
const
deps
:
PackageDependency
[]
=
[
...
collect
(
'
dependencies
'
,
{
...
collect
(
'
dependencies
'
,
registryUrls
),
depType
:
'
dependencies
'
,
...
collect
(
'
managed-dependencies
'
,
registryUrls
),
registryUrls
,
...
collect
(
'
plugins
'
,
registryUrls
),
}),
...
collect
(
'
pom-plugins
'
,
registryUrls
),
...
collect
(
'
managed-dependencies
'
,
{
depType
:
'
managed-dependencies
'
,
registryUrls
,
}),
...
collect
(
'
dev-dependencies
'
,
{
depType
:
'
managed-dependencies
'
,
registryUrls
,
}),
...
collect
(
'
plugins
'
,
{
depType
:
'
plugins
'
,
registryUrls
,
}),
...
collect
(
'
pom-plugins
'
,
{
depType
:
'
pom-plugins
'
,
registryUrls
,
}),
];
];
return
{
deps
};
return
{
deps
};
...
...
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