-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(about): add contributors section
- add contributors generating script - adjust contributors ordering
- Loading branch information
1 parent
7aa3820
commit 35d67a6
Showing
9 changed files
with
199 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const fs = require('fs'); | ||
|
||
const SOURCE = '.all-contributorsrc'; | ||
const TARGET = './src/app/static/about/about.component.html'; | ||
const TOKEN_START = '<!-- ALL-CONTRIBUTORS-LIST:START -->'; | ||
const TOKEN_END = '<!-- ALL-CONTRIBUTORS-LIST:END -->'; | ||
const PATTERN = new RegExp(`${TOKEN_START}[\\s\\S]*${TOKEN_END}`, 'gim'); | ||
|
||
const contributors = JSON.parse(fs.readFileSync(SOURCE, 'utf8')).contributors; | ||
const content = fs.readFileSync(TARGET, 'utf8'); | ||
|
||
const data = contributors.map(c => ` | ||
<a class="contributor" href="${c.profile}" target="_blank"> | ||
<img src="${c.avatar_url}"> | ||
<span>${c.name}</span> | ||
</a> | ||
`).join('\n'); | ||
const replacement = `${TOKEN_START}${data}${TOKEN_END}`; | ||
const adjustedContent = content.replace(PATTERN, replacement); | ||
|
||
fs.writeFileSync(TARGET, adjustedContent); | ||
|
||
console.log(`${contributors.length} contributors added to HTML`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters