Skip to content

Commit a02897e

Browse files
fix: print .all-contributorsrc with two spaces (#2178)
## PR Checklist - [x] Addresses an existing open issue: fixes #2177 - [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 Uses `null, 2` as JSON.stringify settings - which matches https://github.com/all-contributors/cli/blob/74bc388bd6f0ae2658e6495e9d3781d737438a97/src/util/formatting.js#L2. 🎁
1 parent 3bd32e3 commit a02897e

File tree

4 files changed

+90
-39
lines changed

4 files changed

+90
-39
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
},
3939
"dependencies": {
4040
"@typescript-eslint/typescript-estree": "^8.29.1",
41-
"bingo": "^0.5.14",
41+
"bingo": "^0.5.15",
4242
"bingo-fs": "^0.5.5",
4343
"bingo-stratum": "^0.5.11",
4444
"cached-factory": "^0.1.0",

pnpm-lock.yaml

Lines changed: 26 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/blocks/blockAllContributors.test.ts

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ describe("blockAllContributors", () => {
5353
},
5454
],
5555
"files": {
56-
".all-contributorsrc": "{"badgeTemplate":"\\t<a href=\\"#contributors\\" target=\\"_blank\\"><img alt=\\"👪 All Contributors: <%= contributors.length %>\\" src=\\"https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-<%= contributors.length %>-21bb42.svg\\" /></a>","contributors":[],"contributorsSortAlphabetically":true,"projectName":"test-repository","projectOwner":"test-owner"}",
56+
".all-contributorsrc": "{
57+
"badgeTemplate": "\\t<a href=\\"#contributors\\" target=\\"_blank\\"><img alt=\\"👪 All Contributors: <%= contributors.length %>\\" src=\\"https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-<%= contributors.length %>-21bb42.svg\\" /></a>",
58+
"contributors": [],
59+
"contributorsSortAlphabetically": true,
60+
"projectName": "test-repository",
61+
"projectOwner": "test-owner"
62+
}",
5763
".github": {
5864
"workflows": {
5965
"contributors.yml": "jobs:
@@ -174,7 +180,28 @@ describe("blockAllContributors", () => {
174180
},
175181
],
176182
"files": {
177-
".all-contributorsrc": "{"badgeTemplate":"\\t<a href=\\"#contributors\\" target=\\"_blank\\"><img alt=\\"👪 All Contributors: <%= contributors.length %>\\" src=\\"https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-<%= contributors.length %>-21bb42.svg\\" /></a>","contributors":[{"avatar_url":"https://avatars.githubusercontent.com/u/3335181?v=4","contributions":["bug","code","design","doc","test","tool"],"login":"JoshuaKGoldberg","name":"Josh Goldberg","profile":"http://www.joshuakgoldberg.com"}],"contributorsSortAlphabetically":true,"projectName":"test-repository","projectOwner":"JoshuaKGoldberg"}",
183+
".all-contributorsrc": "{
184+
"badgeTemplate": "\\t<a href=\\"#contributors\\" target=\\"_blank\\"><img alt=\\"👪 All Contributors: <%= contributors.length %>\\" src=\\"https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-<%= contributors.length %>-21bb42.svg\\" /></a>",
185+
"contributors": [
186+
{
187+
"avatar_url": "https://avatars.githubusercontent.com/u/3335181?v=4",
188+
"contributions": [
189+
"bug",
190+
"code",
191+
"design",
192+
"doc",
193+
"test",
194+
"tool"
195+
],
196+
"login": "JoshuaKGoldberg",
197+
"name": "Josh Goldberg",
198+
"profile": "http://www.joshuakgoldberg.com"
199+
}
200+
],
201+
"contributorsSortAlphabetically": true,
202+
"projectName": "test-repository",
203+
"projectOwner": "JoshuaKGoldberg"
204+
}",
178205
".github": {
179206
"workflows": {
180207
"contributors.yml": "jobs:
@@ -294,7 +321,28 @@ describe("blockAllContributors", () => {
294321
},
295322
],
296323
"files": {
297-
".all-contributorsrc": "{"badgeTemplate":"\\t<a href=\\"#contributors\\" target=\\"_blank\\"><img alt=\\"👪 All Contributors: <%= contributors.length %>\\" src=\\"https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-<%= contributors.length %>-21bb42.svg\\" /></a>","contributors":[{"avatar_url":"https://avatars.githubusercontent.com/u/3335181?v=4","contributions":["bug","code","design","doc","test","tool"],"login":"other","name":"Other","profile":"http://www.example.com"}],"contributorsSortAlphabetically":true,"projectName":"test-repository","projectOwner":"test-owner"}",
324+
".all-contributorsrc": "{
325+
"badgeTemplate": "\\t<a href=\\"#contributors\\" target=\\"_blank\\"><img alt=\\"👪 All Contributors: <%= contributors.length %>\\" src=\\"https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-<%= contributors.length %>-21bb42.svg\\" /></a>",
326+
"contributors": [
327+
{
328+
"avatar_url": "https://avatars.githubusercontent.com/u/3335181?v=4",
329+
"contributions": [
330+
"bug",
331+
"code",
332+
"design",
333+
"doc",
334+
"test",
335+
"tool"
336+
],
337+
"login": "other",
338+
"name": "Other",
339+
"profile": "http://www.example.com"
340+
}
341+
],
342+
"contributorsSortAlphabetically": true,
343+
"projectName": "test-repository",
344+
"projectOwner": "test-owner"
345+
}",
298346
".github": {
299347
"workflows": {
300348
"contributors.yml": "jobs:

src/blocks/blockAllContributors.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,18 @@ export const blockAllContributors = base.createBlock({
6565
}),
6666
],
6767
files: {
68-
".all-contributorsrc": JSON.stringify({
69-
badgeTemplate:
70-
' <a href="#contributors" target="_blank"><img alt="👪 All Contributors: <%= contributors.length %>" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-<%= contributors.length %>-21bb42.svg" /></a>',
71-
contributors: options.contributors ?? [],
72-
contributorsSortAlphabetically: true,
73-
projectName: options.repository,
74-
projectOwner: options.owner,
75-
}),
68+
".all-contributorsrc": JSON.stringify(
69+
{
70+
badgeTemplate:
71+
' <a href="#contributors" target="_blank"><img alt="👪 All Contributors: <%= contributors.length %>" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-<%= contributors.length %>-21bb42.svg" /></a>',
72+
contributors: options.contributors ?? [],
73+
contributorsSortAlphabetically: true,
74+
projectName: options.repository,
75+
projectOwner: options.owner,
76+
},
77+
null,
78+
2,
79+
),
7680
".github": {
7781
workflows: {
7882
"contributors.yml": createSoloWorkflowFile({

0 commit comments

Comments
 (0)