Skip to content

Commit 6e81c74

Browse files
authoredDec 24, 2024
fix: remove project logo in initialization (#1809)
## PR Checklist - [x] Addresses an existing open issue: fixes #1366 - [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 💖
1 parent 8cf6c39 commit 6e81c74

File tree

2 files changed

+43
-16
lines changed

2 files changed

+43
-16
lines changed
 

‎src/steps/updateReadme.test.ts

+40-15
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,37 @@ describe("updateReadme", () => {
6363

6464
it("doesn't add a notice when the file contains it already", async () => {
6565
mockReadFileSafe.mockResolvedValue(`
66-
Existing JoshuaKGoldberg/create-typescript-app content.
67-
66+
Existing JoshuaKGoldberg/create-typescript-app content.
67+
68+
<!-- You can remove this notice if you don't want it 🙂 no worries! -->
69+
70+
> 💙 This package was templated using [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).
71+
`);
72+
73+
await updateReadme(options);
74+
75+
expect(mockWriteFile.mock.calls).toMatchInlineSnapshot(`
76+
[
77+
[
78+
"./README.md",
79+
"
80+
Existing NewOwner/create-typescript-app content.
81+
6882
<!-- You can remove this notice if you don't want it 🙂 no worries! -->
69-
70-
> 💙 This package was templated using [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).
83+
84+
> 💙 This package was templated using [create-typescript-app](https://github.com/NewOwner/create-typescript-app).
85+
",
86+
],
87+
]
7188
`);
89+
});
90+
91+
it("doesn't add a notice when the file contains an older version of it already", async () => {
92+
mockReadFileSafe.mockResolvedValue(`
93+
Existing JoshuaKGoldberg/create-typescript-app content.
94+
95+
💙 This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).
96+
`);
7297

7398
await updateReadme(options);
7499

@@ -77,22 +102,22 @@ describe("updateReadme", () => {
77102
[
78103
"./README.md",
79104
"
80-
Existing NewOwner/create-typescript-app content.
81-
82-
<!-- You can remove this notice if you don't want it 🙂 no worries! -->
83-
84-
> 💙 This package was templated using [create-typescript-app](https://github.com/NewOwner/create-typescript-app).
85-
",
105+
Existing NewOwner/create-typescript-app content.
106+
107+
💙 This package is based on [@NewOwner](https://github.com/NewOwner)'s [create-typescript-app](https://github.com/NewOwner/create-typescript-app).
108+
",
86109
],
87110
]
88111
`);
89112
});
90113

91-
it("doesn't add a notice when the file contains an older version of it already", async () => {
114+
it("removes the project logo when it exists", async () => {
92115
mockReadFileSafe.mockResolvedValue(`
93-
Existing JoshuaKGoldberg/create-typescript-app content.
116+
Existing JoshuaKGoldberg/create-typescript-app content.
117+
118+
<img align="right" alt="Project logo: the TypeScript blue square with rounded corners, but a plus sign instead of 'TS'" height="128" src="./docs/create-typescript-app.png" width="128">
94119
95-
💙 This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).
120+
💙 This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).
96121
`);
97122

98123
await updateReadme(options);
@@ -102,9 +127,9 @@ describe("updateReadme", () => {
102127
[
103128
"./README.md",
104129
"
105-
Existing NewOwner/create-typescript-app content.
130+
Existing NewOwner/create-typescript-app content.
106131
107-
💙 This package is based on [@NewOwner](https://github.com/NewOwner)'s [create-typescript-app](https://github.com/NewOwner/create-typescript-app).
132+
💙 This package is based on [@NewOwner](https://github.com/NewOwner)'s [create-typescript-app](https://github.com/NewOwner/create-typescript-app).
108133
",
109134
],
110135
]

‎src/steps/updateReadme.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export async function updateReadme(
2222
) {
2323
let contents = await readFileSafe("./README.md", "");
2424

25-
contents = contents.replaceAll("JoshuaKGoldberg", options.owner);
25+
contents = contents
26+
.replaceAll("JoshuaKGoldberg", options.owner)
27+
.replace(/\n<img .+ alt="Project logo.+>\n/gs, "");
2628

2729
if (!options.excludeTemplatedBy && !endOfReadmeMatcher.test(contents)) {
2830
contents += endOfReadmeNotice;

0 commit comments

Comments
 (0)
Please sign in to comment.