githublogen 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,11 @@
1
1
  type SemverBumpType = 'major' | 'premajor' | 'minor' | 'preminor' | 'patch' | 'prepatch' | 'prerelease';
2
+ type RepoProvider = 'github' | 'gitlab' | 'bitbucket';
3
+ type RepoConfig = {
4
+ domain?: string;
5
+ repo?: string;
6
+ provider?: RepoProvider;
7
+ token?: string;
8
+ };
2
9
  interface ChangelogConfig {
3
10
  cwd: string;
4
11
  types: Record<string, {
@@ -6,7 +13,8 @@ interface ChangelogConfig {
6
13
  semver?: SemverBumpType;
7
14
  }>;
8
15
  scopeMap: Record<string, string>;
9
- github: string;
16
+ repo: RepoConfig;
17
+ tokens: Partial<Record<RepoProvider, string>>;
10
18
  from: string;
11
19
  to: string;
12
20
  newVersion?: string;
@@ -26,6 +34,18 @@ interface Reference {
26
34
  type: 'hash' | 'issue' | 'pull-request';
27
35
  value: string;
28
36
  }
37
+ interface GithubOptions {
38
+ repo: string;
39
+ token: string;
40
+ }
41
+ interface GithubRelease {
42
+ id?: string;
43
+ tag_name: string;
44
+ name?: string;
45
+ body?: string;
46
+ draft?: boolean;
47
+ prerelease?: boolean;
48
+ }
29
49
  interface GitCommit extends RawGitCommit {
30
50
  description: string;
31
51
  type: string;
@@ -34,10 +54,16 @@ interface GitCommit extends RawGitCommit {
34
54
  authors: GitCommitAuthor[];
35
55
  isBreaking: boolean;
36
56
  }
57
+ interface AuthorInfo {
58
+ commits: string[];
59
+ login?: string;
60
+ email: string;
61
+ name: string;
62
+ }
37
63
  interface Commit extends GitCommit {
38
64
  resolvedAuthors?: AuthorInfo[];
39
65
  }
40
- interface ChangelogOptions extends Partial<ChangelogConfig> {
66
+ interface ChangelogOptions extends ChangelogConfig {
41
67
  /**
42
68
  * Dry run. Skip releasing to GitHub.
43
69
  */
@@ -60,10 +86,6 @@ interface ChangelogOptions extends Partial<ChangelogConfig> {
60
86
  * Mark the release as prerelease
61
87
  */
62
88
  prerelease?: boolean;
63
- /**
64
- * GitHub Token
65
- */
66
- token?: string;
67
89
  /**
68
90
  * Custom titles
69
91
  */
@@ -87,12 +109,6 @@ interface ChangelogOptions extends Partial<ChangelogConfig> {
87
109
  emoji?: boolean;
88
110
  }
89
111
  type ResolvedChangelogOptions = Required<ChangelogOptions>;
90
- interface AuthorInfo {
91
- commits: string[];
92
- login?: string;
93
- email: string;
94
- name: string;
95
- }
96
112
 
97
113
  declare function sendRelease(options: ChangelogOptions, content: string): Promise<void>;
98
114
  declare function resolveAuthorInfo(options: ChangelogOptions, info: AuthorInfo): Promise<AuthorInfo>;
@@ -107,19 +123,21 @@ declare function isRefGitTag(to: string): Promise<boolean>;
107
123
  declare function getFirstGitCommit(): Promise<string>;
108
124
  declare function isPrerelease(version: string): boolean;
109
125
  declare function getGitDiff(from: string | undefined, to?: string): Promise<RawGitCommit[]>;
126
+ declare function getGitRemoteURL(cwd: string, remote?: string): Promise<string>;
110
127
 
111
128
  declare function generateMarkdown(commits: Commit[], options: ResolvedChangelogOptions): string;
129
+ declare function generateChangelog(commits: Commit[], config: ResolvedChangelogOptions): Promise<string>;
112
130
 
113
- declare function generate(options: ChangelogOptions): Promise<{
131
+ declare function generate(cwd: string, options: ChangelogOptions): Promise<{
114
132
  config: Required<ChangelogOptions>;
115
133
  md: string;
116
134
  commits: GitCommit[];
135
+ changelog: string;
117
136
  }>;
118
137
 
119
- declare function defineConfig(config: ChangelogOptions): ChangelogOptions;
120
- declare function resolveConfig(options: ChangelogOptions): Promise<Required<ChangelogOptions>>;
138
+ declare function resolveConfig(cwd: string, options: ChangelogOptions): Promise<Required<ChangelogOptions>>;
121
139
 
122
140
  declare function parseGitCommit(commit: RawGitCommit, config: ChangelogConfig): GitCommit | null;
123
141
  declare function parseCommits(commits: RawGitCommit[], config: ChangelogConfig): GitCommit[];
124
142
 
125
- export { AuthorInfo, ChangelogConfig, ChangelogOptions, Commit, GitCommit, GitCommitAuthor, RawGitCommit, Reference, ResolvedChangelogOptions, SemverBumpType, defineConfig, generate, generateMarkdown, getCurrentGitBranch, getFirstGitCommit, getGitDiff, getGitHubRepo, getLastGitTag, hasTagOnGitHub, isPrerelease, isRefGitTag, isRepoShallow, parseCommits, parseGitCommit, resolveAuthorInfo, resolveAuthors, resolveConfig, sendRelease };
143
+ export { AuthorInfo, ChangelogConfig, ChangelogOptions, Commit, GitCommit, GitCommitAuthor, GithubOptions, GithubRelease, RawGitCommit, Reference, RepoConfig, RepoProvider, ResolvedChangelogOptions, SemverBumpType, generate, generateChangelog, generateMarkdown, getCurrentGitBranch, getFirstGitCommit, getGitDiff, getGitHubRepo, getGitRemoteURL, getLastGitTag, hasTagOnGitHub, isPrerelease, isRefGitTag, isRepoShallow, parseCommits, parseGitCommit, resolveAuthorInfo, resolveAuthors, resolveConfig, sendRelease };