githublogen 0.2.2 → 0.3.1
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 +1 -66
- package/dist/cli.d.ts +2 -2
- package/dist/cli.mjs +4 -58
- package/package.json +12 -43
- package/README.md +0 -51
- package/dist/index.cjs +0 -8333
- package/dist/index.d.ts +0 -144
- package/dist/index.mjs +0 -8304
package/dist/cli.cjs
CHANGED
|
@@ -1,66 +1 @@
|
|
|
1
|
-
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const kolorist = require('kolorist');
|
|
5
|
-
const cac = require('cac');
|
|
6
|
-
const index = require('./index.cjs');
|
|
7
|
-
require('ohmyfetch');
|
|
8
|
-
require('convert-gitmoji');
|
|
9
|
-
require('node:fs');
|
|
10
|
-
require('node:module');
|
|
11
|
-
require('node:url');
|
|
12
|
-
require('node:assert');
|
|
13
|
-
require('node:process');
|
|
14
|
-
require('node:path');
|
|
15
|
-
require('node:v8');
|
|
16
|
-
require('node:util');
|
|
17
|
-
|
|
18
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
19
|
-
|
|
20
|
-
const cac__default = /*#__PURE__*/_interopDefaultCompat(cac);
|
|
21
|
-
|
|
22
|
-
const version = "0.2.2";
|
|
23
|
-
|
|
24
|
-
const cli = cac__default("githublogen");
|
|
25
|
-
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();
|
|
26
|
-
cli.command("").action(async (args) => {
|
|
27
|
-
try {
|
|
28
|
-
console.log();
|
|
29
|
-
console.log(kolorist.dim(`${kolorist.bold("github")}logen `) + kolorist.dim(`v${version}`));
|
|
30
|
-
const cwd = process.cwd();
|
|
31
|
-
const { config, md, commits } = await index.generate(cwd, args);
|
|
32
|
-
const markdown = md.replace(/ /g, "");
|
|
33
|
-
console.log(kolorist.cyan(config.from) + kolorist.dim(" -> ") + kolorist.blue(config.to) + kolorist.dim(` (${commits.length} commits)`));
|
|
34
|
-
console.log(kolorist.dim("--------------"));
|
|
35
|
-
console.log();
|
|
36
|
-
console.log(markdown);
|
|
37
|
-
console.log();
|
|
38
|
-
console.log(kolorist.dim("--------------"));
|
|
39
|
-
if (config.dry) {
|
|
40
|
-
console.log(kolorist.yellow("Dry run. Release skipped."));
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (!await index.hasTagOnGitHub(config.to, config)) {
|
|
44
|
-
console.error(kolorist.yellow(`Current ref "${kolorist.bold(config.to)}" is not available as tags on GitHub. Release skipped.`));
|
|
45
|
-
process.exitCode = 1;
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (!commits.length && await index.isRepoShallow()) {
|
|
49
|
-
console.error(
|
|
50
|
-
kolorist.yellow(
|
|
51
|
-
"The repo seems to be clone shallowly, which make changelog failed to generate. You might want to specify `fetch-depth: 0` in your CI config."
|
|
52
|
-
)
|
|
53
|
-
);
|
|
54
|
-
process.exitCode = 1;
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
await index.sendRelease(config, md);
|
|
58
|
-
} catch (e) {
|
|
59
|
-
console.error(kolorist.red(String(e)));
|
|
60
|
-
if (e?.stack) {
|
|
61
|
-
console.error(kolorist.dim(e.stack?.split("\n").slice(1).join("\n")));
|
|
62
|
-
}
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
cli.parse();
|
|
1
|
+
module.exports = require("/Users/soybean/Web/Projects/SoybeanJS/changelog/node_modules/.pnpm/jiti@1.19.3/node_modules/jiti/lib/index.js")(null, { interopDefault: true, esmResolve: true })("/Users/soybean/Web/Projects/SoybeanJS/changelog/packages/githublogen/src/cli.ts")
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export { }
|
|
1
|
+
export * from "/Users/soybean/Web/Projects/SoybeanJS/changelog/packages/githublogen/src/cli";
|
|
2
|
+
export { default } from "/Users/soybean/Web/Projects/SoybeanJS/changelog/packages/githublogen/src/cli";
|
package/dist/cli.mjs
CHANGED
|
@@ -1,60 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { dim, bold, cyan, blue, yellow, red } from 'kolorist';
|
|
3
|
-
import cac from 'cac';
|
|
4
|
-
import { generate, hasTagOnGitHub, isRepoShallow, sendRelease } from './index.mjs';
|
|
5
|
-
import 'ohmyfetch';
|
|
6
|
-
import 'convert-gitmoji';
|
|
7
|
-
import 'node:fs';
|
|
8
|
-
import 'node:module';
|
|
9
|
-
import 'node:url';
|
|
10
|
-
import 'node:assert';
|
|
11
|
-
import 'node:process';
|
|
12
|
-
import 'node:path';
|
|
13
|
-
import 'node:v8';
|
|
14
|
-
import 'node:util';
|
|
1
|
+
import jiti from "file:///Users/soybean/Web/Projects/SoybeanJS/changelog/node_modules/.pnpm/jiti@1.19.3/node_modules/jiti/lib/index.js";
|
|
15
2
|
|
|
16
|
-
|
|
3
|
+
/** @type {import("/Users/soybean/Web/Projects/SoybeanJS/changelog/packages/githublogen/src/cli")} */
|
|
4
|
+
const _module = jiti(null, { interopDefault: true, esmResolve: true })("/Users/soybean/Web/Projects/SoybeanJS/changelog/packages/githublogen/src/cli.ts");
|
|
17
5
|
|
|
18
|
-
|
|
19
|
-
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();
|
|
20
|
-
cli.command("").action(async (args) => {
|
|
21
|
-
try {
|
|
22
|
-
console.log();
|
|
23
|
-
console.log(dim(`${bold("github")}logen `) + dim(`v${version}`));
|
|
24
|
-
const cwd = process.cwd();
|
|
25
|
-
const { config, md, commits } = await generate(cwd, args);
|
|
26
|
-
const markdown = md.replace(/ /g, "");
|
|
27
|
-
console.log(cyan(config.from) + dim(" -> ") + blue(config.to) + dim(` (${commits.length} commits)`));
|
|
28
|
-
console.log(dim("--------------"));
|
|
29
|
-
console.log();
|
|
30
|
-
console.log(markdown);
|
|
31
|
-
console.log();
|
|
32
|
-
console.log(dim("--------------"));
|
|
33
|
-
if (config.dry) {
|
|
34
|
-
console.log(yellow("Dry run. Release skipped."));
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (!await hasTagOnGitHub(config.to, config)) {
|
|
38
|
-
console.error(yellow(`Current ref "${bold(config.to)}" is not available as tags on GitHub. Release skipped.`));
|
|
39
|
-
process.exitCode = 1;
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (!commits.length && await isRepoShallow()) {
|
|
43
|
-
console.error(
|
|
44
|
-
yellow(
|
|
45
|
-
"The repo seems to be clone shallowly, which make changelog failed to generate. You might want to specify `fetch-depth: 0` in your CI config."
|
|
46
|
-
)
|
|
47
|
-
);
|
|
48
|
-
process.exitCode = 1;
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
await sendRelease(config, md);
|
|
52
|
-
} catch (e) {
|
|
53
|
-
console.error(red(String(e)));
|
|
54
|
-
if (e?.stack) {
|
|
55
|
-
console.error(dim(e.stack?.split("\n").slice(1).join("\n")));
|
|
56
|
-
}
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
cli.parse();
|
|
6
|
+
export default _module;
|
package/package.json
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "githublogen",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"author": {
|
|
7
|
-
"name": "
|
|
8
|
-
"email": "
|
|
7
|
+
"name": "Soybean",
|
|
8
|
+
"email": "soybeanjs@outlook.com",
|
|
9
9
|
"url": "https://github.com/soybeanjs"
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"homepage": "https://github.com/soybeanjs/githublogen#readme",
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/soybeanjs/githublogen.git"
|
|
16
|
-
},
|
|
17
|
-
"bugs": "https://github.com/soybeanjs/githublogen/issues",
|
|
18
12
|
"publishConfig": {
|
|
19
13
|
"registry": "https://registry.npmjs.org/"
|
|
20
14
|
},
|
|
@@ -26,16 +20,6 @@
|
|
|
26
20
|
"changelog",
|
|
27
21
|
"log"
|
|
28
22
|
],
|
|
29
|
-
"exports": {
|
|
30
|
-
".": {
|
|
31
|
-
"types": "./dist/index.d.ts",
|
|
32
|
-
"require": "./dist/index.cjs",
|
|
33
|
-
"import": "./dist/index.mjs"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"main": "./dist/index.mjs",
|
|
37
|
-
"module": "./dist/index.mjs",
|
|
38
|
-
"types": "./dist/index.d.ts",
|
|
39
23
|
"bin": {
|
|
40
24
|
"githublogen": "./dist/cli.mjs"
|
|
41
25
|
},
|
|
@@ -46,37 +30,22 @@
|
|
|
46
30
|
"node": ">=12.0.0"
|
|
47
31
|
},
|
|
48
32
|
"dependencies": {
|
|
49
|
-
"c12": "1.4.
|
|
33
|
+
"c12": "1.4.2",
|
|
50
34
|
"cac": "6.7.14",
|
|
51
|
-
"
|
|
52
|
-
"execa": "7.1.1",
|
|
35
|
+
"execa": "8.0.1",
|
|
53
36
|
"kolorist": "1.8.0",
|
|
54
|
-
"
|
|
37
|
+
"ofetch": "1.2.0",
|
|
38
|
+
"@soybeanjs/changelog": "0.3.1"
|
|
55
39
|
},
|
|
56
40
|
"devDependencies": {
|
|
57
|
-
"@soybeanjs/cli": "0.
|
|
58
|
-
"@types/node": "20.2
|
|
59
|
-
"
|
|
60
|
-
"eslint-config-soybeanjs": "0.4.8",
|
|
61
|
-
"simple-git-hooks": "2.8.1",
|
|
62
|
-
"tsx": "3.12.7",
|
|
63
|
-
"typescript": "5.1.3",
|
|
41
|
+
"@soybeanjs/cli": "0.6.7",
|
|
42
|
+
"@types/node": "20.5.2",
|
|
43
|
+
"typescript": "5.1.6",
|
|
64
44
|
"unbuild": "1.2.1"
|
|
65
45
|
},
|
|
66
|
-
"simple-git-hooks": {
|
|
67
|
-
"commit-msg": "pnpm soy git-commit-verify",
|
|
68
|
-
"pre-commit": "pnpm soy lint-staged"
|
|
69
|
-
},
|
|
70
|
-
"github-token": "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",
|
|
71
46
|
"scripts": {
|
|
72
47
|
"build": "pnpm typecheck && unbuild",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"commit": "soy git-commit",
|
|
76
|
-
"cleanup": "soy cleanup",
|
|
77
|
-
"update-pkg": "soy update-pkg",
|
|
78
|
-
"publish-pkg": "pnpm -r publish --access public",
|
|
79
|
-
"release": "pnpm soy release && pnpm build && pnpm publish-pkg",
|
|
80
|
-
"typecheck": "tsc --noEmit"
|
|
48
|
+
"stub": "pnpm unbuild --stub",
|
|
49
|
+
"typecheck": "tsc --noEmit --skipLibCheck"
|
|
81
50
|
}
|
|
82
51
|
}
|
package/README.md
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# githublogen
|
|
2
|
-
|
|
3
|
-
Generate changelog for GitHub releases from [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), powered by [changelogithub](https://github.com/antfu/changelogithub).
|
|
4
|
-
|
|
5
|
-
Auto Generate CHANGELOG.md from [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), powered by [changelogen](https://github.com/unjs/changelogen).
|
|
6
|
-
|
|
7
|
-
## Usage
|
|
8
|
-
|
|
9
|
-
In GitHub Actions:
|
|
10
|
-
|
|
11
|
-
```yml
|
|
12
|
-
# .github/workflows/release.yml
|
|
13
|
-
|
|
14
|
-
name: Release
|
|
15
|
-
|
|
16
|
-
permissions:
|
|
17
|
-
contents: write
|
|
18
|
-
|
|
19
|
-
on:
|
|
20
|
-
push:
|
|
21
|
-
tags:
|
|
22
|
-
- "v*"
|
|
23
|
-
|
|
24
|
-
jobs:
|
|
25
|
-
release:
|
|
26
|
-
runs-on: ubuntu-latest
|
|
27
|
-
steps:
|
|
28
|
-
- uses: actions/checkout@v3
|
|
29
|
-
with:
|
|
30
|
-
fetch-depth: 0
|
|
31
|
-
|
|
32
|
-
- uses: actions/setup-node@v3
|
|
33
|
-
with:
|
|
34
|
-
node-version: 16.x
|
|
35
|
-
|
|
36
|
-
- run: npx githublogen
|
|
37
|
-
env:
|
|
38
|
-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
It will be trigged whenever you push a tag to GitHub that starts with `v`.
|
|
42
|
-
|
|
43
|
-
## Configuration
|
|
44
|
-
|
|
45
|
-
You can put a configuration file in the project root, named as `githublogen.config.{json,ts,js,mjs,cjs}`, `.githublogenrc` or use the `githublogen` field in `package.json`.
|
|
46
|
-
|
|
47
|
-
## Preview Locally
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
npx githublogen --dry
|
|
51
|
-
```
|