-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from opensourcepledge/cwlw/schema
Add a schema for self-reporting
- Loading branch information
Showing
7 changed files
with
201 additions
and
2 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 @@ | ||
sentry,https://open.sentry.io/funding/osspledge.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { z, defineCollection } from "astro:content"; | ||
|
||
/* Welcome to the schema for OSS Pledge. | ||
* | ||
* If you are implementing an OSS Pledge report for a member organization, and | ||
* need to understand how to format it, you've found the source of truth. If | ||
* you have questions or run into limitations, please open an issue: | ||
* | ||
* https://github.com/getsentry/osspledge.com/issues/new | ||
* | ||
*/ | ||
|
||
const monetaryPayment = z.object({ | ||
amount: z.number().nonnegative(), | ||
urlDetails: z.string().url().optional(), | ||
}) | ||
|
||
const memberProvidedData = z.object({ | ||
name: z.string(), | ||
urlLogoWithBackground: z.string().url(), | ||
urlLearnMore: z.string().url(), | ||
description: z.string().optional(), | ||
annualReports: z | ||
.object({ | ||
dateYearEnding: z.string().date(), | ||
averageNumberOfDevs: z.number().nonnegative(), | ||
monetaryPayments: monetaryPayment.array().nonempty(), | ||
monetaryValueOfTime: z.number().nonnegative(), | ||
monetaryValueOfMaterials: z.number().nonnegative(), | ||
}) | ||
.array() | ||
.nonempty(), | ||
}); | ||
|
||
export const collections = { | ||
members: defineCollection({ | ||
type: "data", | ||
schema: z | ||
.object({ | ||
domain: z.string(), | ||
urlSource: z.string().url(), | ||
datetimeModified: z.string().datetime(), | ||
}) | ||
.merge(memberProvidedData), | ||
}), | ||
}; |
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,22 @@ | ||
{ | ||
"domain": "sentry.io", | ||
"urlSource": "https://open.sentry.io/osspledge/data.json", | ||
"datetimeModified": "2024-07-19T12:24:46Z", | ||
"description": "Sentry has given to Open Source for soooooo many years.", | ||
"name": "Sentry", | ||
"urlLogoWithBackground": "https://fossfunders.com/logos/sentry.svg", | ||
"urlLearnMore": "https://open.sentry.io/osspledge/", | ||
"annualReports": [ | ||
{ | ||
"dateYearEnding": "2023-01-31", | ||
"averageNumberOfDevs": 135, | ||
"monetaryPayments": [ | ||
{"amount": 435000, "urlDetails": "https://thanks.dev/d/gh/getsentry/dependencies"}, | ||
{"amount": 50000, "urlDetails": "https://github.com/orgs/getsentry/sponsoring"}, | ||
{"amount": 15000, "urlDetails": "https://blog.sentry.io/we-just-gave-500-000-dollars-to-open-source-maintainers/"} | ||
], | ||
"monetaryValueOfTime": 100000, | ||
"monetaryValueOfMaterials": 500000 | ||
} | ||
] | ||
} |
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 +1,2 @@ | ||
/// <reference path="../.astro/types.d.ts" /> | ||
/// <reference types="astro/client" /> |
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,125 @@ | ||
--- | ||
import { getCollection } from 'astro:content'; | ||
import Layout from "../../layouts/Layout.astro"; | ||
import Prose from "../../components/Prose.astro"; | ||
export async function getStaticPaths() { | ||
const members = await getCollection('members'); | ||
return members.map(member => ({params: {id: member.id}, props: { member }})); | ||
} | ||
const { member } = Astro.props; | ||
const reports = member.data.annualReports; | ||
function getPlatformName(url) { | ||
let host = ''; | ||
let name = 'Other'; | ||
try { | ||
host = new URL(url).host; | ||
} catch (err) { | ||
host = ''; | ||
} | ||
switch(host) { | ||
case 'github.com': | ||
name = 'GitHub Sponsors'; | ||
break; | ||
case 'thanks.dev': | ||
name = 'Thanks.dev'; | ||
break; | ||
} | ||
return name; | ||
} | ||
--- | ||
<Layout title="OSS Pledge"> | ||
<main class="flex justify-center max-w-xl p-4"> | ||
<Prose> | ||
<h1 class="text-app-green mt-8 mb-4 text-5xl font-bold">OSS Pledge</h1> | ||
|
||
<a href="/">Home</a> | ||
|
||
<h2>{member.data.name}</h2> | ||
|
||
<img src={member.data.urlLogoWithBackground}> | ||
|
||
<p>{member.data.description}</p> | ||
|
||
<a href={member.data.urlLearnMore}>Learn more ...</a> | ||
|
||
{reports.map(report => <div class="annual-report"> | ||
<h3>Year Ending {report.dateYearEnding}</h3> | ||
|
||
<b>$3700 / dev</b> | ||
|
||
<h4>Payments to Independent Maintainers</h4> | ||
<table> | ||
<tr> | ||
<th>Platform</th> | ||
<th>Amount ($)</th> | ||
</tr> | ||
{report.monetaryPayments.map(entry => <tr> | ||
<td><a href={entry.urlDetails}>{getPlatformName(entry.urlDetails)}</a></td> | ||
<td class="text-right">{entry.amount}</td> | ||
</tr>)} | ||
<tr> | ||
<td>total</td> | ||
<td class="text-right">500000</td> | ||
</tr> | ||
<tr> | ||
<td>average number of devs</td> | ||
<td class="text-right">{report.averageNumberOfDevs}</td> | ||
</tr> | ||
<tr> | ||
<td>$ / dev</td> | ||
<td class="text-right">3700</td> | ||
</tr> | ||
</table> | ||
|
||
<h4>Other Contributions</h4> | ||
<table> | ||
<tr> | ||
<th>Item</th> | ||
<th class="text-right">Amount ($)</th> | ||
</tr> | ||
<tr> | ||
<td>value of time</td> | ||
<td class="text-right">{report.monetaryValueOfTime}</td> | ||
</tr> | ||
<tr> | ||
<td>value of materials</td> | ||
<td class="text-right">{report.monetaryValueOfMaterials}</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td class="text-right">600000</td> | ||
</tr> | ||
<tr> | ||
<td>payments to independent maintainers</td> | ||
<td class="text-right">500000</td> | ||
</tr> | ||
<tr> | ||
<td>total</td> | ||
<td class="text-right">1100000</td> | ||
</tr> | ||
</table> | ||
</div>)} | ||
|
||
<small> | ||
This information is provided directly by {member.data.name}. Open | ||
Source Pledge does not carry out any in-depth validation of this data. | ||
</small> | ||
|
||
</Prose> | ||
</main> | ||
</Layout> | ||
|
||
<style> | ||
main { | ||
margin: auto; | ||
padding: 1rem; | ||
width: 800px; | ||
max-width: calc(100% - 2rem); | ||
color: white; | ||
font-size: 20px; | ||
line-height: 1.6; | ||
} | ||
</style> |
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,4 @@ | ||
{ | ||
"extends": "astro/tsconfigs/strict" | ||
} | ||
"extends": "astro/tsconfigs/strict", | ||
"strictNullChecks": true, | ||
} |