feat: add Mastodon Support (#37)

This commit is contained in:
Rene Pot
2024-04-18 14:36:51 +00:00
committed by GitHub
parent 5fef93511e
commit f1d2ea973d
2 changed files with 26 additions and 9 deletions

View File

@@ -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": [

View File

@@ -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);
@@ -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)
);