Skip to content

Commit 6b8501b

Browse files
fix: pass options to contributors lookup (#766)
## PR Checklist - [x] Addresses an existing open issue: fixes #755 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview It was fine on `JoshuaKGoldberg/create-typescript-app` 😄 just ... no other repos.
1 parent 9c19103 commit 6b8501b

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/migrate/migrateWithOptions.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ export async function migrateWithOptions({
4949
}
5050

5151
if (!options.excludeContributors) {
52-
await withSpinner(
53-
"Detecting existing contributors",
54-
detectExistingContributors,
52+
await withSpinner("Detecting existing contributors", async () =>
53+
detectExistingContributors(options),
5554
);
5655
}
5756

src/steps/detectExistingContributors.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ vi.mock("execa", () => ({
1818
},
1919
}));
2020

21+
const options = {
22+
owner: "TestOwner",
23+
repository: "test-repository",
24+
};
25+
2126
describe("detectExistingContributors", () => {
2227
it("runs npx all-contributors add for each contributor and contribution type", async () => {
2328
mockGetAllContributorsForRepository.mockResolvedValue({
2429
username: ["bug", "docs"],
2530
});
2631

27-
await detectExistingContributors();
32+
await detectExistingContributors(options);
2833

2934
expect(mock$.mock.calls).toMatchInlineSnapshot(`
3035
[

src/steps/detectExistingContributors.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { getAllContributorsForRepository } from "all-contributors-for-repository";
22
import { $ } from "execa";
33

4-
export async function detectExistingContributors() {
4+
import { Options } from "../shared/types.js";
5+
6+
export async function detectExistingContributors(
7+
options: Pick<Options, "owner" | "repository">,
8+
) {
59
const contributors = await getAllContributorsForRepository({
6-
owner: "JoshuaKGoldberg",
7-
repo: "create-typescript-app",
10+
owner: options.owner,
11+
repo: options.repository,
812
});
913

1014
for (const [contributor, contributions] of Object.entries(contributors)) {

0 commit comments

Comments
 (0)