Skip to content

Commit

Permalink
feat: add Mastodon Support (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
Topener authored Apr 18, 2024
1 parent 5fef935 commit f1d2ea9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
1 change: 1 addition & 0 deletions people.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"languages": ["English", "Dutch", "Frisian"],
"linkedin": "https://www.linkedin.com/in/wraldpyk/",
"twitter": "https://twitter.com/wraldpyk",
"mastodon": "https://fosstodon.org/@wraldpyk",
"scheduling": "https://calendar.google.com/calendar/appointments/schedules/AcZssZ2j2HSqAeHfTXLKLdq5VyE-3lCrbIBLtL7DWAk6VrAkJfC5GVFEFI8cHAhUeIkbqFe1l3hmhm6A",
"online-only": false,
"topics": [
Expand Down
34 changes: 25 additions & 9 deletions scripts/write-readme.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict;'
const fs = require('fs');
const appRoot = require('app-root-path');
let path = require('path');
"use strict;";
const fs = require("fs");
const appRoot = require("app-root-path");
let path = require("path");

//Get the data
path = path.parse(appRoot.path);
Expand All @@ -15,10 +15,26 @@ json.people.sort(function (a, b) {
});

//Generate with proper formating
const peopleList = json.people.map(people =>
`- **[${people.name}](${people.scheduling}) (${(people.linkedin ? "[LinkedIn](" + people.linkedin + "), " : "")}${(people.twitter ? "[Twitter](" + people.twitter + ")" : "")}), ${people.title} at ${people.company}:** ${people.topics.join(', ')}`
).join('\r\n');
const peopleList = json.people
.map(
(person) => {
let socials = [];
['LinkedIn', 'Twitter', 'Mastodon'].forEach(social => {
if (person.hasOwnProperty(social.toLowerCase()) && person[social.toLowerCase()].length > 0) {
socials.push(`[${social}](${person[social.toLowerCase()]})`);
}
});

return `- **[${person.name}](${person.scheduling}) (${socials.join(', ')}), ${
person.title
} at ${person.company}:** ${person.topics.join(", ")}`
}
)
.join("\r\n");

//Write README.md
const template = fs.readFileSync(`${appRoot}/README-TEMPLATE.md`, 'utf8');
fs.writeFileSync(`${parentFolderPath}/README.md`, template.replace('PLACEHOLDER', peopleList));
const template = fs.readFileSync(`${appRoot}/README-TEMPLATE.md`, "utf8");
fs.writeFileSync(
`${parentFolderPath}/README.md`,
template.replace("PLACEHOLDER", peopleList)
);

0 comments on commit f1d2ea9

Please sign in to comment.