Skip to content

Commit f2d2843

Browse files
feat: bumped to [email protected] with serializable requests (#1978)
## PR Checklist - [x] Addresses an existing open issue: fixes #1977 - [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 As described in #1977 (comment), adds an `existingLabels` option that reads in the existing labels for a repository. If that fails or there isn't a repo yet (e.g. in setup mode) then [`github-default-labels`](https://github.com/JoshuaKGoldberg/github-default-labels) supplies the default labels. I would have wanted to use the GitHub API to fetch the default labels for the owner but that API doesn't seem to exist. Anyway, once those existing labels exist, they're passed to [`determineLabelChange`](https://github.com/JoshuaKGoldberg/set-github-repository-labels/?tab=readme-ov-file#determinelabelchanges) to get which requests to make. Those are mapped to Bingo's requests format. 💝
1 parent f29646e commit f2d2843

12 files changed

+1828
-930
lines changed

package.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@
3737
"*": "prettier --ignore-unknown --write"
3838
},
3939
"dependencies": {
40-
"bingo": "^0.5.7",
40+
"bingo": "^0.5.8",
4141
"bingo-fs": "^0.5.4",
42-
"bingo-stratum": "^0.5.4",
42+
"bingo-stratum": "^0.5.5",
4343
"cspell-populate-words": "^0.3.0",
4444
"execa": "^9.5.2",
4545
"git-remote-origin-url": "^4.0.0",
4646
"git-url-parse": "^16.0.1",
47+
"github-default-labels": "^0.1.0",
4748
"html-to-text": "^9.0.5",
4849
"image-size": "^1.2.0",
4950
"input-from-file": "^0.5.4",
@@ -58,7 +59,7 @@
5859
"parse-package-name": "^1.0.0",
5960
"remove-dependencies": "^0.1.0",
6061
"remove-undefined-objects": "^6.0.0",
61-
"set-github-repository-labels": "^0.1.0",
62+
"set-github-repository-labels": "^0.2.0",
6263
"sort-package-json": "^3.0.0",
6364
"title-case": "^4.3.2",
6465
"zod": "^3.24.2"
@@ -78,8 +79,9 @@
7879
"@vitest/coverage-v8": "3.0.7",
7980
"@vitest/eslint-plugin": "1.1.36",
8081
"all-contributors-cli": "6.26.1",
82+
"bingo-requests": "^0.5.4",
8183
"bingo-stratum-testers": "0.5.6",
82-
"bingo-testers": "0.5.4",
84+
"bingo-testers": "^0.5.6",
8385
"console-fail-test": "0.5.0",
8486
"cspell": "8.17.5",
8587
"eslint": "9.21.0",

pnpm-lock.yaml

+750-831
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/base.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ describe("base", () => {
2525
github: "[email protected]",
2626
2727
},
28+
existingLabels: expect.any(Array),
2829
explainer: [
2930
`\`create-typescript-app\` is a one-stop-shop solution to set up a new or existing repository with the latest and greatest TypeScript tooling.`,
3031
`It includes options not just for building and testing but also automated release management, contributor recognition, GitHub repository settings, and more.`,

src/base.ts

+16
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import npmUser from "npm-user";
99
import { z } from "zod";
1010

1111
import { inputFromOctokit } from "./inputs/inputFromOctokit.js";
12+
import { getExistingLabels } from "./options/getExistingLabels.js";
1213
import { parsePackageAuthor } from "./options/parsePackageAuthor.js";
1314
import { readAllContributors } from "./options/readAllContributors.js";
1415
import { readDefaultsFromReadme } from "./options/readDefaultsFromReadme.js";
@@ -73,6 +74,16 @@ export const base = createBase({
7374
.describe(
7475
"email address to be listed as the point of contact in docs and packages",
7576
),
77+
existingLabels: z
78+
.array(
79+
z.object({
80+
color: z.string(),
81+
description: z.string(),
82+
name: z.string(),
83+
}),
84+
)
85+
.optional()
86+
.describe("existing labels from the GitHub repository"),
7687
explainer: z
7788
.array(z.string())
7889
.optional()
@@ -155,6 +166,10 @@ export const base = createBase({
155166
}),
156167
);
157168

169+
const existingLabels = lazyValue(async () =>
170+
getExistingLabels(take, await owner(), await repository()),
171+
);
172+
158173
const githubCliUser = lazyValue(async () => {
159174
return swallowError(
160175
await take(inputFromScript, {
@@ -241,6 +256,7 @@ export const base = createBase({
241256
description: async () => await readDescription(packageData, readme),
242257
documentation,
243258
email,
259+
existingLabels,
244260
funding: readFunding,
245261
guide: readGuide,
246262
login: author,

0 commit comments

Comments
 (0)