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
d9b025bf
Unverified
Commit
d9b025bf
authored
2 years ago
by
Sergei Zharinov
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
refactor(packagist): Remove deprecated URL API (#20547)
parent
68e4ad4e
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/modules/datasource/packagist/index.ts
+4
-5
4 additions, 5 deletions
lib/modules/datasource/packagist/index.ts
with
4 additions
and
5 deletions
lib/modules/datasource/packagist/index.ts
+
4
−
5
View file @
d9b025bf
import
URL
from
'
url
'
;
import
{
logger
}
from
'
../../../logger
'
;
import
{
logger
}
from
'
../../../logger
'
;
import
{
ExternalHostError
}
from
'
../../../types/errors/external-host-error
'
;
import
{
ExternalHostError
}
from
'
../../../types/errors/external-host-error
'
;
import
{
cache
}
from
'
../../../util/cache/package/decorator
'
;
import
{
cache
}
from
'
../../../util/cache/package/decorator
'
;
import
*
as
hostRules
from
'
../../../util/host-rules
'
;
import
*
as
hostRules
from
'
../../../util/host-rules
'
;
import
type
{
HttpOptions
}
from
'
../../../util/http/types
'
;
import
type
{
HttpOptions
}
from
'
../../../util/http/types
'
;
import
*
as
p
from
'
../../../util/promises
'
;
import
*
as
p
from
'
../../../util/promises
'
;
import
{
ensureTrailingSlash
,
joinUrlParts
}
from
'
../../../util/url
'
;
import
{
joinUrlParts
,
resolveBaseUrl
}
from
'
../../../util/url
'
;
import
*
as
composerVersioning
from
'
../../versioning/composer
'
;
import
*
as
composerVersioning
from
'
../../versioning/composer
'
;
import
{
Datasource
}
from
'
../datasource
'
;
import
{
Datasource
}
from
'
../datasource
'
;
import
type
{
GetReleasesConfig
,
ReleaseResult
}
from
'
../types
'
;
import
type
{
GetReleasesConfig
,
ReleaseResult
}
from
'
../types
'
;
...
@@ -42,7 +41,7 @@ export class PackagistDatasource extends Datasource {
...
@@ -42,7 +41,7 @@ export class PackagistDatasource extends Datasource {
}
}
private
async
getRegistryMeta
(
regUrl
:
string
):
Promise
<
RegistryMeta
|
null
>
{
private
async
getRegistryMeta
(
regUrl
:
string
):
Promise
<
RegistryMeta
|
null
>
{
const
url
=
URL
.
resolve
(
ensureTrailingSlash
(
regUrl
)
,
'
packages.json
'
);
const
url
=
resolve
BaseUrl
(
regUrl
,
'
packages.json
'
);
const
opts
=
PackagistDatasource
.
getHostOpts
(
url
);
const
opts
=
PackagistDatasource
.
getHostOpts
(
url
);
const
res
=
(
await
this
.
http
.
getJson
<
PackageMeta
>
(
url
,
opts
)).
body
;
const
res
=
(
await
this
.
http
.
getJson
<
PackageMeta
>
(
url
,
opts
)).
body
;
const
meta
:
RegistryMeta
=
{
const
meta
:
RegistryMeta
=
{
...
@@ -225,14 +224,14 @@ export class PackagistDatasource extends Datasource {
...
@@ -225,14 +224,14 @@ export class PackagistDatasource extends Datasource {
}
}
let
pkgUrl
:
string
;
let
pkgUrl
:
string
;
if
(
packageName
in
providerPackages
)
{
if
(
packageName
in
providerPackages
)
{
pkgUrl
=
URL
.
resolve
(
pkgUrl
=
resolve
BaseUrl
(
registryUrl
,
registryUrl
,
providersUrl
!
providersUrl
!
.
replace
(
'
%package%
'
,
packageName
)
.
replace
(
'
%package%
'
,
packageName
)
.
replace
(
'
%hash%
'
,
providerPackages
[
packageName
])
.
replace
(
'
%hash%
'
,
providerPackages
[
packageName
])
);
);
}
else
if
(
providersLazyUrl
)
{
}
else
if
(
providersLazyUrl
)
{
pkgUrl
=
URL
.
resolve
(
pkgUrl
=
resolve
BaseUrl
(
registryUrl
,
registryUrl
,
providersLazyUrl
.
replace
(
'
%package%
'
,
packageName
)
providersLazyUrl
.
replace
(
'
%package%
'
,
packageName
)
);
);
...
...
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