all-contributors-for-repository 0.3.1 → 0.5.0

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.
Files changed (69) hide show
  1. package/README.md +25 -37
  2. package/lib/Contributor.d.ts +5 -3
  3. package/lib/Contributor.d.ts.map +1 -0
  4. package/lib/Contributor.js +9 -8
  5. package/lib/Contributor.js.map +1 -1
  6. package/lib/ContributorsCollection.d.ts +8 -6
  7. package/lib/ContributorsCollection.d.ts.map +1 -0
  8. package/lib/ContributorsCollection.js +20 -34
  9. package/lib/ContributorsCollection.js.map +1 -1
  10. package/lib/collect/adding/addAcceptedIssues.d.ts +6 -6
  11. package/lib/collect/adding/addAcceptedIssues.d.ts.map +1 -0
  12. package/lib/collect/adding/addAcceptedIssues.js +20 -34
  13. package/lib/collect/adding/addAcceptedIssues.js.map +1 -1
  14. package/lib/collect/adding/addMergedPulls.d.ts +6 -5
  15. package/lib/collect/adding/addMergedPulls.d.ts.map +1 -0
  16. package/lib/collect/adding/addMergedPulls.js +12 -17
  17. package/lib/collect/adding/addMergedPulls.js.map +1 -1
  18. package/lib/collect/api.d.ts +10 -8
  19. package/lib/collect/api.d.ts.map +1 -0
  20. package/lib/collect/api.js +23 -21
  21. package/lib/collect/api.js.map +1 -1
  22. package/lib/collect/collecting/collectAcceptedIssues.d.ts +408 -354
  23. package/lib/collect/collecting/collectAcceptedIssues.d.ts.map +1 -0
  24. package/lib/collect/collecting/collectAcceptedIssues.js +12 -12
  25. package/lib/collect/collecting/collectAcceptedIssues.js.map +1 -1
  26. package/lib/collect/collecting/collectIssueEvents.d.ts +596 -522
  27. package/lib/collect/collecting/collectIssueEvents.d.ts.map +1 -0
  28. package/lib/collect/collecting/collectIssueEvents.js +17 -22
  29. package/lib/collect/collecting/collectIssueEvents.js.map +1 -1
  30. package/lib/collect/collecting/collectMergedPulls.d.ts +393 -341
  31. package/lib/collect/collecting/collectMergedPulls.d.ts.map +1 -0
  32. package/lib/collect/collecting/collectMergedPulls.js +12 -10
  33. package/lib/collect/collecting/collectMergedPulls.js.map +1 -1
  34. package/lib/collect/collecting/collectRepoEvents.d.ts +551 -487
  35. package/lib/collect/collecting/collectRepoEvents.d.ts.map +1 -0
  36. package/lib/collect/collecting/collectRepoEvents.js +11 -13
  37. package/lib/collect/collecting/collectRepoEvents.js.map +1 -1
  38. package/lib/collect/index.d.ts +5 -3
  39. package/lib/collect/index.d.ts.map +1 -0
  40. package/lib/collect/index.js +20 -15
  41. package/lib/collect/index.js.map +1 -1
  42. package/lib/collect/parsing/parseMergedPullAuthors.d.ts +8 -6
  43. package/lib/collect/parsing/parseMergedPullAuthors.d.ts.map +1 -0
  44. package/lib/collect/parsing/parseMergedPullAuthors.js +12 -18
  45. package/lib/collect/parsing/parseMergedPullAuthors.js.map +1 -1
  46. package/lib/collect/parsing/parseMergedPullType.d.ts +3 -1
  47. package/lib/collect/parsing/parseMergedPullType.d.ts.map +1 -0
  48. package/lib/collect/parsing/parseMergedPullType.js +12 -10
  49. package/lib/collect/parsing/parseMergedPullType.js.map +1 -1
  50. package/lib/collect/processing/processContributors.d.ts +8 -8
  51. package/lib/collect/processing/processContributors.d.ts.map +1 -0
  52. package/lib/collect/processing/processContributors.js +13 -21
  53. package/lib/collect/processing/processContributors.js.map +1 -1
  54. package/lib/collect/processing/repoEventIsPullRequestReviewEvent.d.ts +10 -10
  55. package/lib/collect/processing/repoEventIsPullRequestReviewEvent.d.ts.map +1 -0
  56. package/lib/collect/processing/repoEventIsPullRequestReviewEvent.js +5 -4
  57. package/lib/collect/processing/repoEventIsPullRequestReviewEvent.js.map +1 -1
  58. package/lib/getAllContributorsForRepository.d.ts +5 -3
  59. package/lib/getAllContributorsForRepository.d.ts.map +1 -0
  60. package/lib/getAllContributorsForRepository.js +7 -8
  61. package/lib/getAllContributorsForRepository.js.map +1 -1
  62. package/lib/index.d.ts +4 -3
  63. package/lib/index.js +2 -4
  64. package/lib/options.d.ts +51 -49
  65. package/lib/options.d.ts.map +1 -0
  66. package/lib/options.js +28 -31
  67. package/lib/options.js.map +1 -1
  68. package/package.json +47 -55
  69. package/lib/index.js.map +0 -1
package/README.md CHANGED
@@ -1,37 +1,21 @@
1
1
  <h1 align="center">All Contributors For Repository</h1>
2
2
 
3
- <p align="center">Generates an <a href="https://allcontributors.org">allcontributors</a> list for an existing repository. 🤝</p>
4
-
5
3
  <p align="center">
6
- <a href="#contributors" target="_blank">
7
- <!-- prettier-ignore-start -->
8
- <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
9
- <img alt="All Contributors: 2" src="https://img.shields.io/badge/all_contributors-2-21bb42.svg" />
10
- <!-- ALL-CONTRIBUTORS-BADGE:END -->
11
- <!-- prettier-ignore-end -->
12
- </a>
13
- <a href="https://codecov.io/gh/JoshuaKGoldberg/all-contributors-for-repository" target="_blank">
14
- <img alt="Codecov Test Coverage" src="https://codecov.io/gh/JoshuaKGoldberg/all-contributors-for-repository/branch/main/graph/badge.svg"/>
15
- </a>
16
- <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank">
17
- <img alt="Contributor Covenant" src="https://img.shields.io/badge/code_of_conduct-enforced-21bb42" />
18
- </a>
19
- <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/blob/main/LICENSE.md" target="_blank">
20
- <img alt="License: MIT" src="https://img.shields.io/github/license/JoshuaKGoldberg/all-contributors-for-repository?color=21bb42">
21
- </a>
22
- <a href="https://github.com/sponsors/JoshuaKGoldberg" target="_blank">
23
- <img alt="Sponsor: On GitHub" src="https://img.shields.io/badge/sponsor-on_github-21bb42.svg" />
24
- </a>
25
- <img alt="Style: Prettier" src="https://img.shields.io/badge/style-prettier-21bb42.svg" />
26
- <img alt="TypeScript: Strict" src="https://img.shields.io/badge/typescript-strict-21bb42.svg" />
27
- <img alt="npm package version" src="https://img.shields.io/npm/v/all-contributors-for-repository?color=21bb42" />
28
- <img alt="Sponsor: On GitHub" src="https://img.shields.io/badge/sponsor-on_github-21bb42.svg" />
4
+ Generates an allcontributors list for an existing repository.
5
+ 🤝
29
6
  </p>
30
7
 
31
8
  <p align="center">
32
- <em>
33
- ✨ See this tool in action with <a href="https://github.com/JoshuaKGoldberg/all-contributors-auto-action">all-contributors-auto-action</a>! ✨
34
- </em>
9
+ <!-- prettier-ignore-start -->
10
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
11
+ <a href="#contributors" target="_blank"><img alt="👪 All Contributors: 3" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-3-21bb42.svg" /></a>
12
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
13
+ <!-- prettier-ignore-end -->
14
+ <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
15
+ <a href="https://codecov.io/gh/JoshuaKGoldberg/all-contributors-for-repository" target="_blank"><img alt="🧪 Coverage" src="https://img.shields.io/codecov/c/github/JoshuaKGoldberg/all-contributors-for-repository?label=%F0%9F%A7%AA%20coverage" /></a>
16
+ <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg" /></a>
17
+ <a href="http://npmjs.com/package/all-contributors-for-repository" target="_blank"><img alt="📦 npm version" src="https://img.shields.io/npm/v/all-contributors-for-repository?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
18
+ <img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
35
19
  </p>
36
20
 
37
21
  ## Usage
@@ -86,6 +70,9 @@ Additionally, based on PR [conventional commit titles](https://www.conventionalc
86
70
  > await $`npx all-contributors add ${contributor} ${contributionTypes}`;
87
71
  > }
88
72
  > ```
73
+ >
74
+ > See [populate-all-contributors-for-repository](https://github.com/JoshuaKGoldberg/populate-all-contributors-for-repository) for a project that does just that.
75
+ > 📋
89
76
 
90
77
  ### Options
91
78
 
@@ -97,11 +84,12 @@ The exported `getAllContributorsForRepository` function takes in an object with
97
84
  It additionally allows for the following optional options.
98
85
 
99
86
  - `auth` _(`string`)_: GitHub auth token to query the API with, if necessary for private repositories and/or to avoid rate limiting.
100
- - `ignoredLogins` _(`string[]`)_: Usernames to ignore commits from, such as bot and bot-like users.
101
- - Default: `"allcontributors"`, `"allcontributors[bot]"`, `"dependabot"`, `"dependabot[bot]"`, `"renovate"`, `"renovate[bot]"`
87
+ - `ignoredLogins` _(`RegExp[]`)_: Regular expressions for usernames to ignore commits from, such as bot users.
88
+ - Default: `[/\[bot\]$/i, /^allcontributors$/i, /^copilot$/i, /^dependabot$/i, /^renovate$/i]`
102
89
  - `labelAcceptingPrs` _(`string`)_: Label to indicate an issue is accepting pull requests.
103
90
  - `labelTypeBug` _(`string`)_: Label to indicate an issue is for a bug.
104
91
  - `labelTypeDocs` _(`string`)_: Label to indicate an issue is for documentation.
92
+ - `labelTypeIdeas` _(`string`)_: Label to indicate an issue is for a feature.
105
93
  - `labelTypeTool` _(`string`)_: Label to indicate an issue is for tooling.
106
94
 
107
95
  ```ts
@@ -109,10 +97,11 @@ import { getAllContributorsForRepository } from "all-contributors-for-repository
109
97
 
110
98
  getAllContributorsForRepository({
111
99
  auth: "abc123",
112
- ignoredLogins: ["MyBotLikeUser"],
100
+ ignoredLogins: [/-it$/i],
113
101
  labelAcceptingPrs: "help wanted",
114
102
  labelTypeBug: "bug",
115
103
  labelTypeDocs: "docs",
104
+ labelTypeIdeas: "feature",
116
105
  labelTypeTool: "tool",
117
106
  });
118
107
  ```
@@ -120,27 +109,26 @@ getAllContributorsForRepository({
120
109
  ## Development
121
110
 
122
111
  See [`.github/CONTRIBUTING.md`](./.github/CONTRIBUTING.md), then [`.github/DEVELOPMENT.md`](./.github/DEVELOPMENT.md).
123
- Thanks! 💖
112
+ Thanks! 🤝
124
113
 
125
114
  ## Contributors
126
115
 
127
116
  <!-- spellchecker: disable -->
128
117
  <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
129
118
  <!-- prettier-ignore-start -->
130
- <!-- markdownlint-disable -->
131
119
  <table>
132
120
  <tbody>
133
121
  <tr>
134
- <td align="center" valign="top" width="14.28%"><a href="https://www.fdlpm.com"><img src="https://avatars.githubusercontent.com/u/9667945?v=4?s=100" width="100px;" alt="Fabian De La Peña Montero"/><br /><sub><b>Fabian De La Peña Montero</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/commits?author=fdlpm" title="Documentation">📖</a></td>
135
- <td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg"/><br /><sub><b>Josh Goldberg</b></sub></a><br /><a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a> <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/issues?q=author%3AJoshuaKGoldberg" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/commits?author=JoshuaKGoldberg" title="Code">💻</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">🚧</a> <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/pulls?q=is%3Apr+reviewed-by%3AJoshuaKGoldberg" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/commits?author=JoshuaKGoldberg" title="Documentation">📖</a> <a href="#infra-JoshuaKGoldberg" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/commits?author=JoshuaKGoldberg" title="Tests">⚠️</a> <a href="#ideas-JoshuaKGoldberg" title="Ideas, Planning, & Feedback">🤔</a></td>
122
+ <td align="center"><a href="https://www.fdlpm.com"><img src="https://avatars.githubusercontent.com/u/9667945?v=4?s=100" width="100px;" alt="Fabian De La Peña Montero"/><br /><sub><b>Fabian De La Peña Montero</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/commits?author=fdlpm" title="Documentation">📖</a></td>
123
+ <td align="center"><a href="http://www.joshuakgoldberg.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg"/><br /><sub><b>Josh Goldberg</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/issues?q=author%3AJoshuaKGoldberg" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/commits?author=JoshuaKGoldberg" title="Code">💻</a> <a href="#content-JoshuaKGoldberg" title="Content">🖋</a> <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/commits?author=JoshuaKGoldberg" title="Documentation">📖</a> <a href="#ideas-JoshuaKGoldberg" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-JoshuaKGoldberg" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">🚧</a> <a href="#projectManagement-JoshuaKGoldberg" title="Project Management">📆</a> <a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/commits?author=JoshuaKGoldberg" title="Tests">⚠️</a> <a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a></td>
124
+ <td align="center"><a href="https://navinmoorthy.me/"><img src="https://avatars.githubusercontent.com/u/39694575?v=4?s=100" width="100px;" alt="Navin Moorthy"/><br /><sub><b>Navin Moorthy</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/all-contributors-for-repository/issues?q=author%3Anavin-moorthy" title="Bug reports">🐛</a></td>
136
125
  </tr>
137
126
  </tbody>
138
127
  </table>
139
128
 
140
- <!-- markdownlint-restore -->
141
129
  <!-- prettier-ignore-end -->
142
130
 
143
131
  <!-- ALL-CONTRIBUTORS-LIST:END -->
144
132
  <!-- spellchecker: enable -->
145
133
 
146
- > 💙 This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).
134
+ > 💝 This package was templated with [`create-typescript-app`](https://github.com/JoshuaKGoldberg/create-typescript-app) using the [Bingo framework](https://create.bingo).
@@ -1,6 +1,8 @@
1
+ //#region src/Contributor.d.ts
1
2
  declare class Contributor {
2
- readonly contributions: Record<string, Set<number>>;
3
- add(number: number, type: string): void;
3
+ readonly contributions: Record<string, Set<number>>;
4
+ add(number: number, type: string): void;
4
5
  }
5
-
6
+ //#endregion
6
7
  export { Contributor };
8
+ //# sourceMappingURL=Contributor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Contributor.d.ts","names":[],"sources":["../src/Contributor.ts"],"sourcesContent":[],"mappings":";cAAa,WAAA;EAAA,SAAA,aAAW,EACC,MAAe,CAAf,MAAA,EAAe,GAAT,CAAA,MAAA,CAAA,CAAA"}
@@ -1,10 +1,11 @@
1
- class Contributor {
2
- contributions = {};
3
- add(number, type) {
4
- (this.contributions[type] ??= /* @__PURE__ */ new Set()).add(number);
5
- }
6
- }
7
- export {
8
- Contributor
1
+ //#region src/Contributor.ts
2
+ var Contributor = class {
3
+ contributions = {};
4
+ add(number, type) {
5
+ (this.contributions[type] ??= /* @__PURE__ */ new Set()).add(number);
6
+ }
9
7
  };
8
+
9
+ //#endregion
10
+ export { Contributor };
10
11
  //# sourceMappingURL=Contributor.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Contributor.ts"],"sourcesContent":["export class Contributor {\n\treadonly contributions: Record<string, Set<number>> = {};\n\n\tadd(number: number, type: string) {\n\t\t(this.contributions[type] ??= new Set()).add(number);\n\t}\n}\n"],"mappings":"AAAO,MAAM,YAAY;AAAA,EACf,gBAA6C,CAAC;AAAA,EAEvD,IAAI,QAAgB,MAAc;AACjC,KAAC,KAAK,cAAc,IAAI,MAAM,oBAAI,IAAI,GAAG,IAAI,MAAM;AAAA,EACpD;AACD;","names":[]}
1
+ {"version":3,"file":"Contributor.js","names":[],"sources":["../src/Contributor.ts"],"sourcesContent":["export class Contributor {\n\treadonly contributions: Record<string, Set<number>> = {};\n\n\tadd(number: number, type: string) {\n\t\t(this.contributions[type] ??= new Set()).add(number);\n\t}\n}\n"],"mappings":";AAAA,IAAa,cAAb,MAAyB;CACxB,AAAS,gBAA6C,EAAE;CAExD,IAAI,QAAgB,MAAc;AACjC,GAAC,KAAK,cAAc,0BAAU,IAAI,KAAK,EAAE,IAAI,OAAO"}
@@ -1,3 +1,4 @@
1
+ //#region src/ContributorsCollection.d.ts
1
2
  /**
2
3
  * For a set of logins, the contributions under those users.
3
4
  */
@@ -7,10 +8,11 @@ type ContributorsContributions = Record<string, ContributorContributions>;
7
8
  */
8
9
  type ContributorContributions = Record<string, number[]>;
9
10
  declare class ContributorsCollection {
10
- #private;
11
- constructor(ignoredLogins: Set<string>);
12
- add(login: string | undefined, number: number, type: string): void;
13
- collect(): ContributorsContributions;
11
+ #private;
12
+ constructor(ignoredLogins?: RegExp[]);
13
+ add(login: string | undefined, number: number, type: string): void;
14
+ collect(): ContributorsContributions;
14
15
  }
15
-
16
- export { type ContributorContributions, ContributorsCollection, type ContributorsContributions };
16
+ //#endregion
17
+ export { ContributorContributions, ContributorsCollection, ContributorsContributions };
18
+ //# sourceMappingURL=ContributorsCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContributorsCollection.d.ts","names":[],"sources":["../src/ContributorsCollection.ts"],"sourcesContent":[],"mappings":";;AAKA;AAQA;AAEa,KAVD,yBAAA,GAA4B,MAcX,CAAA,MAoBjB,EAhCX,wBAgCoC,CAAA;;;;KA1BzB,wBAAA,GAA2B;cAE1B,sBAAA;;8BAIgB;;aAoBjB"}
@@ -1,37 +1,23 @@
1
1
  import { Contributor } from "./Contributor.js";
2
- class ContributorsCollection {
3
- #contributors = {};
4
- #ignoredLogins;
5
- constructor(ignoredLogins) {
6
- this.#ignoredLogins = ignoredLogins;
7
- }
8
- add(login, number, type) {
9
- if (login && !this.#ignoredLogins.has(login)) {
10
- (this.#contributors[login.toLowerCase()] ??= new Contributor()).add(
11
- number,
12
- type
13
- );
14
- }
15
- }
16
- collect() {
17
- return Object.fromEntries(
18
- Object.entries(this.#contributors).map(
19
- ([login, contributor]) => [
20
- login,
21
- Object.fromEntries(
22
- Object.entries(contributor.contributions).map(
23
- ([type, numbers]) => [
24
- type,
25
- Array.from(numbers).sort((a, b) => a - b)
26
- ]
27
- )
28
- )
29
- ]
30
- ).sort(([a], [b]) => a.localeCompare(b))
31
- );
32
- }
33
- }
34
- export {
35
- ContributorsCollection
2
+
3
+ //#region src/ContributorsCollection.ts
4
+ var ContributorsCollection = class {
5
+ #contributors = {};
6
+ #ignoredLogins;
7
+ constructor(ignoredLogins) {
8
+ this.#ignoredLogins = ignoredLogins ?? [];
9
+ }
10
+ add(login, number, type) {
11
+ if (!login) return;
12
+ const loginNormalized = login.toLowerCase();
13
+ if (this.#ignoredLogins.some((pattern) => pattern.test(login))) return;
14
+ (this.#contributors[loginNormalized] ??= new Contributor()).add(number, type);
15
+ }
16
+ collect() {
17
+ return Object.fromEntries(Object.entries(this.#contributors).map(([login, contributor]) => [login, Object.fromEntries(Object.entries(contributor.contributions).map(([type, numbers]) => [type, Array.from(numbers).sort((a, b) => a - b)]))]).sort(([a], [b]) => a.localeCompare(b)));
18
+ }
36
19
  };
20
+
21
+ //#endregion
22
+ export { ContributorsCollection };
37
23
  //# sourceMappingURL=ContributorsCollection.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ContributorsCollection.ts"],"sourcesContent":["import { Contributor } from \"./Contributor.js\";\n\n/**\n * For a set of logins, the contributions under those users.\n */\nexport type ContributorsContributions = Record<\n\tstring,\n\tContributorContributions\n>;\n\n/**\n * For each contribution under a login, the issue/PR numbers that count as that type.\n */\nexport type ContributorContributions = Record<string, number[]>;\n\nexport class ContributorsCollection {\n\t#contributors: Record<string, Contributor> = {};\n\t#ignoredLogins: Set<string>;\n\n\tconstructor(ignoredLogins: Set<string>) {\n\t\tthis.#ignoredLogins = ignoredLogins;\n\t}\n\n\tadd(login: string | undefined, number: number, type: string) {\n\t\tif (login && !this.#ignoredLogins.has(login)) {\n\t\t\t(this.#contributors[login.toLowerCase()] ??= new Contributor()).add(\n\t\t\t\tnumber,\n\t\t\t\ttype,\n\t\t\t);\n\t\t}\n\t}\n\n\tcollect(): ContributorsContributions {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(this.#contributors)\n\t\t\t\t.map(\n\t\t\t\t\t([login, contributor]) =>\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tlogin,\n\t\t\t\t\t\t\tObject.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries(contributor.contributions).map(\n\t\t\t\t\t\t\t\t\t([type, numbers]) => [\n\t\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\t\tArray.from(numbers).sort((a, b) => a - b),\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t] as const,\n\t\t\t\t)\n\t\t\t\t.sort(([a], [b]) => a.localeCompare(b)),\n\t\t);\n\t}\n}\n"],"mappings":"AAAA,SAAS,mBAAmB;AAerB,MAAM,uBAAuB;AAAA,EACnC,gBAA6C,CAAC;AAAA,EAC9C;AAAA,EAEA,YAAY,eAA4B;AACvC,SAAK,iBAAiB;AAAA,EACvB;AAAA,EAEA,IAAI,OAA2B,QAAgB,MAAc;AAC5D,QAAI,SAAS,CAAC,KAAK,eAAe,IAAI,KAAK,GAAG;AAC7C,OAAC,KAAK,cAAc,MAAM,YAAY,CAAC,MAAM,IAAI,YAAY,GAAG;AAAA,QAC/D;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EAEA,UAAqC;AACpC,WAAO,OAAO;AAAA,MACb,OAAO,QAAQ,KAAK,aAAa,EAC/B;AAAA,QACA,CAAC,CAAC,OAAO,WAAW,MACnB;AAAA,UACC;AAAA,UACA,OAAO;AAAA,YACN,OAAO,QAAQ,YAAY,aAAa,EAAE;AAAA,cACzC,CAAC,CAAC,MAAM,OAAO,MAAM;AAAA,gBACpB;AAAA,gBACA,MAAM,KAAK,OAAO,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AAAA,cACzC;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACF,EACC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAAA,IACxC;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"file":"ContributorsCollection.js","names":["#ignoredLogins","#contributors"],"sources":["../src/ContributorsCollection.ts"],"sourcesContent":["import { Contributor } from \"./Contributor.js\";\n\n/**\n * For a set of logins, the contributions under those users.\n */\nexport type ContributorsContributions = Record<\n\tstring,\n\tContributorContributions\n>;\n\n/**\n * For each contribution under a login, the issue/PR numbers that count as that type.\n */\nexport type ContributorContributions = Record<string, number[]>;\n\nexport class ContributorsCollection {\n\t#contributors: Record<string, Contributor> = {};\n\t#ignoredLogins: RegExp[];\n\n\tconstructor(ignoredLogins?: RegExp[]) {\n\t\tthis.#ignoredLogins = ignoredLogins ?? [];\n\t}\n\n\tadd(login: string | undefined, number: number, type: string) {\n\t\tif (!login) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst loginNormalized = login.toLowerCase();\n\t\tif (this.#ignoredLogins.some((pattern) => pattern.test(login))) {\n\t\t\treturn;\n\t\t}\n\n\t\t(this.#contributors[loginNormalized] ??= new Contributor()).add(\n\t\t\tnumber,\n\t\t\ttype,\n\t\t);\n\t}\n\n\tcollect(): ContributorsContributions {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(this.#contributors)\n\t\t\t\t.map(\n\t\t\t\t\t([login, contributor]) =>\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tlogin,\n\t\t\t\t\t\t\tObject.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries(contributor.contributions).map(\n\t\t\t\t\t\t\t\t\t([type, numbers]) => [\n\t\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\t\tArray.from(numbers).sort((a, b) => a - b),\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t] as const,\n\t\t\t\t)\n\t\t\t\t.sort(([a], [b]) => a.localeCompare(b)),\n\t\t);\n\t}\n}\n"],"mappings":";;;AAeA,IAAa,yBAAb,MAAoC;CACnC,gBAA6C,EAAE;CAC/C;CAEA,YAAY,eAA0B;AACrC,QAAKA,gBAAiB,iBAAiB,EAAE;;CAG1C,IAAI,OAA2B,QAAgB,MAAc;AAC5D,MAAI,CAAC,MACJ;EAGD,MAAM,kBAAkB,MAAM,aAAa;AAC3C,MAAI,MAAKA,cAAe,MAAM,YAAY,QAAQ,KAAK,MAAM,CAAC,CAC7D;AAGD,GAAC,MAAKC,aAAc,qBAAqB,IAAI,aAAa,EAAE,IAC3D,QACA,KACA;;CAGF,UAAqC;AACpC,SAAO,OAAO,YACb,OAAO,QAAQ,MAAKA,aAAc,CAChC,KACC,CAAC,OAAO,iBACR,CACC,OACA,OAAO,YACN,OAAO,QAAQ,YAAY,cAAc,CAAC,KACxC,CAAC,MAAM,aAAa,CACpB,MACA,MAAM,KAAK,QAAQ,CAAC,MAAM,GAAG,MAAM,IAAI,EAAE,CACzC,CACD,CACD,CACD,CACF,CACA,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC,CACxC"}
@@ -1,9 +1,9 @@
1
- import { ContributorsCollection } from '../../ContributorsCollection.js';
2
- import { AllContributorsForRepositoryOptions } from '../../options.js';
3
- import { AcceptedIssue } from '../collecting/collectAcceptedIssues.js';
4
- import 'octokit';
5
- import '../api.js';
1
+ import { ContributorsCollection } from "../../ContributorsCollection.js";
2
+ import { AllContributorsForRepositoryOptions } from "../../options.js";
3
+ import { AcceptedIssue } from "../collecting/collectAcceptedIssues.js";
6
4
 
5
+ //#region src/collect/adding/addAcceptedIssues.d.ts
7
6
  declare function addAcceptedIssues(acceptedIssues: AcceptedIssue[], contributors: Pick<ContributorsCollection, "add">, options: Pick<AllContributorsForRepositoryOptions, `labelType${string}` & keyof AllContributorsForRepositoryOptions>): void;
8
-
7
+ //#endregion
9
8
  export { addAcceptedIssues };
9
+ //# sourceMappingURL=addAcceptedIssues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addAcceptedIssues.d.ts","names":[],"sources":["../../../src/collect/adding/addAcceptedIssues.ts"],"sourcesContent":[],"mappings":";;;;;iBAMgB,iBAAA,iBACC,+BACF,KAAK,yCACV,KACR,kEAC6B"}
@@ -1,38 +1,24 @@
1
1
  import { descriptionToCoAuthors } from "description-to-co-authors";
2
+
3
+ //#region src/collect/adding/addAcceptedIssues.ts
2
4
  function addAcceptedIssues(acceptedIssues, contributors, options) {
3
- for (const acceptedIssue of acceptedIssues) {
4
- const labels = acceptedIssue.labels.map(
5
- (label) => typeof label === "string" ? label : label.name
6
- );
7
- for (const [labelType, contribution] of [
8
- // 🐛 `bug`: anybody who filed an issue labeled as accepting PRs and a bug
9
- [options.labelTypeBug, "bug"],
10
- // - 📖 `doc`: authors of merged PRs that address issues labeled as docs
11
- [options.labelTypeDocs, "docs"],
12
- // 💡 `ideas`: anybody who filed an issue labeled as accepting PRs and a feature
13
- [options.labelTypeIdeas, "ideas"],
14
- // - 🔧 `tool`: authors of merged PRs that address issues labeled as tooling
15
- [options.labelTypeTool, "tool"]
16
- ]) {
17
- if (!labels.some((label) => label === labelType)) {
18
- continue;
19
- }
20
- const logins = [];
21
- if (acceptedIssue.user) {
22
- logins.push(acceptedIssue.user.login);
23
- }
24
- if (acceptedIssue.body) {
25
- for (const coAuthor of descriptionToCoAuthors(acceptedIssue.body)) {
26
- logins.push(coAuthor.username);
27
- }
28
- }
29
- for (const login of logins) {
30
- contributors.add(login, acceptedIssue.number, contribution);
31
- }
32
- }
33
- }
5
+ for (const acceptedIssue of acceptedIssues) {
6
+ const labels = acceptedIssue.labels.map((label) => typeof label === "string" ? label : label.name);
7
+ for (const [labelType, contribution] of [
8
+ [options.labelTypeBug, "bug"],
9
+ [options.labelTypeDocs, "docs"],
10
+ [options.labelTypeIdeas, "ideas"],
11
+ [options.labelTypeTool, "tool"]
12
+ ]) {
13
+ if (!labels.some((label) => label === labelType)) continue;
14
+ const logins = [];
15
+ if (acceptedIssue.user) logins.push(acceptedIssue.user.login);
16
+ if (acceptedIssue.body) for (const coAuthor of descriptionToCoAuthors(acceptedIssue.body)) logins.push(coAuthor.username);
17
+ for (const login of logins) contributors.add(login, acceptedIssue.number, contribution);
18
+ }
19
+ }
34
20
  }
35
- export {
36
- addAcceptedIssues
37
- };
21
+
22
+ //#endregion
23
+ export { addAcceptedIssues };
38
24
  //# sourceMappingURL=addAcceptedIssues.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collect/adding/addAcceptedIssues.ts"],"sourcesContent":["import { descriptionToCoAuthors } from \"description-to-co-authors\";\n\nimport { ContributorsCollection } from \"../../ContributorsCollection.js\";\nimport { AllContributorsForRepositoryOptions } from \"../../options.js\";\nimport { AcceptedIssue } from \"../collecting/collectAcceptedIssues.js\";\n\nexport function addAcceptedIssues(\n\tacceptedIssues: AcceptedIssue[],\n\tcontributors: Pick<ContributorsCollection, \"add\">,\n\toptions: Pick<\n\t\tAllContributorsForRepositoryOptions,\n\t\t`labelType${string}` & keyof AllContributorsForRepositoryOptions\n\t>,\n) {\n\tfor (const acceptedIssue of acceptedIssues) {\n\t\tconst labels = acceptedIssue.labels.map((label) =>\n\t\t\ttypeof label === \"string\" ? label : label.name,\n\t\t);\n\n\t\tfor (const [labelType, contribution] of [\n\t\t\t// 🐛 `bug`: anybody who filed an issue labeled as accepting PRs and a bug\n\t\t\t[options.labelTypeBug, \"bug\"],\n\t\t\t// - 📖 `doc`: authors of merged PRs that address issues labeled as docs\n\t\t\t[options.labelTypeDocs, \"docs\"],\n\t\t\t// 💡 `ideas`: anybody who filed an issue labeled as accepting PRs and a feature\n\t\t\t[options.labelTypeIdeas, \"ideas\"],\n\t\t\t// - 🔧 `tool`: authors of merged PRs that address issues labeled as tooling\n\t\t\t[options.labelTypeTool, \"tool\"],\n\t\t] as const) {\n\t\t\tif (!labels.some((label) => label === labelType)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst logins = [];\n\n\t\t\tif (acceptedIssue.user) {\n\t\t\t\tlogins.push(acceptedIssue.user.login);\n\t\t\t}\n\n\t\t\tif (acceptedIssue.body) {\n\t\t\t\tfor (const coAuthor of descriptionToCoAuthors(acceptedIssue.body)) {\n\t\t\t\t\tlogins.push(coAuthor.username);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const login of logins) {\n\t\t\t\tcontributors.add(login, acceptedIssue.number, contribution);\n\t\t\t}\n\t\t}\n\t}\n}\n"],"mappings":"AAAA,SAAS,8BAA8B;AAMhC,SAAS,kBACf,gBACA,cACA,SAIC;AACD,aAAW,iBAAiB,gBAAgB;AAC3C,UAAM,SAAS,cAAc,OAAO;AAAA,MAAI,CAAC,UACxC,OAAO,UAAU,WAAW,QAAQ,MAAM;AAAA,IAC3C;AAEA,eAAW,CAAC,WAAW,YAAY,KAAK;AAAA;AAAA,MAEvC,CAAC,QAAQ,cAAc,KAAK;AAAA;AAAA,MAE5B,CAAC,QAAQ,eAAe,MAAM;AAAA;AAAA,MAE9B,CAAC,QAAQ,gBAAgB,OAAO;AAAA;AAAA,MAEhC,CAAC,QAAQ,eAAe,MAAM;AAAA,IAC/B,GAAY;AACX,UAAI,CAAC,OAAO,KAAK,CAAC,UAAU,UAAU,SAAS,GAAG;AACjD;AAAA,MACD;AAEA,YAAM,SAAS,CAAC;AAEhB,UAAI,cAAc,MAAM;AACvB,eAAO,KAAK,cAAc,KAAK,KAAK;AAAA,MACrC;AAEA,UAAI,cAAc,MAAM;AACvB,mBAAW,YAAY,uBAAuB,cAAc,IAAI,GAAG;AAClE,iBAAO,KAAK,SAAS,QAAQ;AAAA,QAC9B;AAAA,MACD;AAEA,iBAAW,SAAS,QAAQ;AAC3B,qBAAa,IAAI,OAAO,cAAc,QAAQ,YAAY;AAAA,MAC3D;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"file":"addAcceptedIssues.js","names":[],"sources":["../../../src/collect/adding/addAcceptedIssues.ts"],"sourcesContent":["import { descriptionToCoAuthors } from \"description-to-co-authors\";\n\nimport { ContributorsCollection } from \"../../ContributorsCollection.js\";\nimport { AllContributorsForRepositoryOptions } from \"../../options.js\";\nimport { AcceptedIssue } from \"../collecting/collectAcceptedIssues.js\";\n\nexport function addAcceptedIssues(\n\tacceptedIssues: AcceptedIssue[],\n\tcontributors: Pick<ContributorsCollection, \"add\">,\n\toptions: Pick<\n\t\tAllContributorsForRepositoryOptions,\n\t\t`labelType${string}` & keyof AllContributorsForRepositoryOptions\n\t>,\n) {\n\tfor (const acceptedIssue of acceptedIssues) {\n\t\tconst labels = acceptedIssue.labels.map((label) =>\n\t\t\ttypeof label === \"string\" ? label : label.name,\n\t\t);\n\n\t\tfor (const [labelType, contribution] of [\n\t\t\t// 🐛 `bug`: anybody who filed an issue labeled as accepting PRs and a bug\n\t\t\t[options.labelTypeBug, \"bug\"],\n\t\t\t// - 📖 `doc`: authors of merged PRs that address issues labeled as docs\n\t\t\t[options.labelTypeDocs, \"docs\"],\n\t\t\t// 💡 `ideas`: anybody who filed an issue labeled as accepting PRs and a feature\n\t\t\t[options.labelTypeIdeas, \"ideas\"],\n\t\t\t// - 🔧 `tool`: authors of merged PRs that address issues labeled as tooling\n\t\t\t[options.labelTypeTool, \"tool\"],\n\t\t] as const) {\n\t\t\tif (!labels.some((label) => label === labelType)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst logins = [];\n\n\t\t\tif (acceptedIssue.user) {\n\t\t\t\tlogins.push(acceptedIssue.user.login);\n\t\t\t}\n\n\t\t\tif (acceptedIssue.body) {\n\t\t\t\tfor (const coAuthor of descriptionToCoAuthors(acceptedIssue.body)) {\n\t\t\t\t\tlogins.push(coAuthor.username);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const login of logins) {\n\t\t\t\tcontributors.add(login, acceptedIssue.number, contribution);\n\t\t\t}\n\t\t}\n\t}\n}\n"],"mappings":";;;AAMA,SAAgB,kBACf,gBACA,cACA,SAIC;AACD,MAAK,MAAM,iBAAiB,gBAAgB;EAC3C,MAAM,SAAS,cAAc,OAAO,KAAK,UACxC,OAAO,UAAU,WAAW,QAAQ,MAAM,KAC1C;AAED,OAAK,MAAM,CAAC,WAAW,iBAAiB;GAEvC,CAAC,QAAQ,cAAc,MAAM;GAE7B,CAAC,QAAQ,eAAe,OAAO;GAE/B,CAAC,QAAQ,gBAAgB,QAAQ;GAEjC,CAAC,QAAQ,eAAe,OAAO;GAC/B,EAAW;AACX,OAAI,CAAC,OAAO,MAAM,UAAU,UAAU,UAAU,CAC/C;GAGD,MAAM,SAAS,EAAE;AAEjB,OAAI,cAAc,KACjB,QAAO,KAAK,cAAc,KAAK,MAAM;AAGtC,OAAI,cAAc,KACjB,MAAK,MAAM,YAAY,uBAAuB,cAAc,KAAK,CAChE,QAAO,KAAK,SAAS,SAAS;AAIhC,QAAK,MAAM,SAAS,OACnB,cAAa,IAAI,OAAO,cAAc,QAAQ,aAAa"}
@@ -1,8 +1,9 @@
1
- import { Octokit } from 'octokit';
2
- import { ContributorsCollection } from '../../ContributorsCollection.js';
3
- import { MergedPull } from '../collecting/collectMergedPulls.js';
4
- import '../api.js';
1
+ import { ContributorsCollection } from "../../ContributorsCollection.js";
2
+ import { MergedPull } from "../collecting/collectMergedPulls.js";
3
+ import { Octokit } from "octokit";
5
4
 
5
+ //#region src/collect/adding/addMergedPulls.d.ts
6
6
  declare function addMergedPulls(mergedPulls: MergedPull[], contributors: Pick<ContributorsCollection, "add">, octokit: Octokit): Promise<void>;
7
-
7
+ //#endregion
8
8
  export { addMergedPulls };
9
+ //# sourceMappingURL=addMergedPulls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addMergedPulls.d.ts","names":[],"sources":["../../../src/collect/adding/addMergedPulls.ts"],"sourcesContent":[],"mappings":";;;;;iBAQsB,cAAA,cACR,4BACC,KAAK,yCACV,UAAO"}
@@ -1,22 +1,17 @@
1
- import { createCachingCoAuthorToUsername } from "co-author-to-username";
2
1
  import { parseMergedPullAuthors } from "../parsing/parseMergedPullAuthors.js";
3
2
  import { parseMergedPullType } from "../parsing/parseMergedPullType.js";
3
+ import { createCachingCoAuthorToUsername } from "co-author-to-username";
4
+
5
+ //#region src/collect/adding/addMergedPulls.ts
4
6
  async function addMergedPulls(mergedPulls, contributors, octokit) {
5
- const cachingCoAuthorToUsername = createCachingCoAuthorToUsername({
6
- fetcher: octokit
7
- });
8
- for (const mergedPull of mergedPulls) {
9
- const authors = await parseMergedPullAuthors(
10
- mergedPull,
11
- cachingCoAuthorToUsername
12
- );
13
- const type = parseMergedPullType(mergedPull.title);
14
- for (const author of authors) {
15
- contributors.add(author, mergedPull.number, type);
16
- }
17
- }
7
+ const cachingCoAuthorToUsername = createCachingCoAuthorToUsername({ fetcher: octokit });
8
+ for (const mergedPull of mergedPulls) {
9
+ const authors = await parseMergedPullAuthors(mergedPull, cachingCoAuthorToUsername);
10
+ const type = parseMergedPullType(mergedPull.title);
11
+ for (const author of authors) contributors.add(author, mergedPull.number, type);
12
+ }
18
13
  }
19
- export {
20
- addMergedPulls
21
- };
14
+
15
+ //#endregion
16
+ export { addMergedPulls };
22
17
  //# sourceMappingURL=addMergedPulls.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collect/adding/addMergedPulls.ts"],"sourcesContent":["import { createCachingCoAuthorToUsername } from \"co-author-to-username\";\nimport { Octokit } from \"octokit\";\n\nimport { ContributorsCollection } from \"../../ContributorsCollection.js\";\nimport { MergedPull } from \"../collecting/collectMergedPulls.js\";\nimport { parseMergedPullAuthors } from \"../parsing/parseMergedPullAuthors.js\";\nimport { parseMergedPullType } from \"../parsing/parseMergedPullType.js\";\n\nexport async function addMergedPulls(\n\tmergedPulls: MergedPull[],\n\tcontributors: Pick<ContributorsCollection, \"add\">,\n\toctokit: Octokit,\n) {\n\tconst cachingCoAuthorToUsername = createCachingCoAuthorToUsername({\n\t\tfetcher: octokit,\n\t});\n\n\tfor (const mergedPull of mergedPulls) {\n\t\tconst authors = await parseMergedPullAuthors(\n\t\t\tmergedPull,\n\t\t\tcachingCoAuthorToUsername,\n\t\t);\n\t\tconst type = parseMergedPullType(mergedPull.title);\n\n\t\tfor (const author of authors) {\n\t\t\tcontributors.add(author, mergedPull.number, type);\n\t\t}\n\t}\n}\n"],"mappings":"AAAA,SAAS,uCAAuC;AAKhD,SAAS,8BAA8B;AACvC,SAAS,2BAA2B;AAEpC,eAAsB,eACrB,aACA,cACA,SACC;AACD,QAAM,4BAA4B,gCAAgC;AAAA,IACjE,SAAS;AAAA,EACV,CAAC;AAED,aAAW,cAAc,aAAa;AACrC,UAAM,UAAU,MAAM;AAAA,MACrB;AAAA,MACA;AAAA,IACD;AACA,UAAM,OAAO,oBAAoB,WAAW,KAAK;AAEjD,eAAW,UAAU,SAAS;AAC7B,mBAAa,IAAI,QAAQ,WAAW,QAAQ,IAAI;AAAA,IACjD;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"file":"addMergedPulls.js","names":[],"sources":["../../../src/collect/adding/addMergedPulls.ts"],"sourcesContent":["import { createCachingCoAuthorToUsername } from \"co-author-to-username\";\nimport { Octokit } from \"octokit\";\n\nimport { ContributorsCollection } from \"../../ContributorsCollection.js\";\nimport { MergedPull } from \"../collecting/collectMergedPulls.js\";\nimport { parseMergedPullAuthors } from \"../parsing/parseMergedPullAuthors.js\";\nimport { parseMergedPullType } from \"../parsing/parseMergedPullType.js\";\n\nexport async function addMergedPulls(\n\tmergedPulls: MergedPull[],\n\tcontributors: Pick<ContributorsCollection, \"add\">,\n\toctokit: Octokit,\n) {\n\tconst cachingCoAuthorToUsername = createCachingCoAuthorToUsername({\n\t\tfetcher: octokit,\n\t});\n\n\tfor (const mergedPull of mergedPulls) {\n\t\tconst authors = await parseMergedPullAuthors(\n\t\t\tmergedPull,\n\t\t\tcachingCoAuthorToUsername,\n\t\t);\n\t\tconst type = parseMergedPullType(mergedPull.title);\n\n\t\tfor (const author of authors) {\n\t\t\tcontributors.add(author, mergedPull.number, type);\n\t\t}\n\t}\n}\n"],"mappings":";;;;;AAQA,eAAsB,eACrB,aACA,cACA,SACC;CACD,MAAM,4BAA4B,gCAAgC,EACjE,SAAS,SACT,CAAC;AAEF,MAAK,MAAM,cAAc,aAAa;EACrC,MAAM,UAAU,MAAM,uBACrB,YACA,0BACA;EACD,MAAM,OAAO,oBAAoB,WAAW,MAAM;AAElD,OAAK,MAAM,UAAU,QACpB,cAAa,IAAI,QAAQ,WAAW,QAAQ,KAAK"}
@@ -1,14 +1,16 @@
1
- import { Octokit } from 'octokit';
1
+ import { Octokit } from "octokit";
2
2
 
3
+ //#region src/collect/api.d.ts
3
4
  interface RequestDefaults {
4
- owner: string;
5
- repo: string;
5
+ owner: string;
6
+ repo: string;
6
7
  }
7
- declare function createOctokit(auth: string | undefined): Octokit;
8
8
  interface RequestOptionsWithPage extends RequestDefaults {
9
- page: number;
10
- per_page: number;
9
+ page: number;
10
+ per_page: number;
11
11
  }
12
+ declare function createOctokit(auth: string | undefined): Promise<Octokit>;
12
13
  declare function paginate<T>(defaults: RequestDefaults, request: (requestOptions: RequestOptionsWithPage) => Promise<T[]>): Promise<T[]>;
13
-
14
- export { type RequestDefaults, type RequestOptionsWithPage, createOctokit, paginate };
14
+ //#endregion
15
+ export { RequestDefaults, RequestOptionsWithPage, createOctokit, paginate };
16
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","names":[],"sources":["../../src/collect/api.ts"],"sourcesContent":[],"mappings":";;;UAKiB,eAAA;;EAAA,IAAA,EAAA,MAAA;AAKjB;AAKsB,UALL,sBAAA,SAA+B,eAOtC,CAAA;EAUY,IAAA,EAAA,MAAQ;EACnB,QAAA,EAAA,MAAA;;AACmD,iBAdxC,aAAA,CAcwC,IAAA,EAAA,MAAA,GAAA,SAAA,CAAA,EAZ3D,OAY2D,CAZnD,OAYmD,CAAA;AAAR,iBAFhC,QAEgC,CAAA,CAAA,CAAA,CAAA,QAAA,EAD3C,eAC2C,EAAA,OAAA,EAAA,CAAA,cAAA,EAA3B,sBAA2B,EAAA,GAAA,OAAA,CAAQ,CAAR,EAAA,CAAA,CAAA,EAAY,OAAZ,CAAY,CAAZ,EAAA,CAAA"}
@@ -1,26 +1,28 @@
1
- import { Octokit } from "octokit";
1
+ import { octokitFromAuthSafe } from "octokit-from-auth";
2
+
3
+ //#region src/collect/api.ts
2
4
  const perPage = 100;
3
- function createOctokit(auth) {
4
- return new (Octokit.defaults({
5
- headers: {
6
- "X-GitHub-Api-Version": "2022-11-28"
7
- },
8
- per_page: perPage
9
- }))({ auth });
5
+ async function createOctokit(auth) {
6
+ return await octokitFromAuthSafe({
7
+ auth,
8
+ headers: { "X-GitHub-Api-Version": "2022-11-28" },
9
+ per_page: perPage
10
+ });
10
11
  }
11
12
  async function paginate(defaults, request) {
12
- const items = [];
13
- for (let i = 0; i < 10; i += 1) {
14
- const response = await request({ page: i, per_page: perPage, ...defaults });
15
- items.push(...response);
16
- if (response.length < 100) {
17
- break;
18
- }
19
- }
20
- return items;
13
+ const items = [];
14
+ for (let i = 0; i < 10; i += 1) {
15
+ const response = await request({
16
+ page: i,
17
+ per_page: perPage,
18
+ ...defaults
19
+ });
20
+ items.push(...response);
21
+ if (response.length < 100) break;
22
+ }
23
+ return items;
21
24
  }
22
- export {
23
- createOctokit,
24
- paginate
25
- };
25
+
26
+ //#endregion
27
+ export { createOctokit, paginate };
26
28
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collect/api.ts"],"sourcesContent":["import { Octokit } from \"octokit\";\n\nconst perPage = 100;\n\nexport interface RequestDefaults {\n\towner: string;\n\trepo: string;\n}\n\nexport function createOctokit(auth: string | undefined): Octokit {\n\treturn new (Octokit.defaults({\n\t\theaders: {\n\t\t\t\"X-GitHub-Api-Version\": \"2022-11-28\",\n\t\t},\n\t\tper_page: perPage,\n\t}))({ auth });\n}\n\nexport interface RequestOptionsWithPage extends RequestDefaults {\n\tpage: number;\n\tper_page: number;\n}\n\nexport async function paginate<T>(\n\tdefaults: RequestDefaults,\n\trequest: (requestOptions: RequestOptionsWithPage) => Promise<T[]>,\n) {\n\tconst items: T[] = [];\n\n\tfor (let i = 0; i < 10; i += 1) {\n\t\tconst response = await request({ page: i, per_page: perPage, ...defaults });\n\n\t\titems.push(...response);\n\n\t\tif (response.length < 100) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn items;\n}\n"],"mappings":"AAAA,SAAS,eAAe;AAExB,MAAM,UAAU;AAOT,SAAS,cAAc,MAAmC;AAChE,SAAO,KAAK,QAAQ,SAAS;AAAA,IAC5B,SAAS;AAAA,MACR,wBAAwB;AAAA,IACzB;AAAA,IACA,UAAU;AAAA,EACX,CAAC,GAAG,EAAE,KAAK,CAAC;AACb;AAOA,eAAsB,SACrB,UACA,SACC;AACD,QAAM,QAAa,CAAC;AAEpB,WAAS,IAAI,GAAG,IAAI,IAAI,KAAK,GAAG;AAC/B,UAAM,WAAW,MAAM,QAAQ,EAAE,MAAM,GAAG,UAAU,SAAS,GAAG,SAAS,CAAC;AAE1E,UAAM,KAAK,GAAG,QAAQ;AAEtB,QAAI,SAAS,SAAS,KAAK;AAC1B;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;","names":[]}
1
+ {"version":3,"file":"api.js","names":["items: T[]"],"sources":["../../src/collect/api.ts"],"sourcesContent":["import { Octokit } from \"octokit\";\nimport { octokitFromAuthSafe } from \"octokit-from-auth\";\n\nconst perPage = 100;\n\nexport interface RequestDefaults {\n\towner: string;\n\trepo: string;\n}\n\nexport interface RequestOptionsWithPage extends RequestDefaults {\n\tpage: number;\n\tper_page: number;\n}\n\nexport async function createOctokit(\n\tauth: string | undefined,\n): Promise<Octokit> {\n\treturn await octokitFromAuthSafe({\n\t\tauth,\n\t\theaders: {\n\t\t\t\"X-GitHub-Api-Version\": \"2022-11-28\",\n\t\t},\n\t\tper_page: perPage,\n\t});\n}\n\nexport async function paginate<T>(\n\tdefaults: RequestDefaults,\n\trequest: (requestOptions: RequestOptionsWithPage) => Promise<T[]>,\n) {\n\tconst items: T[] = [];\n\n\tfor (let i = 0; i < 10; i += 1) {\n\t\tconst response = await request({ page: i, per_page: perPage, ...defaults });\n\n\t\titems.push(...response);\n\n\t\tif (response.length < 100) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn items;\n}\n"],"mappings":";;;AAGA,MAAM,UAAU;AAYhB,eAAsB,cACrB,MACmB;AACnB,QAAO,MAAM,oBAAoB;EAChC;EACA,SAAS,EACR,wBAAwB,cACxB;EACD,UAAU;EACV,CAAC;;AAGH,eAAsB,SACrB,UACA,SACC;CACD,MAAMA,QAAa,EAAE;AAErB,MAAK,IAAI,IAAI,GAAG,IAAI,IAAI,KAAK,GAAG;EAC/B,MAAM,WAAW,MAAM,QAAQ;GAAE,MAAM;GAAG,UAAU;GAAS,GAAG;GAAU,CAAC;AAE3E,QAAM,KAAK,GAAG,SAAS;AAEvB,MAAI,SAAS,SAAS,IACrB;;AAIF,QAAO"}