Skip to content

Commit e199ea9

Browse files
feat: add npm badge to readme (#880)
<!-- 👋 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 #730 - [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 Added npm version badge to readme file. Also added it to the template that creates the file: `src/steps/writeReadme/generateTopContent.ts` --------- Co-authored-by: Josh Goldberg <[email protected]>
1 parent f38a7fa commit e199ea9

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
</a>
2525
<img alt="Style: Prettier 🧹" src="https://img.shields.io/badge/style-prettier_🧹-21bb42.svg" />
2626
<img alt="TypeScript: Strict 💪" src="https://img.shields.io/badge/typescript-strict_💪-21bb42.svg" />
27+
<img alt="npm package version" src="https://img.shields.io/npm/v/create-typescript-app?color=21bb42" />
2728
</p>
2829

2930
<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">

Diff for: src/steps/writeReadme/generateTopContent.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ describe("findExistingBadges", () => {
6565
</a>
6666
<img alt=\\"Style: Prettier\\" src=\\"https://img.shields.io/badge/style-prettier-21bb42.svg\\" />
6767
<img alt=\\"TypeScript: Strict\\" src=\\"https://img.shields.io/badge/typescript-strict-21bb42.svg\\" />
68+
<img alt=\\"npm package version\\" src=\\"https://img.shields.io/npm/v/create-typescript-app?color=21bb42\\" />
6869
</p>
6970
7071
## Usage
@@ -109,6 +110,7 @@ describe("findExistingBadges", () => {
109110
</a>
110111
<img alt=\\"Style: Prettier\\" src=\\"https://img.shields.io/badge/style-prettier-21bb42.svg\\" />
111112
<img alt=\\"TypeScript: Strict\\" src=\\"https://img.shields.io/badge/typescript-strict-21bb42.svg\\" />
113+
<img alt=\\"npm package version\\" src=\\"https://img.shields.io/npm/v/create-typescript-app?color=21bb42\\" />
112114
</p>
113115
114116
## Usage
@@ -153,6 +155,7 @@ describe("findExistingBadges", () => {
153155
</a>
154156
<img alt=\\"Style: Prettier\\" src=\\"https://img.shields.io/badge/style-prettier-21bb42.svg\\" />
155157
<img alt=\\"TypeScript: Strict\\" src=\\"https://img.shields.io/badge/typescript-strict-21bb42.svg\\" />
158+
<img alt=\\"npm package version\\" src=\\"https://img.shields.io/npm/v/create-typescript-app?color=21bb42\\" />
156159
<img alt=\\"Unknown Badge\\" src=\\"unknown.svg\\" />
157160
</p>
158161
@@ -195,6 +198,7 @@ describe("findExistingBadges", () => {
195198
</a>
196199
<img alt=\\"Style: Prettier\\" src=\\"https://img.shields.io/badge/style-prettier-21bb42.svg\\" />
197200
<img alt=\\"TypeScript: Strict\\" src=\\"https://img.shields.io/badge/typescript-strict-21bb42.svg\\" />
201+
<img alt=\\"npm package version\\" src=\\"https://img.shields.io/npm/v/create-typescript-app?color=21bb42\\" />
198202
</p>"
199203
`);
200204
});

Diff for: src/steps/writeReadme/generateTopContent.ts

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export function generateTopContent(options: Options, existingBadges: string[]) {
6767
`<img alt="TypeScript: Strict" src="https://img.shields.io/badge/typescript-strict-21bb42.svg" />`,
6868
/typescript.*strict/i,
6969
],
70+
[
71+
`<img alt="npm package version" src="https://img.shields.io/npm/v/create-typescript-app?color=21bb42" />`,
72+
/npm.*v/i,
73+
],
7074
] as const) {
7175
spliceBadge(badgeLine, existingMatcher);
7276
}

Diff for: src/steps/writeReadme/index.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ describe("writeReadme", () => {
9595
</a>
9696
<img alt=\\"Style: Prettier\\" src=\\"https://img.shields.io/badge/style-prettier-21bb42.svg\\" />
9797
<img alt=\\"TypeScript: Strict\\" src=\\"https://img.shields.io/badge/typescript-strict-21bb42.svg\\" />
98+
<img alt=\\"npm package version\\" src=\\"https://img.shields.io/npm/v/create-typescript-app?color=21bb42\\" />
9899
</p>
99100
100101
## Usage
@@ -166,6 +167,7 @@ describe("writeReadme", () => {
166167
</a>
167168
<img alt=\\"Style: Prettier\\" src=\\"https://img.shields.io/badge/style-prettier-21bb42.svg\\" />
168169
<img alt=\\"TypeScript: Strict\\" src=\\"https://img.shields.io/badge/typescript-strict-21bb42.svg\\" />
170+
<img alt=\\"npm package version\\" src=\\"https://img.shields.io/npm/v/create-typescript-app?color=21bb42\\" />
169171
</p>
170172
171173
## Usage
@@ -240,6 +242,7 @@ describe("writeReadme", () => {
240242
</a>
241243
<img alt=\\"Style: Prettier\\" src=\\"https://img.shields.io/badge/style-prettier-21bb42.svg\\" />
242244
<img alt=\\"TypeScript: Strict\\" src=\\"https://img.shields.io/badge/typescript-strict-21bb42.svg\\" />
245+
<img alt=\\"npm package version\\" src=\\"https://img.shields.io/npm/v/create-typescript-app?color=21bb42\\" />
243246
</p>
244247
245248
## Usage
@@ -357,6 +360,7 @@ describe("writeReadme", () => {
357360
</a>
358361
<img alt=\\"Style: Prettier\\" src=\\"https://img.shields.io/badge/style-prettier-21bb42.svg\\" />
359362
<img alt=\\"TypeScript: Strict\\" src=\\"https://img.shields.io/badge/typescript-strict-21bb42.svg\\" />
363+
<img alt=\\"npm package version\\" src=\\"https://img.shields.io/npm/v/create-typescript-app?color=21bb42\\" />
360364
<img alt=\\"Contributor Covenant\\" src=\\"https://img.shields.io/badge/code_of_conduct-enforced-21bb42\\" />
361365
</p>
362366

0 commit comments

Comments
 (0)