Skip to content

Commit

Permalink
Merge pull request #55 from opensourcepledge/cwlw/remove-datetimeModi…
Browse files Browse the repository at this point in the history
…fied

Remove datetimeModified
  • Loading branch information
vladh authored Aug 27, 2024
2 parents c6dc6b5 + 2e49c6b commit a0deea9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
24 changes: 5 additions & 19 deletions bin/update-member
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,11 @@ async function updateMember(name, url) {
console.error(`ERROR: Failed to get JSON from ${url}`, e);
process.exit(1);
}

let shouldWrite = (localMemberData == undefined);

if (!shouldWrite) {
const localMtime = new Date(localMemberData.datetimeModified);
const remoteMtime = new Date(remoteMemberData.datetimeModified);
shouldWrite = remoteMtime > localMtime;
}

if (shouldWrite) {
console.log(`Remote JSON is newer, writing to ${localPath}`);
try {
fs.writeFileSync(localPath, JSON.stringify(remoteMemberData, null, 2));
} catch (e) {
console.error(`ERROR: Failed to write to ${localPath}`, e);
process.exit(1);
}
} else {
console.log("Remote JSON is older, skipping");
try {
fs.writeFileSync(localPath, JSON.stringify(remoteMemberData, null, 2));
} catch (e) {
console.error(`ERROR: Failed to write to ${localPath}`, e);
process.exit(1);
}
}

Expand Down
1 change: 0 additions & 1 deletion contrib/example-schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"domain": "example.com",
"datetimeModified": "2024-08-05T01:00:00Z",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"name": "Acme Widgets",
"urlSquareLogoWithBackground": "https://avatars.githubusercontent.com/u/1396951?s=200&v=4",
Expand Down
1 change: 0 additions & 1 deletion src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const memberProvidedData = z.object({

const member = z.object({
domain: z.string(),
datetimeModified: z.string().datetime(),
}).merge(memberProvidedData);

export type Member = z.infer<typeof member>;
Expand Down
1 change: 0 additions & 1 deletion src/content/members/sentry.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"domain": "sentry.io",
"datetimeModified": "2024-08-05T01:00:00Z",
"description": "Sentry started life as an Open Source side project in 2008. We grew that way for years before commercializing. We've always given back to the community and now we're happy to help other companies do the same through the Open Source Pledge.",
"name": "Sentry",
"urlSquareLogoWithBackground": "https://avatars.githubusercontent.com/u/1396951?s=200&v=4",
Expand Down

0 comments on commit a0deea9

Please sign in to comment.