Skip to content

Commit

Permalink
Roadmap author and contributors page
Browse files Browse the repository at this point in the history
  • Loading branch information
kamranahmedse committed Dec 1, 2019
1 parent ce35a81 commit 129deed
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 7 deletions.
7 changes: 5 additions & 2 deletions components/detailed-roadmap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const DetailedRoadmap = ({ roadmap }) => {
const [menuActive, setMenuState] = useState(false);
const {
sidebar = {},
page: currentPage = {}
page: currentPage = {},
author = {}
} = roadmap;

const roadmapPages = Object.keys(sidebar || {}).map(groupTitle => {
Expand Down Expand Up @@ -42,7 +43,9 @@ const DetailedRoadmap = ({ roadmap }) => {
<div className="container d-flex align-items-center flex-column flex-md-row">
<RoadmapMeta>
<h3>{ roadmap.title }</h3>
<p>Roadmap contributed by <a href="#">Kamran Ahmed</a> and <a href="#">5 others</a></p>
<p>
Roadmap contributed by <a href={ author.url } target="_blank">{ author.name }</a>
{ roadmap.contributorsCount > 1 && ` and <a href="${roadmap.contributorsUrl}">${roadmap.contributorsCount} others</a>`}</p>
</RoadmapMeta>
<ShareRoadmap className="mt-2 mt-md-0">
<ShareIcon href={ siteConfig.url.repo } target="_blank">
Expand Down
10 changes: 10 additions & 0 deletions scripts/roadmaps-meta.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs');
const path = require('path');
const exec = require('child_process').execSync;

const STORAGE_PATH = path.join(__dirname, '../storage');
const ROADMAPS_PATH = path.join(__dirname, '../storage/roadmaps');
Expand All @@ -13,6 +14,13 @@ const roadmapsMeta = roadmapDirs.reduce((metaAcc, roadmapDirName) => {
const roadmapDir = path.join(ROADMAPS_PATH, roadmapDirName);
const roadmapMeta = require(path.join(roadmapDir, 'meta.json'));

const contributors = exec(`git log --pretty=format:"%an%x09" ${roadmapDir} | uniq`)
.toString()
.split('\n')
.map(contributor => contributor.replace(/[\s\t]/g, ' ').trim()) || [];
const contributorNames = contributors.filter(contributor => !!contributor);


console.log(`----------------------------`);
console.log(`[#] Roadmap: ${roadmapMeta.title}`);
console.log(`[x] Generating sidebar`);
Expand Down Expand Up @@ -61,6 +69,8 @@ const roadmapsMeta = roadmapDirs.reduce((metaAcc, roadmapDirName) => {
...metaAcc,
{
...roadmapMeta,
contributorsCount: contributorNames.length,
contributorsUrl: `/${roadmapSlug}/contributors`,
url: `/${roadmapSlug}`,
path: path.join(roadmapDir.replace(STORAGE_PATH, ''), '/summary.md'),
sidebar,
Expand Down
39 changes: 38 additions & 1 deletion storage/roadmaps.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
[
{
"title": "Frontend Developer",
"description": "Roadmap to becoming a modern frontend developer",
"description": "Step by step guide to becoming a modern frontend developer",
"featuredDescription": "Step by step guide to becoming a modern frontend developer in 2019",
"author": {
"name": "Kamran Ahmed",
"url": "https://twitter.com/kamranahmedse"
},
"featured": true,
"detailed": true,
"versions": [
"latest",
"2018",
"2017"
],
"contributorsCount": 1,
"contributorsUrl": "/frontend/contributors",
"url": "/frontend",
"path": "/roadmaps/1-frontend/summary.md",
"sidebar": {
"_others": [
{
"url": "/frontend/contributors",
"title": "contributors",
"path": "/roadmaps/1-frontend/_others/contributors.md"
}
],
"landscape": [
{
"url": "/frontend/junior",
Expand Down Expand Up @@ -79,6 +92,12 @@
"description": "Step by step guide to becoming a modern backend developer",
"featuredDescription": "Step by step guide to becoming a modern backend developer in 2019",
"featured": true,
"author": {
"name": "Kamran Ahmed",
"url": "https://twitter.com/kamranahmedse"
},
"contributorsCount": 1,
"contributorsUrl": "/backend/contributors",
"url": "/backend",
"path": "/roadmaps/2-backend/summary.md",
"sidebar": {
Expand Down Expand Up @@ -111,6 +130,12 @@
"2018",
"2017"
],
"author": {
"name": "Kamran Ahmed",
"url": "https://twitter.com/kamranahmedse"
},
"contributorsCount": 1,
"contributorsUrl": "/devops/contributors",
"url": "/devops",
"path": "/roadmaps/3-devops/summary.md",
"sidebar": {
Expand Down Expand Up @@ -138,6 +163,12 @@
"description": "Step by step guide to becoming a modern fullstack developer in 2019",
"featuredDescription": "Step by step guide to becoming a modern fullstack developer in 2019",
"upcoming": true,
"author": {
"name": "Kamran Ahmed",
"url": "https://twitter.com/kamranahmedse"
},
"contributorsCount": 1,
"contributorsUrl": "/fullstack/contributors",
"url": "/fullstack",
"path": "/roadmaps/4-fullstack/summary.md",
"sidebar": {}
Expand All @@ -147,6 +178,12 @@
"description": "Steps to follow in order to become a modern QA Engineer in 2019",
"featuredDescription": "Step by step guide to becoming a modern QA Engineer in 2019",
"upcoming": true,
"author": {
"name": "Anas Fitiani",
"url": "https://github.com/anas-qa"
},
"contributorsCount": 1,
"contributorsUrl": "/qa/contributors",
"url": "/qa",
"path": "/roadmaps/5-qa/summary.md",
"sidebar": {}
Expand Down
4 changes: 4 additions & 0 deletions storage/roadmaps/1-frontend/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"title": "Frontend Developer",
"description": "Step by step guide to becoming a modern frontend developer",
"featuredDescription": "Step by step guide to becoming a modern frontend developer in 2019",
"author": {
"name": "Kamran Ahmed",
"url": "https://twitter.com/kamranahmedse"
},
"featured": true,
"detailed": true,
"versions": [
Expand Down
6 changes: 5 additions & 1 deletion storage/roadmaps/2-backend/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"title": "Backend Developer",
"description": "Step by step guide to becoming a modern backend developer",
"featuredDescription": "Step by step guide to becoming a modern backend developer in 2019",
"featured": true
"featured": true,
"author": {
"name": "Kamran Ahmed",
"url": "https://twitter.com/kamranahmedse"
}
}
6 changes: 5 additions & 1 deletion storage/roadmaps/3-devops/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
"latest",
"2018",
"2017"
]
],
"author": {
"name": "Kamran Ahmed",
"url": "https://twitter.com/kamranahmedse"
}
}
6 changes: 5 additions & 1 deletion storage/roadmaps/4-fullstack/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"title": "Full Stack Developer",
"description": "Step by step guide to becoming a modern fullstack developer in 2019",
"featuredDescription": "Step by step guide to becoming a modern fullstack developer in 2019",
"upcoming": true
"upcoming": true,
"author": {
"name": "Kamran Ahmed",
"url": "https://twitter.com/kamranahmedse"
}
}
6 changes: 5 additions & 1 deletion storage/roadmaps/5-qa/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"title": "QA Engineer",
"description": "Steps to follow in order to become a modern QA Engineer in 2019",
"featuredDescription": "Step by step guide to becoming a modern QA Engineer in 2019",
"upcoming": true
"upcoming": true,
"author": {
"name": "Anas Fitiani",
"url": "https://github.com/anas-qa"
}
}

0 comments on commit 129deed

Please sign in to comment.