Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(github): Convert datasources to class form (#14124)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
- Loading branch information
1 parent
91f36b7
commit 8a7abfd
Showing
57 changed files
with
594 additions
and
650 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ensureTrailingSlash } from '../../util/url'; | ||
|
||
const defaultSourceUrlBase = 'https://github.com/'; | ||
|
||
export function getSourceUrlBase(registryUrl: string): string { | ||
// default to GitHub.com if no GHE host is specified. | ||
return ensureTrailingSlash(registryUrl ?? defaultSourceUrlBase); | ||
} | ||
|
||
export function getApiBaseUrl(registryUrl: string): string { | ||
const sourceUrlBase = getSourceUrlBase(registryUrl); | ||
return sourceUrlBase === defaultSourceUrlBase | ||
? `https://api.github.com/` | ||
: `${sourceUrlBase}api/v3/`; | ||
} | ||
|
||
export function getSourceUrl(lookupName: string, registryUrl?: string): string { | ||
const sourceUrlBase = getSourceUrlBase(registryUrl); | ||
return `${sourceUrlBase}${lookupName}`; | ||
} |
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
Oops, something went wrong.