diff options
Diffstat (limited to 'scripts/add-crowdin-contributors.ts')
-rw-r--r-- | scripts/add-crowdin-contributors.ts | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/scripts/add-crowdin-contributors.ts b/scripts/add-crowdin-contributors.ts index 242d338ce..7a0d0e769 100644 --- a/scripts/add-crowdin-contributors.ts +++ b/scripts/add-crowdin-contributors.ts | |||
@@ -53,7 +53,7 @@ console.log(JSON.stringify(members)); | |||
53 | * 5. Regenerate the README table using the CLI ('all-contributors generate') | 53 | * 5. Regenerate the README table using the CLI ('all-contributors generate') |
54 | * Please check if the generated data is ok and no data is lost. | 54 | * Please check if the generated data is ok and no data is lost. |
55 | */ | 55 | */ |
56 | const list: any[] = [ | 56 | const list: { name: string; login: string; avatar_url: string }[] = [ |
57 | { | 57 | { |
58 | name: 'vantezzen_', | 58 | name: 'vantezzen_', |
59 | login: 'vantezzen_', | 59 | login: 'vantezzen_', |
@@ -1064,21 +1064,27 @@ const list: any[] = [ | |||
1064 | }, | 1064 | }, |
1065 | ]; | 1065 | ]; |
1066 | 1066 | ||
1067 | const infoPath = path.join(__dirname, '..', '.all-contributorsrc'); | 1067 | const allContributorsFile = path.join(__dirname, '..', '.all-contributorsrc'); |
1068 | const info = fs.readJSONSync(infoPath); | 1068 | const allContributorsJSON = fs.readJSONSync(allContributorsFile); |
1069 | for (const user of list) { | ||
1070 | if (user.login) { | ||
1071 | info.contributors = allContributors.addContributorWithDetails({ | ||
1072 | ...user, | ||
1073 | contributions: ['translation'], | ||
1074 | profile: `https://crowdin.com/profile/${user.login}`, | ||
1075 | options: { | ||
1076 | contributors: info.contributors, | ||
1077 | }, | ||
1078 | }); | ||
1079 | } | ||
1080 | } | ||
1081 | 1069 | ||
1082 | fs.writeJSONSync(infoPath, info, { | 1070 | // eslint-disable-next-line unicorn/prefer-top-level-await |
1083 | spaces: 2, | 1071 | (async () => { |
1084 | }); | 1072 | allContributorsJSON.contributors = await Promise.all( |
1073 | list | ||
1074 | .filter(user => user.login) | ||
1075 | .map(user => { | ||
1076 | return allContributors.addContributorWithDetails({ | ||
1077 | ...user, | ||
1078 | contributions: ['translation'], | ||
1079 | profile: `https://crowdin.com/profile/${user.login}`, | ||
1080 | options: { | ||
1081 | contributors: allContributorsJSON.contributors, | ||
1082 | }, | ||
1083 | }); | ||
1084 | }), | ||
1085 | ); | ||
1086 | |||
1087 | fs.writeJSONSync(allContributorsFile, allContributorsJSON, { | ||
1088 | spaces: 2, | ||
1089 | }); | ||
1090 | })(); | ||