-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(datasource): migrate to class based datasource
A small experiment into what OOP/class based datasources might look like. Picked Cdnjs as it's the smallest & simplest. With this approach we can share common logic, like error handling, rate limiting, etc. between different datasources, instead of having to reimplement it each time we write a new datasource. Currently there's nothing shared, as it's only 1 datasource, but the interesting stuff will come with the 2nd datasource
- Loading branch information
1 parent
5896d9c
commit acc6cf5
Showing
17 changed files
with
1,027 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
import { GetReleasesConfig, ReleaseResult } from '../common'; | ||
import { Datasource } from '../datasource'; | ||
import { getReleases } from '../maven'; | ||
import { MAVEN_REPO } from '../maven/common'; | ||
|
||
export const id = 'clojure'; | ||
|
||
export const defaultRegistryUrls = ['https://clojars.org/repo', MAVEN_REPO]; | ||
export const registryStrategy = 'merge'; | ||
|
||
export { getReleases } from '../maven'; | ||
export class Clojure extends Datasource { | ||
readonly id = 'clojure'; | ||
|
||
getReleases({ | ||
lookupName, | ||
registryUrl, | ||
}: GetReleasesConfig): Promise<ReleaseResult | null> { | ||
return getReleases({ lookupName, registryUrl }); | ||
} | ||
} |
Oops, something went wrong.