githublogen 0.1.4 → 0.1.6
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/cli.cjs +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/index.cjs +8 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +8 -3
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -20,7 +20,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
20
20
|
|
|
21
21
|
const cac__default = /*#__PURE__*/_interopDefaultCompat(cac);
|
|
22
22
|
|
|
23
|
-
const version = "0.1.
|
|
23
|
+
const version = "0.1.6";
|
|
24
24
|
|
|
25
25
|
const cli = cac__default("githublogen");
|
|
26
26
|
cli.version(version).option("-t, --token <path>", "GitHub Token").option("--from <ref>", "From tag").option("--to <ref>", "To tag").option("--github <path>", "GitHub Repository, e.g. soybeanjs/githublogen").option("--name <name>", "Name of the release").option("--contributors", "Show contributors section").option("--prerelease", "Mark release as prerelease").option("-d, --draft", "Mark release as draft").option("--output <path>", "Output to file instead of sending to GitHub").option("--capitalize", "Should capitalize for each comment message").option("--emoji", "Use emojis in section titles", { default: true }).option("--group", "Nest commit messages under their scopes").option("--dry", "Dry run").help();
|
|
@@ -79,7 +79,7 @@ ${changelog}
|
|
|
79
79
|
await execa.execa("git", ["config", "--global", "user.name", `"${name}"`]);
|
|
80
80
|
await execa.execa("git", ["add", "."]);
|
|
81
81
|
await execa.execa("git", ["commit", "-m", '"docs(projects): CHANGELOG.md"'], { cwd });
|
|
82
|
-
await execa.execa("git", ["push", pushUrl], { cwd });
|
|
82
|
+
await execa.execa("git", ["push", pushUrl, `HEAD:${config.gitMainBranch}`], { cwd });
|
|
83
83
|
}
|
|
84
84
|
if (!await index.hasTagOnGitHub(config.to, config)) {
|
|
85
85
|
console.error(kolorist.yellow(`Current ref "${kolorist.bold(config.to)}" is not available as tags on GitHub. Release skipped.`));
|
package/dist/cli.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import 'node:path';
|
|
|
14
14
|
import 'node:v8';
|
|
15
15
|
import 'node:util';
|
|
16
16
|
|
|
17
|
-
const version = "0.1.
|
|
17
|
+
const version = "0.1.6";
|
|
18
18
|
|
|
19
19
|
const cli = cac("githublogen");
|
|
20
20
|
cli.version(version).option("-t, --token <path>", "GitHub Token").option("--from <ref>", "From tag").option("--to <ref>", "To tag").option("--github <path>", "GitHub Repository, e.g. soybeanjs/githublogen").option("--name <name>", "Name of the release").option("--contributors", "Show contributors section").option("--prerelease", "Mark release as prerelease").option("-d, --draft", "Mark release as draft").option("--output <path>", "Output to file instead of sending to GitHub").option("--capitalize", "Should capitalize for each comment message").option("--emoji", "Use emojis in section titles", { default: true }).option("--group", "Nest commit messages under their scopes").option("--dry", "Dry run").help();
|
|
@@ -73,7 +73,7 @@ ${changelog}
|
|
|
73
73
|
await execa("git", ["config", "--global", "user.name", `"${name}"`]);
|
|
74
74
|
await execa("git", ["add", "."]);
|
|
75
75
|
await execa("git", ["commit", "-m", '"docs(projects): CHANGELOG.md"'], { cwd });
|
|
76
|
-
await execa("git", ["push", pushUrl], { cwd });
|
|
76
|
+
await execa("git", ["push", pushUrl, `HEAD:${config.gitMainBranch}`], { cwd });
|
|
77
77
|
}
|
|
78
78
|
if (!await hasTagOnGitHub(config.to, config)) {
|
|
79
79
|
console.error(yellow(`Current ref "${bold(config.to)}" is not available as tags on GitHub. Release skipped.`));
|
package/dist/index.cjs
CHANGED
|
@@ -193,10 +193,14 @@ async function getGitHubRepo() {
|
|
|
193
193
|
}
|
|
194
194
|
return `${match[1]}/${match[2]}`;
|
|
195
195
|
}
|
|
196
|
+
async function getGitMainBranchName() {
|
|
197
|
+
const main = await execCommand("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
198
|
+
return main;
|
|
199
|
+
}
|
|
196
200
|
async function getCurrentGitBranch() {
|
|
197
201
|
const result1 = await execCommand("git", ["tag", "--points-at", "HEAD"]);
|
|
198
|
-
const
|
|
199
|
-
return result1 ||
|
|
202
|
+
const main = getGitMainBranchName();
|
|
203
|
+
return result1 || main;
|
|
200
204
|
}
|
|
201
205
|
async function isRepoShallow() {
|
|
202
206
|
return (await execCommand("git", ["rev-parse", "--is-shallow-repository"])).trim() === "true";
|
|
@@ -8321,6 +8325,7 @@ const defaultConfig = {
|
|
|
8321
8325
|
cwd: process.cwd(),
|
|
8322
8326
|
from: "",
|
|
8323
8327
|
to: "",
|
|
8328
|
+
gitMainBranch: "main",
|
|
8324
8329
|
scopeMap: {},
|
|
8325
8330
|
repo: {},
|
|
8326
8331
|
types: {
|
|
@@ -8433,6 +8438,7 @@ exports.getCurrentGitBranch = getCurrentGitBranch;
|
|
|
8433
8438
|
exports.getFirstGitCommit = getFirstGitCommit;
|
|
8434
8439
|
exports.getGitDiff = getGitDiff;
|
|
8435
8440
|
exports.getGitHubRepo = getGitHubRepo;
|
|
8441
|
+
exports.getGitMainBranchName = getGitMainBranchName;
|
|
8436
8442
|
exports.getGitPushUrl = getGitPushUrl;
|
|
8437
8443
|
exports.getGitRemoteURL = getGitRemoteURL;
|
|
8438
8444
|
exports.getLastGitTag = getLastGitTag;
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ interface ChangelogConfig {
|
|
|
19
19
|
to: string;
|
|
20
20
|
newVersion?: string;
|
|
21
21
|
output: string | boolean;
|
|
22
|
+
gitMainBranch: string;
|
|
22
23
|
}
|
|
23
24
|
interface GitCommitAuthor {
|
|
24
25
|
name: string;
|
|
@@ -116,6 +117,7 @@ declare function resolveAuthors(commits: Commit[], options: ChangelogOptions): P
|
|
|
116
117
|
declare function hasTagOnGitHub(tag: string, options: ChangelogOptions): Promise<boolean>;
|
|
117
118
|
|
|
118
119
|
declare function getGitHubRepo(): Promise<string>;
|
|
120
|
+
declare function getGitMainBranchName(): Promise<string>;
|
|
119
121
|
declare function getCurrentGitBranch(): Promise<string>;
|
|
120
122
|
declare function isRepoShallow(): Promise<boolean>;
|
|
121
123
|
declare function getLastGitTag(delta?: number): Promise<string>;
|
|
@@ -141,4 +143,4 @@ declare function resolveConfig(cwd: string, options: ChangelogOptions): Promise<
|
|
|
141
143
|
declare function parseGitCommit(commit: RawGitCommit, config: ChangelogConfig): GitCommit | null;
|
|
142
144
|
declare function parseCommits(commits: RawGitCommit[], config: ChangelogConfig): GitCommit[];
|
|
143
145
|
|
|
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 };
|
|
146
|
+
export { AuthorInfo, ChangelogConfig, ChangelogOptions, Commit, GitCommit, GitCommitAuthor, GithubOptions, GithubRelease, RawGitCommit, Reference, RepoConfig, RepoProvider, ResolvedChangelogOptions, SemverBumpType, generate, generateChangelog, generateMarkdown, getCurrentGitBranch, getFirstGitCommit, getGitDiff, getGitHubRepo, getGitMainBranchName, getGitPushUrl, getGitRemoteURL, getLastGitTag, hasTagOnGitHub, isPrerelease, isRefGitTag, isRepoShallow, parseCommits, parseGitCommit, resolveAuthorInfo, resolveAuthors, resolveConfig, sendRelease };
|
package/dist/index.mjs
CHANGED
|
@@ -183,10 +183,14 @@ async function getGitHubRepo() {
|
|
|
183
183
|
}
|
|
184
184
|
return `${match[1]}/${match[2]}`;
|
|
185
185
|
}
|
|
186
|
+
async function getGitMainBranchName() {
|
|
187
|
+
const main = await execCommand("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
188
|
+
return main;
|
|
189
|
+
}
|
|
186
190
|
async function getCurrentGitBranch() {
|
|
187
191
|
const result1 = await execCommand("git", ["tag", "--points-at", "HEAD"]);
|
|
188
|
-
const
|
|
189
|
-
return result1 ||
|
|
192
|
+
const main = getGitMainBranchName();
|
|
193
|
+
return result1 || main;
|
|
190
194
|
}
|
|
191
195
|
async function isRepoShallow() {
|
|
192
196
|
return (await execCommand("git", ["rev-parse", "--is-shallow-repository"])).trim() === "true";
|
|
@@ -8311,6 +8315,7 @@ const defaultConfig = {
|
|
|
8311
8315
|
cwd: process.cwd(),
|
|
8312
8316
|
from: "",
|
|
8313
8317
|
to: "",
|
|
8318
|
+
gitMainBranch: "main",
|
|
8314
8319
|
scopeMap: {},
|
|
8315
8320
|
repo: {},
|
|
8316
8321
|
types: {
|
|
@@ -8416,4 +8421,4 @@ async function generate(cwd, options) {
|
|
|
8416
8421
|
return { config: resolved, md, commits, changelog };
|
|
8417
8422
|
}
|
|
8418
8423
|
|
|
8419
|
-
export { generate, generateChangelog, generateMarkdown, getCurrentGitBranch, getFirstGitCommit, getGitDiff, getGitHubRepo, getGitPushUrl, getGitRemoteURL, getLastGitTag, hasTagOnGitHub, isPrerelease, isRefGitTag, isRepoShallow, parseCommits, parseGitCommit, resolveAuthorInfo, resolveAuthors, resolveConfig, sendRelease };
|
|
8424
|
+
export { generate, generateChangelog, generateMarkdown, getCurrentGitBranch, getFirstGitCommit, getGitDiff, getGitHubRepo, getGitMainBranchName, getGitPushUrl, getGitRemoteURL, getLastGitTag, hasTagOnGitHub, isPrerelease, isRefGitTag, isRepoShallow, parseCommits, parseGitCommit, resolveAuthorInfo, resolveAuthors, resolveConfig, sendRelease };
|