Skip to content

Commit 8244e06

Browse files
authoredDec 31, 2023
fix: print logo in README.md (#1166)
## PR Checklist - [x] Addresses an existing open issue: fixes #1165 - [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 Hooks the logo up to README.md generation and uses `--logo` in the end-to-end migration test.
1 parent 3d56374 commit 8244e06

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed
 

‎script/__snapshots__/migrate-test-e2e.js.snap

+2-4
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,9 @@ exports[`expected file changes > README.md 1`] = `
9595
"--- a/README.md
9696
+++ b/README.md
9797
@@ ... @@
98-
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
99-
</p>
10098
101-
-<img align="right" alt="Project logo: the TypeScript blue square with rounded corners, but a plus sign instead of 'TS'" src="./create-typescript-app.png">
102-
-
99+
<img align="right" alt="Project logo: the TypeScript blue square with rounded corners, but a plus sign instead of 'TS'" src="./create-typescript-app.png">
100+
103101
-\`create-typescript-app\` is a one-stop-shop solution to set up a new or existing repository with the latest and greatest TypeScript tooling.
104102
-It includes options not just for building and testing but also GitHub repository templates, contributor recognition, automated release management, and more.
105103
-

‎script/migrate-test-e2e.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const bin = "./bin/index.js";
3232
const guide =
3333
"https://www.joshuakgoldberg.com/blog/contributing-to-a-create-typescript-app-repository";
3434
const guideTitle = "Contributing to a create-typescript-app Repository";
35+
const logo = "./create-typescript-app.png";
36+
const logoAlt = `Project logo: the TypeScript blue square with rounded corners, but a plus sign instead of 'TS'`;
3537
const owner = "JoshuaKGoldberg";
3638
const title = "Create TypeScript App";
3739

@@ -47,7 +49,7 @@ const originalSnapshots = (
4749

4850
await $({
4951
stdio: "inherit",
50-
})`c8 -o ./coverage -r html -r lcov --src src node ${bin} --base everything --author ${authorName} --mode migrate --bin ${bin} --description ${description} --email-github ${emailGithub} --email-npm ${emailNpm} --guide ${guide} --guide-title ${guideTitle} --owner ${owner} --title ${title} --repository ${repository} --skip-all-contributors-api --skip-github-api --skip-install`;
52+
})`c8 -o ./coverage -r html -r lcov --src src node ${bin} --base everything --author ${authorName} --mode migrate --bin ${bin} --description ${description} --email-github ${emailGithub} --email-npm ${emailNpm} --guide ${guide} --guide-title ${guideTitle} --logo ${logo} --logo-alt ${logoAlt} --owner ${owner} --title ${title} --repository ${repository} --skip-all-contributors-api --skip-github-api --skip-install`;
5153

5254
// All Contributors seems to not be using Prettier to format files...
5355
await fs.writeFile(

‎src/shared/options/readOptions.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const emptyOptions = {
3737
guide: undefined,
3838
guideTitle: undefined,
3939
logo: undefined,
40+
logoAlt: undefined,
4041
offline: undefined,
4142
owner: undefined,
4243
preserveGeneratedFrom: false,
@@ -756,6 +757,7 @@ describe("readOptions", () => {
756757
"guide": undefined,
757758
"guideTitle": undefined,
758759
"logo": undefined,
760+
"logoAlt": undefined,
759761
"mode": "migrate",
760762
"offline": true,
761763
"owner": "TestOwner",

‎src/shared/options/readOptions.ts

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export async function readOptions(
8787
guide: values.guide,
8888
guideTitle: values["guide-title"],
8989
logo: values.logo,
90+
logoAlt: values["logo-alt"],
9091
offline: values.offline,
9192
owner: values.owner,
9293
preserveGeneratedFrom:

‎src/steps/writeReadme/generateTopContent.ts

+8
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ ${[...badges, ...remainingExistingBadges]
5858
.map((badge) => `\t${badge}`)
5959
.join("\n")}
6060
</p>${
61+
options.logo
62+
? `
63+
64+
<img align="right" alt="${options.logo.alt}" src="${options.logo.src}">
65+
66+
`
67+
: ""
68+
}${
6169
options.mode === "migrate"
6270
? ""
6371
: `

0 commit comments

Comments
 (0)
Please sign in to comment.