New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Github Enterprise #601
base: master
Are you sure you want to change the base?
Conversation
@@ -103,6 +106,9 @@ The supported options are: | |||
- `cacheDir`: Path to a GitHub API response cache to avoid throttling | |||
(e.g. `.changelog`) | |||
|
|||
- `gitHostingServerURL`: Your Github Enterprise Hosting Server URL (Only for Github Enterprise user. If you're using Github, Don't need it.) | |||
(e.g. `https://github.mycompany.com`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I named it gitHostingServerURL
. If we support other hosting services such as bitbucket and gitlab, I think we can create additional options such as 'gitHostingServiceType'.
private renderer: MarkdownRenderer; | ||
|
||
constructor(config: Configuration) { | ||
this.config = config; | ||
this.github = new GithubAPI(this.config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Abstracted the existing GithubAPI
to GitHostingAPI
and added GithubAPI
and GitEnterpriseAPI
to implement it. If we support other services such as bitbucket and gitlab later, we can support it if we implement GitHostingAPI
accordingly.
And since it's the responsibility of Configuration
to decide which instance to use, I changed it to be injected through Configuration
.
@@ -98,17 +98,17 @@ export default class Changelog { | |||
return Git.listCommits(from, to); | |||
} | |||
|
|||
private async getCommitters(commits: CommitInfo[]): Promise<GitHubUserResponse[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of the interface (GitHubUserResponse
, GitHubIssueResponse
) was also abstracted and changed. (GitHostingUserResponse
, GitHostingIssueResponse
)
|
||
export function createGitHostingAPI(options: Options): GitHostingAPI { | ||
return options.gitHostingServerURL ? new GithubEnterpriseAPI(options) : new GithubAPI(options); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a factory responsible for which GitHostingAPI
instance should be created according to the configuration.
When an instance of another service is created, (BitbucketAPI
, GitlabAPI
, etc...) this factory will be responsible and return the appropriate instance according to the options.
getBaseIssueUrl(repo: string): string; | ||
getIssueData(repo: string, issue: string): Promise<GitHostingIssueResponse>; | ||
getUserData(login: string): Promise<GitHostingUserResponse>; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an abstracted interface. If this interface is satisfied, there is no need to pay attention to specific implementations in other parts of the application.
@Turbo87, is this PR good to merge in? can we please create a minor release so this library can be used within organizations that use github enterprise? |
Hi teams. 馃槃
First of all, thank you for working a wonderful tool. lerna-changelog is an awesome.
This Pull Request is a change for lerna-changelog to support Github Enterprise.
If there is anything wrong or change, feel free to tell me.
Thanks you 馃槅