Skip to content

Commit

Permalink
feat(dart): allow custom registryUrls (#25987)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Nov 27, 2023
1 parent 2bc9201 commit c4bb98a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -3,7 +3,7 @@
exports[`modules/datasource/dart/index getReleases processes real data 1`] = `
{
"homepage": "https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences",
"registryUrl": "https://pub.dartlang.org/",
"registryUrl": "https://pub.dartlang.org",
"releases": [
{
"releaseTimestamp": "2017-05-09T18:25:24.268Z",
Expand Down
7 changes: 5 additions & 2 deletions lib/modules/datasource/dart/index.ts
@@ -1,4 +1,5 @@
import type { HttpResponse } from '../../../util/http/types';
import { ensureTrailingSlash } from '../../../util/url';
import { Datasource } from '../datasource';
import type { GetReleasesConfig, ReleaseResult } from '../types';
import type { DartResult } from './types';
Expand All @@ -10,7 +11,7 @@ export class DartDatasource extends Datasource {
super(DartDatasource.id);
}

override readonly customRegistrySupport = false;
override readonly customRegistrySupport = true;

override readonly defaultRegistryUrls = ['https://pub.dartlang.org/'];

Expand All @@ -23,7 +24,9 @@ export class DartDatasource extends Datasource {
return null;
}
let result: ReleaseResult | null = null;
const pkgUrl = `${registryUrl}api/packages/${packageName}`;
const pkgUrl = `${ensureTrailingSlash(
registryUrl,
)}api/packages/${packageName}`;

let raw: HttpResponse<DartResult> | null = null;
try {
Expand Down

0 comments on commit c4bb98a

Please sign in to comment.