Skip to content

fix: print logo in README.md #1166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions script/__snapshots__/migrate-test-e2e.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,9 @@ exports[`expected file changes > README.md 1`] = `
"--- a/README.md
+++ b/README.md
@@ ... @@
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
</p>

-<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">
-
<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">
-\`create-typescript-app\` is a one-stop-shop solution to set up a new or existing repository with the latest and greatest TypeScript tooling.
-It includes options not just for building and testing but also GitHub repository templates, contributor recognition, automated release management, and more.
-
Expand Down
4 changes: 3 additions & 1 deletion script/migrate-test-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const bin = "./bin/index.js";
const guide =
"https://www.joshuakgoldberg.com/blog/contributing-to-a-create-typescript-app-repository";
const guideTitle = "Contributing to a create-typescript-app Repository";
const logo = "./create-typescript-app.png";
const logoAlt = `Project logo: the TypeScript blue square with rounded corners, but a plus sign instead of 'TS'`;
const owner = "JoshuaKGoldberg";
const title = "Create TypeScript App";

Expand All @@ -47,7 +49,7 @@ const originalSnapshots = (

await $({
stdio: "inherit",
})`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`;
})`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`;

// All Contributors seems to not be using Prettier to format files...
await fs.writeFile(
Expand Down
2 changes: 2 additions & 0 deletions src/shared/options/readOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const emptyOptions = {
guide: undefined,
guideTitle: undefined,
logo: undefined,
logoAlt: undefined,
offline: undefined,
owner: undefined,
preserveGeneratedFrom: false,
Expand Down Expand Up @@ -756,6 +757,7 @@ describe("readOptions", () => {
"guide": undefined,
"guideTitle": undefined,
"logo": undefined,
"logoAlt": undefined,
"mode": "migrate",
"offline": true,
"owner": "TestOwner",
Expand Down
1 change: 1 addition & 0 deletions src/shared/options/readOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export async function readOptions(
guide: values.guide,
guideTitle: values["guide-title"],
logo: values.logo,
logoAlt: values["logo-alt"],
offline: values.offline,
owner: values.owner,
preserveGeneratedFrom:
Expand Down
8 changes: 4 additions & 4 deletions src/steps/writeReadme/generateTopContent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("findExistingBadges", () => {
<a href="https://github.com/test-owner/test-repository/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg"></a>
<a href="http://npmjs.com/package/test-repository"><img alt="📦 npm version" src="https://img.shields.io/npm/v/test-repository?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
</p>
</p>undefined

## Usage

Expand Down Expand Up @@ -71,7 +71,7 @@ describe("findExistingBadges", () => {
<a href="https://github.com/test-owner/test-repository/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg"></a>
<a href="http://npmjs.com/package/test-repository"><img alt="📦 npm version" src="https://img.shields.io/npm/v/test-repository?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
</p>
</p>undefined

## Usage

Expand Down Expand Up @@ -108,7 +108,7 @@ describe("findExistingBadges", () => {
<a href="http://npmjs.com/package/test-repository"><img alt="📦 npm version" src="https://img.shields.io/npm/v/test-repository?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
<img alt="Unknown Badge" src="unknown.svg" />
</p>
</p>undefined

## Usage

Expand Down Expand Up @@ -141,7 +141,7 @@ describe("findExistingBadges", () => {
<a href="https://github.com/test-owner/test-repository/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg"></a>
<a href="http://npmjs.com/package/test-repository"><img alt="📦 npm version" src="https://img.shields.io/npm/v/test-repository?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
</p>"
</p>undefined"
`);
});
});
7 changes: 7 additions & 0 deletions src/steps/writeReadme/generateTopContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ ${[...badges, ...remainingExistingBadges]
.map((badge) => `\t${badge}`)
.join("\n")}
</p>${
options.logo &&
`

<img align="right" alt="${options.logo.alt}" src="${options.logo.src}">

`
}${
options.mode === "migrate"
? ""
: `
Expand Down
8 changes: 4 additions & 4 deletions src/steps/writeReadme/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("writeReadme", () => {
<a href="https://github.com/TestOwner/test-repository/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg"></a>
<a href="http://npmjs.com/package/test-repository"><img alt="📦 npm version" src="https://img.shields.io/npm/v/test-repository?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
</p>
</p>undefined

## Usage

Expand Down Expand Up @@ -124,7 +124,7 @@ describe("writeReadme", () => {
<a href="https://github.com/TestOwner/test-repository/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg"></a>
<a href="http://npmjs.com/package/test-repository"><img alt="📦 npm version" src="https://img.shields.io/npm/v/test-repository?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
</p>
</p>undefined

## Usage

Expand Down Expand Up @@ -186,7 +186,7 @@ describe("writeReadme", () => {
<a href="https://github.com/TestOwner/test-repository/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg"></a>
<a href="http://npmjs.com/package/test-repository"><img alt="📦 npm version" src="https://img.shields.io/npm/v/test-repository?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
</p>
</p>undefined

## Usage

Expand Down Expand Up @@ -283,7 +283,7 @@ describe("writeReadme", () => {
<a href="http://npmjs.com/package/test-repository"><img alt="📦 npm version" src="https://img.shields.io/npm/v/test-repository?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
<img alt="Style: Prettier" src="https://img.shields.io/badge/style-prettier-21bb42.svg" />
</p>
</p>undefined

## Usage

Expand Down