@ljharb/coauthors 2.0.0 → 2.0.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/CHANGELOG.md +19 -0
- package/bin.mjs +6 -4
- package/package.json +14 -26
- package/results.mjs +4 -5
- package/validateRemote.mjs +7 -7
- package/help.txt +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [v2.0.1](https://github.com/ljharb/coauthors/compare/v2.0.0...v2.0.1) - 2026-06-18
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- [types] clean up some annotations [`5c56964`](https://github.com/ljharb/coauthors/commit/5c56964c94ec43d0c593b8e82a3759267c940e22)
|
|
13
|
+
- [Dev Deps] update `eslint` [`e39c67a`](https://github.com/ljharb/coauthors/commit/e39c67ad57b9de9c9d627ca8ac729d1472d152b7)
|
|
14
|
+
- [Tests] extract coverage config to file [`b13990e`](https://github.com/ljharb/coauthors/commit/b13990e8049a070dee35d6d9b3c3ce4d242f53ba)
|
|
15
|
+
- [actions] update workflows [`a4bb6ef`](https://github.com/ljharb/coauthors/commit/a4bb6ef475b80587431ed03400a850bf22c15709)
|
|
16
|
+
- [Tests] increase coverage [`b980162`](https://github.com/ljharb/coauthors/commit/b9801621dc9bcf2d2d0c00f2a252f89bf89a8791)
|
|
17
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `@types/node`, `auto-changelog`, `esmock`, `tape` [`7562264`](https://github.com/ljharb/coauthors/commit/7562264c14baf865411f03b5f3a31d8451bdf0c5)
|
|
18
|
+
- [Deps] update `pargs` [`9be2a35`](https://github.com/ljharb/coauthors/commit/9be2a35b70f1ad771cc1bfb743cde7c48702ca4c)
|
|
19
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `@types/node`, `eslint`, `npmignore` [`78926c8`](https://github.com/ljharb/coauthors/commit/78926c848b5644ab3a08693b8a28d85171bd7e06)
|
|
20
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `@types/node` [`4316fe4`](https://github.com/ljharb/coauthors/commit/4316fe4f0975e1472af8a857666e82b5c6f4fc9a)
|
|
21
|
+
- [Deps] update `pargs` [`0bd17fb`](https://github.com/ljharb/coauthors/commit/0bd17fb53c0b1b8058f8d5d47d3b53ffe9c55ff8)
|
|
22
|
+
- [Deps] update `pargs` [`9cbfea5`](https://github.com/ljharb/coauthors/commit/9cbfea509bd39b6dfa020818169bfd7499fbf761)
|
|
23
|
+
- [Deps] update `pargs` [`f036877`](https://github.com/ljharb/coauthors/commit/f0368774d195dfaf96356e8ce6e8ac4173a55485)
|
|
24
|
+
- [Dev Deps] update `c8` [`ce1d62e`](https://github.com/ljharb/coauthors/commit/ce1d62e3613fc31ed8ee6a0bb4a213264b976c75)
|
|
25
|
+
- [Deps] update `pargs` [`edb1de1`](https://github.com/ljharb/coauthors/commit/edb1de1ffb208b503e1ac06a1a2c55ef289a8bd5)
|
|
26
|
+
|
|
8
27
|
## [v2.0.0](https://github.com/ljharb/coauthors/compare/v1.0.0...v2.0.0) - 2025-10-29
|
|
9
28
|
|
|
10
29
|
### Commits
|
package/bin.mjs
CHANGED
|
@@ -9,17 +9,19 @@ const {
|
|
|
9
9
|
help,
|
|
10
10
|
positionals,
|
|
11
11
|
errors,
|
|
12
|
-
} = await pargs(import.meta.filename, {
|
|
12
|
+
} = await pargs(import.meta.filename, {
|
|
13
|
+
allowPositionals: 1,
|
|
14
|
+
positionals: [{ description: 'the git remote to read co-authors from (default: origin)', name: 'remote' }],
|
|
15
|
+
});
|
|
13
16
|
|
|
14
17
|
const remote = validateRemote(positionals[0] ?? 'origin');
|
|
15
18
|
|
|
16
19
|
if (typeof remote !== 'string') {
|
|
17
|
-
errors.
|
|
20
|
+
errors[errors.length] = `${remote}`;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
await help();
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
const results = Array.from(getResults(/** @type {string} */ (remote)), (x) => `Co-authored-by: ${x}`);
|
|
25
|
+
const results = Array.from(getResults(`${remote}`), (x) => `Co-authored-by: ${x}`);
|
|
24
26
|
|
|
25
27
|
console.log(results.join('\n'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ljharb/coauthors",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "A cli to generate a complete git co-authors list, including existing co-authors, for use in a commit message.",
|
|
5
5
|
"bin": "./bin.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"prepack": "npmignore --auto --commentLines=autogenerated",
|
|
12
12
|
"prepublish": "not-in-publish || npm run prepublishOnly",
|
|
13
13
|
"prepublishOnly": "safe-publish-latest",
|
|
14
|
-
"lint": "eslint
|
|
14
|
+
"lint": "eslint .",
|
|
15
15
|
"postlint": "tsc",
|
|
16
16
|
"pretest": "npm run lint",
|
|
17
17
|
"tests-only": "c8 tape 'test/**/*.*js'",
|
|
@@ -39,39 +39,26 @@
|
|
|
39
39
|
"homepage": "https://github.com/ljharb/coauthors#readme",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"commit-to-co-authors": "^0.1.0",
|
|
42
|
-
"pargs": "^1.
|
|
42
|
+
"pargs": "^1.4.2"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": "^22.20 || ^24.10 || >= 25"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@ljharb/eslint-config": "^
|
|
48
|
+
"@ljharb/eslint-config": "^22.2.3",
|
|
49
49
|
"@ljharb/tsconfig": "^0.3.2",
|
|
50
|
-
"@types/node": "^22.
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"eslint": "^8.8.0",
|
|
56
|
-
"esmock": "^2.7.3",
|
|
50
|
+
"@types/node": "^22.19.21",
|
|
51
|
+
"auto-changelog": "^2.6.0",
|
|
52
|
+
"c8": "^11.0.0",
|
|
53
|
+
"eslint": "^10.5.0",
|
|
54
|
+
"esmock": "^2.7.6",
|
|
57
55
|
"in-publish": "^2.0.1",
|
|
58
|
-
"
|
|
56
|
+
"jiti": "^0.0.0",
|
|
57
|
+
"npmignore": "^0.3.5",
|
|
59
58
|
"safe-publish-latest": "^2.0.0",
|
|
60
|
-
"tape": "^5.
|
|
59
|
+
"tape": "^5.10.2",
|
|
61
60
|
"typescript": "next"
|
|
62
61
|
},
|
|
63
|
-
"c8": {
|
|
64
|
-
"all": true,
|
|
65
|
-
"reporters": [
|
|
66
|
-
"html",
|
|
67
|
-
"text",
|
|
68
|
-
"lcov"
|
|
69
|
-
],
|
|
70
|
-
"exclude": [
|
|
71
|
-
"coverage",
|
|
72
|
-
"./pargs.mjs"
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
62
|
"auto-changelog": {
|
|
76
63
|
"output": "CHANGELOG.md",
|
|
77
64
|
"template": "keepachangelog",
|
|
@@ -83,7 +70,8 @@
|
|
|
83
70
|
"publishConfig": {
|
|
84
71
|
"ignore": [
|
|
85
72
|
".github/workflows",
|
|
86
|
-
".
|
|
73
|
+
"eslint.config.mjs",
|
|
74
|
+
".nycrc",
|
|
87
75
|
"test"
|
|
88
76
|
]
|
|
89
77
|
}
|
package/results.mjs
CHANGED
|
@@ -4,19 +4,18 @@ import { commitToCoAuthors } from 'commit-to-co-authors';
|
|
|
4
4
|
|
|
5
5
|
import getDefaultBranch from './getDefaultBranch.mjs';
|
|
6
6
|
|
|
7
|
-
/** @
|
|
7
|
+
/** @param {string} remote */
|
|
8
8
|
export default function getResults(remote) {
|
|
9
9
|
const defaultBranch = getDefaultBranch(remote);
|
|
10
10
|
|
|
11
11
|
const logCommitters = `${execSync(`git shortlog -sne ${remote}/${defaultBranch}..HEAD`)}`;
|
|
12
12
|
const mappedLogCommitters = logCommitters.matchAll(/\t(?<author>.*)$/gm)
|
|
13
|
-
|
|
14
|
-
.map(
|
|
15
|
-
|
|
13
|
+
// @ts-expect-error TODO: file TS bug about `groups` always being present when a group is in the regex
|
|
14
|
+
.map((x) => x.groups.author);
|
|
15
|
+
|
|
16
16
|
const fromLogs = new Set(mappedLogCommitters);
|
|
17
17
|
|
|
18
18
|
const logText = `${execSync(`git log --no-expand-tabs --pretty=full ${remote}/${defaultBranch}..HEAD`)}`;
|
|
19
|
-
/** @type {Set<string>} */
|
|
20
19
|
const fromMsgs = new Set(commitToCoAuthors(logText).map(({ name, email }) => `${name} <${email}>`));
|
|
21
20
|
|
|
22
21
|
return fromMsgs.union(fromLogs);
|
package/validateRemote.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { execSync } from 'child_process';
|
|
2
2
|
|
|
3
|
-
/** @type {(remote: string, cwd?: string) => string | {
|
|
3
|
+
/** @type {(remote: string, cwd?: string) => string | { toString(): string }} */
|
|
4
4
|
export default function validateRemote(remote, cwd = process.cwd()) {
|
|
5
5
|
if (remote === '' || remote.includes(' ')) {
|
|
6
|
-
return {
|
|
6
|
+
return /** @type {{ toString(): string }} */ ({
|
|
7
7
|
__proto__: null,
|
|
8
|
-
|
|
9
|
-
};
|
|
8
|
+
toString() { return 'Remote name must not be empty, nor contain spaces.'; },
|
|
9
|
+
});
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const allRemotes = `${execSync('git remote', { cwd })}`.split('\n');
|
|
13
13
|
|
|
14
14
|
if (!allRemotes.includes(remote)) {
|
|
15
|
-
return {
|
|
15
|
+
return /** @type {{ toString(): string }} */ ({
|
|
16
16
|
__proto__: null,
|
|
17
|
-
|
|
18
|
-
};
|
|
17
|
+
toString() { return `Remote \`${remote}\` does not exist; check \`git remote\` output`; },
|
|
18
|
+
});
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
return remote;
|
package/help.txt
DELETED