feat(source-control): each host package ships a client definition (#17746)
Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
fd3549c8ff
commit
7bc7328042
18 files changed
+516
No files matched your search
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* GitHub's client definition. Browser- and React Native-safe.
|
||||
*
|
||||
* @module source-control-github/client/definition
|
||||
*/
|
||||
import { SourceControlProviderKind } from "@t3tools/contracts";
|
||||
import {
|
||||
defineSourceControlClient,
|
||||
isChangeRequestPath,
|
||||
} from "@t3tools/source-control-core/client/definition";
|
||||
|
||||
export const definition = defineSourceControlClient({
|
||||
kind: SourceControlProviderKind.make("github"),
|
||||
label: "GitHub",
|
||||
pickerLabel: "GitHub",
|
||||
icon: "github",
|
||||
changeRequest: { shortLabel: "PR", singular: "pull request" },
|
||||
repositoryPathHint: "owner/repo",
|
||||
publicHost: "github.com",
|
||||
publishDescription: "github.com",
|
||||
publishHost: () => "github.com",
|
||||
defaultCloneTransport: "https",
|
||||
changeRequestUrl: ({ host, repository, number }) =>
|
||||
`https://${host}/${repository}/pull/${number}`,
|
||||
checkoutCommand: ({ number }) => `gh pr checkout ${number}`,
|
||||
authorProfileUrl: (login, repositoryUrl) =>
|
||||
login.endsWith("[bot]")
|
||||
? null
|
||||
: new URL(`/${encodeURIComponent(login)}`, repositoryUrl).toString(),
|
||||
referenceAutolinkRepositoryUrl: (repositoryUrl) => repositoryUrl,
|
||||
reviewSummaryRequired: () => false,
|
||||
isChangeRequestUrl: (url) => isChangeRequestPath(url, "/pull/"),
|
||||
});
|
||||
Reference in new issue
Block a user