Skip to content

Commit c2d239b

Browse files
feat: add emoji option (#1984)
<!-- 👋 Hi, thanks for sending a PR to create-typescript-app! 💖. Please fill out all fields below and make sure each item is true and [x] checked. Otherwise we may not be able to review your PR. --> ## PR Checklist - [x] Addresses an existing open issue: fixes #1942 - [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 Adds a separate `options.emoji` that defaults to the last detected emoji in `options.description`, or `"💖"` if not found. 🎁
1 parent fd1647b commit c2d239b

14 files changed

+94
-13
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing
22

3-
Thanks for your interest in contributing to `create-typescript-app`! 💖
3+
Thanks for your interest in contributing to `create-typescript-app`! 🎁
44

55
> After this page, see [DEVELOPMENT.md](./DEVELOPMENT.md) for local development instructions.
66
@@ -94,4 +94,4 @@ Please do ping the maintainer who merged your PR if that doesn't happen within 2
9494

9595
If you made it all the way to the end, bravo dear user, we love you.
9696
Please include your favorite emoji in the bottom of your issues and PRs to signal to us that you did in fact read this file and are trying to conform to it as best as possible.
97-
💖 is a good starter if you're not sure which to use.
97+
🎁 is a good starter if you're not sure which to use.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- 👋 Hi, thanks for sending a PR to create-typescript-app! 💖.
1+
<!-- 👋 Hi, thanks for sending a PR to create-typescript-app! 🎁.
22
Please fill out all fields below and make sure each item is true and [x] checked.
33
Otherwise we may not be able to review your PR. -->
44

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ You can read more about `create-typescript-app` and the tooling it supports:
5959
## Development
6060

6161
See [`.github/CONTRIBUTING.md`](./.github/CONTRIBUTING.md), then [`.github/DEVELOPMENT.md`](./.github/DEVELOPMENT.md).
62-
Thanks! 💖
62+
Thanks! 🎁
6363

6464
## Contributors
6565

src/base.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ describe("base", () => {
2525
github: "[email protected]",
2626
2727
},
28+
emoji: "🎁",
2829
existingLabels: expect.any(Array),
2930
explainer: [
3031
`\`create-typescript-app\` is a one-stop-shop solution to set up a new or existing repository with the latest and greatest TypeScript tooling.`,

src/base.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { z } from "zod";
1010

1111
import { inputFromOctokit } from "./inputs/inputFromOctokit.js";
1212
import { getExistingLabels } from "./options/getExistingLabels.js";
13+
import { parseEmojiFromDescription } from "./options/parseEmojiFromDescription.js";
1314
import { parsePackageAuthor } from "./options/parsePackageAuthor.js";
1415
import { readAllContributors } from "./options/readAllContributors.js";
1516
import { readDefaultsFromReadme } from "./options/readDefaultsFromReadme.js";
@@ -53,7 +54,7 @@ export const base = createBase({
5354
.describe("AllContributors contributors to store in .all-contributorsrc"),
5455
description: z
5556
.string()
56-
.default("A very lovely package. Hooray! 💖")
57+
.default("A very lovely package. Hooray!")
5758
.describe("'Sentence case.' description of the repository"),
5859
directory: z.string().describe("Directory to create the repository in"),
5960
documentation: z
@@ -74,6 +75,10 @@ export const base = createBase({
7475
.describe(
7576
"email address to be listed as the point of contact in docs and packages",
7677
),
78+
emoji: z
79+
.string()
80+
.optional()
81+
.describe("decorative emoji to use in descriptions and docs"),
7782
existingLabels: z
7883
.array(
7984
z.object({
@@ -196,6 +201,10 @@ export const base = createBase({
196201

197202
// TODO: Make these all use take
198203

204+
const emoji = async () => parseEmojiFromDescription(description);
205+
206+
const description = async () => await readDescription(packageData, readme);
207+
199208
const gitDefaults = tryCatchLazyValueAsync(async () =>
200209
gitUrlParse(await gitRemoteOriginUrl()),
201210
);
@@ -253,9 +262,10 @@ export const base = createBase({
253262
author,
254263
bin: async () => (await packageData()).bin,
255264
contributors: allContributors,
256-
description: async () => await readDescription(packageData, readme),
265+
description,
257266
documentation,
258267
email,
268+
emoji,
259269
existingLabels,
260270
funding: readFunding,
261271
guide: readGuide,
@@ -274,7 +284,7 @@ export const base = createBase({
274284
pnpm,
275285
repository,
276286
rulesetId,
277-
...readDefaultsFromReadme(readme, repository),
287+
...readDefaultsFromReadme(emoji, readme, repository),
278288
version,
279289
};
280290
},

src/blocks/blockCSpell.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ describe("blockCSpell", () => {
211211
"scripts": [
212212
{
213213
"commands": [
214-
"node path/to/cspell-populate-words/bin/index.mjs --words "access" --words "public" --words "description" --words "Test description" --words "directory" --words "." --words "email" --words "github" --words "[email protected]" --words "npm" --words "[email protected]" --words "owner" --words "test-owner" --words "repository" --words "test-repository" --words "title" --words "Test Title"",
214+
"node path/to/cspell-populate-words/bin/index.mjs --words "access" --words "public" --words "description" --words "Test description" --words "directory" --words "." --words "email" --words "github" --words "[email protected]" --words "npm" --words "[email protected]" --words "emoji" --words "💖" --words "owner" --words "test-owner" --words "repository" --words "test-repository" --words "title" --words "Test Title"",
215215
],
216216
"phase": 3,
217217
},

src/blocks/blockContributingDocs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const blockContributingDocs = base.createBlock({
1111
".github": {
1212
"CONTRIBUTING.md": `# Contributing
1313
14-
Thanks for your interest in contributing to \`${options.repository}\`! 💖
14+
Thanks for your interest in contributing to \`${options.repository}\`! ${options.emoji}
1515
1616
> After this page, see [DEVELOPMENT.md](./DEVELOPMENT.md) for local development instructions.
1717
@@ -105,7 +105,7 @@ Please do ping the maintainer who merged your PR if that doesn't happen within 2
105105
106106
If you made it all the way to the end, bravo dear user, we love you.
107107
Please include your favorite emoji in the bottom of your issues and PRs to signal to us that you did in fact read this file and are trying to conform to it as best as possible.
108-
💖 is a good starter if you're not sure which to use.
108+
${options.emoji} is a good starter if you're not sure which to use.
109109
`,
110110
},
111111
},

src/blocks/blockGitHubPRTemplate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const blockGitHubPRTemplate = base.createBlock({
88
return {
99
files: {
1010
".github": {
11-
"PULL_REQUEST_TEMPLATE.md": `<!-- 👋 Hi, thanks for sending a PR to ${options.repository}! 💖.
11+
"PULL_REQUEST_TEMPLATE.md": `<!-- 👋 Hi, thanks for sending a PR to ${options.repository}! ${options.emoji}.
1212
Please fill out all fields below and make sure each item is true and [x] checked.
1313
Otherwise we may not be able to review your PR. -->
1414

src/blocks/blockREADME.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ ${options.usage}
4949
## Development
5050
5151
See [\`.github/CONTRIBUTING.md\`](./.github/CONTRIBUTING.md), then [\`.github/DEVELOPMENT.md\`](./.github/DEVELOPMENT.md).
52-
Thanks! 💖
52+
Thanks! ${options.emoji}
5353
${sections.map((section) => `\n${section}`).join("")}
5454
${notices.length ? `\n${notices.map((notice) => notice.trim()).join("\n\n")}` : ""}`,
5555
},

src/blocks/options.fakes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const optionsBase = {
88
github: "[email protected]",
99
1010
},
11+
emoji: "💖",
1112
owner: "test-owner",
1213
repository: "test-repository",
1314
title: "Test Title",

0 commit comments

Comments
 (0)