Skip to content

Instantly share code, notes, and snippets.

@austil
Last active July 24, 2019 11:37
Show Gist options
  • Save austil/b118197dd9a1c047df98a7f28293abef to your computer and use it in GitHub Desktop.
Save austil/b118197dd9a1c047df98a7f28293abef to your computer and use it in GitHub Desktop.
[
{
"groupName": "The Big Four",
"timelines": [
{
"timelineName": "AngularJS",
"events": {
"versions": [
["2010-10-21", "v0.9"],
["2012-06-14", "v1.0"],
["2016-12-08", "v1.6"],
["2018-05-11", "v1.7"]
],
"milestones": [
["2016-06-01", "Stack Overflow Trends Peak"],
["2018-06-30", "End of Active Development"],
["2021-06-30", "End of Support"]
]
}
},
{
"timelineName": "Angular",
"events": {
"versions": [
["2016-09-15", "v2.0"],
["2017-03-24", "v4.0"],
["2017-11-01", "v5.0"],
["2018-05-03", "v6.0"]
],
"milestones": []
}
},
{
"timelineName": "React",
"events": {
"versions": [
["2013-07-02", "v0.03"],
["2015-10-09", "v0.14"],
["2016-04-08", "v15.0"],
["2017-09-26", "v16.0"]
],
"milestones": []
}
},
{
"timelineName": "Vue",
"events": {
"versions": [
["2013-12-08", "v0.6"],
["2015-10-27", "v1.0"],
["2016-09-30", "v2.0"]
],
"milestones": []
}
}
]
},
{
"groupName": "The Historicaly Relevant",
"timelines": [
{
"timelineName": "Backbone",
"events": {
"versions": [
["2010-10-03", "v0.1"],
["2013-03-20", "v1.0"],
["2016-04-05", "v1.3"]
],
"milestones": []
}
},
{
"timelineName": "Knockout",
"events": {
"versions": [
["2010-07-05", "v1.0"],
["2011-12-21", "v2.0"],
["2013-10-25", "v3.0"]
],
"milestones": [
[
"2018-05-26",
"Don't get it wrong, Knockout.js is<br/>still maintained, the 3.5 just entered<br/>release candidate"
]
]
}
},
{
"timelineName": "Ember",
"events": {
"versions": [
["2011-12-12", "v0.9"],
["2013-09-01", "v1.0"],
["2015-08-13", "v2.0"],
["2018-02-14", "v3.0"]
],
"milestones": []
}
}
]
},
{
"groupName": "The JavaScript Ecosystem",
"timelines": [
{
"timelineName": "NodeJS",
"events": {
"versions": [
["2009-05-27", "0.0.1"],
["2013-03-11", "0.10"],
["2015-02-06", "0.12"],
["2016-04-26", "v6"],
["2017-05-30", "v8"],
["2018-04-24", "v10"]
],
"milestones": []
}
},
{
"timelineName": "JQuery",
"events": {
"versions": [
["2006-08-26", "v1.0"],
["2013-04-18", "v2.0"],
["2016-01-08", "v3.0"]
],
"milestones": []
}
},
{
"timelineName": "Javascript",
"events": {
"versions": [
["1996-03-01", "v1.0"],
["1999-12-01", "ES3"],
["2009-12-01", "ES5"],
["2015-06-01", "ES6"],
["2016-06-01", "ES7"],
["2017-06-01", "ES8"],
["2018-06-01", "ES9"]
],
"milestones": [
["2000-03-01", "Work began on ES4"],
["2003-06-01", "ES4 put on hold"],
["2005-09-01", "ES4 start again"],
["2008-08-01", "ES4 Abandoned"]
]
}
}
]
}
]
const fs = require('fs');
const [ , , csvFile] = process.argv;
let csvTimeline = fs.readFileSync(csvFile, 'utf8')
.split('\n')
.slice(2)
.map(line => line.split(','))
.map(([timeline, eventType, event, start, end, source]) => ({timeline, eventType, event, start, end, source}))
.reduce((groupedTimelines, currentEvent) => {
if(groupedTimelines[currentEvent.timeline]) {
groupedTimelines[currentEvent.timeline].events.versions.push([currentEvent.start, currentEvent.event]);
} else {
groupedTimelines[currentEvent.timeline] = {
"timelineName": currentEvent.timeline,
"events": {
"versions": [],
"milestones": []
}
};
}
return groupedTimelines;
}, {})
;
const formated = [];
Object.values(csvTimeline).forEach((timeline) => {
formated.push({
"groupName": timeline.timelineName,
"timelines": [timeline]
});
});
console.log(JSON.stringify(formated));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment