Skip to content

Commit d594e9f

Browse files
committed
fix: change marker name to match npm script name
1 parent 4f70589 commit d594e9f

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

contributing/contributors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Thanks to these wonderful volunteers and contributors for improving the HackYour
44

55
<!-- To update the contributor list, run "npm run generate:contributors" -->
66
<!-- prettier-ignore-start -->
7-
<!-- BEGIN generateContributors -->
7+
<!-- BEGIN generate:contributors -->
88

99
Total: **16** contributors
1010

@@ -20,7 +20,7 @@ Total: **16** contributors
2020
| --- | --- | --- | --- |
2121
| [@MercedesUbeira](https://github.com/MercedesUbeira) | [@shpomp](https://github.com/shpomp) | [@saloumeh-67](https://github.com/saloumeh-67) | [@urbanogilson](https://github.com/urbanogilson) |
2222

23-
<!-- END generateContributors -->
23+
<!-- END generate:contributors -->
2424
<!-- prettier-ignore-end -->
2525

2626
There are many people who help test, review and guide the development of our program behind the scenes without committing directly. Let's share a thanks for those people too 👏!

support/src/documentationHelpers/generateContributors.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ async function main() {
156156
const raw = await fetchContributors(REPO);
157157
const contributors = filterAndSortContributors(raw);
158158
const md = renderMarkdown(contributors);
159-
await updateFileSection(md, "./contributing/contributors.md");
159+
await updateFileSection(
160+
md,
161+
"./contributing/contributors.md",
162+
"generate:contributors",
163+
);
160164
} catch (err: any) {
161165
console.error("Error:", err.message);
162166
process.exit(1);

support/src/documentationHelpers/updateFileSection.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ import * as fs from "node:fs/promises";
33
export default async function updateFileSection(
44
contentToInsert: string,
55
filename: string,
6+
markerName: string,
67
): Promise<void> {
78
const oldContent = await fs.readFile(filename, "utf-8");
89

9-
const matches = [
10-
...oldContent.matchAll(
11-
/(<!-- BEGIN generateContributors -->).*?(<!-- END generateContributors -->)/gs,
12-
),
13-
];
10+
const pattern = new RegExp(
11+
`(<!-- BEGIN ${markerName} -->).*?(<!-- END ${markerName} -->)`,
12+
"gs",
13+
);
14+
15+
const matches = [...oldContent.matchAll(pattern)];
1416

1517
if (matches.length !== 1)
1618
throw new Error(

0 commit comments

Comments
 (0)