forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add backers and sponsors to homepage (jestjs#6537)
- Loading branch information
1 parent
ae9d17a
commit d69d9aa
Showing
6 changed files
with
173 additions
and
0 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
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,37 @@ | ||
#!/usr/bin/env node | ||
const fs = require('fs'); | ||
const request = require('request'); | ||
const path = require('path'); | ||
|
||
const REQUIRED_KEYS = ['id']; | ||
|
||
request( | ||
'https://opencollective.com/api/groups/jest/backers', | ||
(err, response, body) => { | ||
if (err) console.error('Failed to fetch backers: ', err); | ||
|
||
// Basic validation | ||
const content = JSON.parse(body); | ||
|
||
if (!Array.isArray(content)) throw new Error('backer info is not an array'); | ||
|
||
for (const item of content) { | ||
for (const key of REQUIRED_KEYS) { | ||
if (!item || typeof item !== 'object') | ||
throw new Error( | ||
`backer info item (${JSON.stringify(item)} is not an object`, | ||
); | ||
if (!(key in item)) | ||
throw new Error( | ||
`backer info item (${JSON.stringify(item)} doesn't include ${key}`, | ||
); | ||
} | ||
} | ||
|
||
fs.writeFile(path.resolve(__dirname, 'backers.json'), body, err => { | ||
if (err) { | ||
console.error('Failed to write backers file: ', err); | ||
} else console.log('Fetched 1 file: backers.json'); | ||
}); | ||
}, | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,46 @@ | ||
.mainContainer { | ||
flex: initial; | ||
} | ||
|
||
.sponsor-item { | ||
margin: 10px; | ||
} | ||
|
||
.sponsor-avatar { | ||
display: inline-block; | ||
width: 100px; | ||
height: 100px; | ||
border-radius: 50%; | ||
border: 1px solid white; | ||
overflow: hidden; | ||
} | ||
|
||
.backer-item { | ||
margin: 2px; | ||
} | ||
|
||
.backer-avatar { | ||
display: inline-block; | ||
width: 50px; | ||
height: 50px; | ||
border-radius: 50%; | ||
border: 1px solid white; | ||
overflow: hidden; | ||
} | ||
|
||
.support-button { | ||
margin-top: 10px; | ||
display: inline-block; | ||
padding: 0.4em 1em; | ||
text-transform: uppercase; | ||
color: #99424f; | ||
border: 1px solid #99424f; | ||
border-radius: 1.25em; | ||
-webkit-transition: all 250ms; | ||
transition: all 250ms; | ||
} | ||
|
||
.support-button:hover { | ||
background: #99424f; | ||
color: #ffffff; | ||
} |