diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/add-crowdin-contributors.ts | 35 | ||||
-rw-r--r-- | scripts/link-readme.ts | 12 |
2 files changed, 21 insertions, 26 deletions
diff --git a/scripts/add-crowdin-contributors.ts b/scripts/add-crowdin-contributors.ts index eadedbcc4..242d338ce 100644 --- a/scripts/add-crowdin-contributors.ts +++ b/scripts/add-crowdin-contributors.ts | |||
@@ -1065,25 +1065,20 @@ const list: any[] = [ | |||
1065 | ]; | 1065 | ]; |
1066 | 1066 | ||
1067 | const infoPath = path.join(__dirname, '..', '.all-contributorsrc'); | 1067 | const infoPath = path.join(__dirname, '..', '.all-contributorsrc'); |
1068 | 1068 | const info = fs.readJSONSync(infoPath); | |
1069 | (async () => { | 1069 | for (const user of list) { |
1070 | const info = await fs.readJSON(infoPath); | 1070 | if (user.login) { |
1071 | 1071 | info.contributors = allContributors.addContributorWithDetails({ | |
1072 | for (const user of list) { | 1072 | ...user, |
1073 | // eslint-disable-next-line no-await-in-loop | 1073 | contributions: ['translation'], |
1074 | if (user.login) { | 1074 | profile: `https://crowdin.com/profile/${user.login}`, |
1075 | info.contributors = await allContributors.addContributorWithDetails({ | 1075 | options: { |
1076 | ...user, | 1076 | contributors: info.contributors, |
1077 | contributions: ['translation'], | 1077 | }, |
1078 | profile: `https://crowdin.com/profile/${user.login}`, | 1078 | }); |
1079 | options: { | ||
1080 | contributors: info.contributors, | ||
1081 | }, | ||
1082 | }); | ||
1083 | } | ||
1084 | } | 1079 | } |
1080 | } | ||
1085 | 1081 | ||
1086 | fs.writeJSON(infoPath, info, { | 1082 | fs.writeJSONSync(infoPath, info, { |
1087 | spaces: 2, | 1083 | spaces: 2, |
1088 | }); | 1084 | }); |
1089 | })(); | ||
diff --git a/scripts/link-readme.ts b/scripts/link-readme.ts index d565d59bb..d80739178 100644 --- a/scripts/link-readme.ts +++ b/scripts/link-readme.ts | |||
@@ -22,7 +22,7 @@ let replacements = 0; | |||
22 | // Regex matches strings that don't begin with a "[", i.e. are not already linked | 22 | // Regex matches strings that don't begin with a "[", i.e. are not already linked |
23 | // followed by a "franz#" and digits to indicate | 23 | // followed by a "franz#" and digits to indicate |
24 | // a GitHub issue, and not ending with a "]" | 24 | // a GitHub issue, and not ending with a "]" |
25 | readme = readme.replace(/(?<!\[)franz#\d+(?![\d\]])/gi, match => { | 25 | readme = readme.replaceAll(/(?<!\[)franz#\d+(?![\d\]])/gi, match => { |
26 | const issueNr = match.replace('franz#', ''); | 26 | const issueNr = match.replace('franz#', ''); |
27 | replacements += 1; | 27 | replacements += 1; |
28 | return `[franz#${issueNr}](https://github.com/meetfranz/franz/issues/${issueNr})`; | 28 | return `[franz#${issueNr}](https://github.com/meetfranz/franz/issues/${issueNr})`; |
@@ -31,9 +31,9 @@ readme = readme.replace(/(?<!\[)franz#\d+(?![\d\]])/gi, match => { | |||
31 | // Replace external issues | 31 | // Replace external issues |
32 | // Regex matches strings that don't begin with a "[", followed a repo name in the format "user/repo" | 32 | // Regex matches strings that don't begin with a "[", followed a repo name in the format "user/repo" |
33 | // followed by a "#" and digits to indicate a GitHub issue, and not ending with a "]" | 33 | // followed by a "#" and digits to indicate a GitHub issue, and not ending with a "]" |
34 | readme = readme.replace(/(?<!\[)\w+\/\w+#\d+(?![\d\]])/gi, match => { | 34 | readme = readme.replaceAll(/(?<!\[)\w+\/\w+#\d+(?![\d\]])/gi, match => { |
35 | const issueNr = match.replace(/\D/g, ''); | 35 | const issueNr = match.replaceAll(/\D/g, ''); |
36 | const repo = match.replace(/#\d+/g, ''); | 36 | const repo = match.replaceAll(/#\d+/g, ''); |
37 | replacements += 1; | 37 | replacements += 1; |
38 | return `[${repo}#${issueNr}](https://github.com/${repo}/issues/${issueNr})`; | 38 | return `[${repo}#${issueNr}](https://github.com/${repo}/issues/${issueNr})`; |
39 | }); | 39 | }); |
@@ -42,7 +42,7 @@ readme = readme.replace(/(?<!\[)\w+\/\w+#\d+(?![\d\]])/gi, match => { | |||
42 | // Regex matches strings that don't begin with a "[", i.e. are not already linked and | 42 | // Regex matches strings that don't begin with a "[", i.e. are not already linked and |
43 | // don't begin with "franz", i.e. are not Franz issues, followed by a "#" and digits to indicate | 43 | // don't begin with "franz", i.e. are not Franz issues, followed by a "#" and digits to indicate |
44 | // a GitHub issue, and not ending with a "]" | 44 | // a GitHub issue, and not ending with a "]" |
45 | readme = readme.replace(/(?<!\[|franz)#\d+(?![\d\]])/gi, match => { | 45 | readme = readme.replaceAll(/(?<!\[|franz)#\d+(?![\d\]])/gi, match => { |
46 | const issueNr = match.replace('#', ''); | 46 | const issueNr = match.replace('#', ''); |
47 | replacements += 1; | 47 | replacements += 1; |
48 | return `[#${issueNr}](https://github.com/ferdium/ferdium-app/issues/${issueNr})`; | 48 | return `[#${issueNr}](https://github.com/ferdium/ferdium-app/issues/${issueNr})`; |
@@ -51,7 +51,7 @@ readme = readme.replace(/(?<!\[|franz)#\d+(?![\d\]])/gi, match => { | |||
51 | // Link GitHub users | 51 | // Link GitHub users |
52 | // Regex matches strings that don't begin with a "[", i.e. are not already linked | 52 | // Regex matches strings that don't begin with a "[", i.e. are not already linked |
53 | // followed by a "@" and at least one word character and not ending with a "]" | 53 | // followed by a "@" and at least one word character and not ending with a "]" |
54 | readme = readme.replace(/(?<!\[)@\w+(?!])/gi, match => { | 54 | readme = readme.replaceAll(/(?<!\[)@\w+(?!])/gi, match => { |
55 | const username = match.replace('@', ''); | 55 | const username = match.replace('@', ''); |
56 | replacements += 1; | 56 | replacements += 1; |
57 | return `[@${username}](https://github.com/${username})`; | 57 | return `[@${username}](https://github.com/${username})`; |