githublogen 0.1.0 → 0.1.3

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,22 @@ 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>;
127
+ declare function getGitPushUrl(config: RepoConfig, token?: string): string | null;
110
128
 
111
129
  declare function generateMarkdown(commits: Commit[], options: ResolvedChangelogOptions): string;
130
+ declare function generateChangelog(commits: Commit[], config: ResolvedChangelogOptions): Promise<string>;
112
131
 
113
- declare function generate(options: ChangelogOptions): Promise<{
132
+ declare function generate(cwd: string, options: ChangelogOptions): Promise<{
114
133
  config: Required<ChangelogOptions>;
115
134
  md: string;
116
135
  commits: GitCommit[];
136
+ changelog: string;
117
137
  }>;
118
138
 
119
- declare function defineConfig(config: ChangelogOptions): ChangelogOptions;
120
- declare function resolveConfig(options: ChangelogOptions): Promise<Required<ChangelogOptions>>;
139
+ declare function resolveConfig(cwd: string, options: ChangelogOptions): Promise<Required<ChangelogOptions>>;
121
140
 
122
141
  declare function parseGitCommit(commit: RawGitCommit, config: ChangelogConfig): GitCommit | null;
123
142
  declare function parseCommits(commits: RawGitCommit[], config: ChangelogConfig): GitCommit[];
124
143
 
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 };
144
+ export { AuthorInfo, ChangelogConfig, ChangelogOptions, Commit, GitCommit, GitCommitAuthor, GithubOptions, GithubRelease, RawGitCommit, Reference, RepoConfig, RepoProvider, ResolvedChangelogOptions, SemverBumpType, generate, generateChangelog, generateMarkdown, getCurrentGitBranch, getFirstGitCommit, getGitDiff, getGitHubRepo, getGitPushUrl, getGitRemoteURL, getLastGitTag, hasTagOnGitHub, isPrerelease, isRefGitTag, isRepoShallow, parseCommits, parseGitCommit, resolveAuthorInfo, resolveAuthors, resolveConfig, sendRelease };