Last active
May 19, 2020 07:15
-
-
Save kenpusney/37b92b94afc013c8aa938081ed34cefb to your computer and use it in GitHub Desktop.
Generate story list using Balsamiq Wireframes story map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs") | |
function borderColorToType(borderColor) { | |
return { | |
2848996: "Integration", | |
10027263: "Decision", | |
40463: "Authentication", | |
13576743: "Technical" | |
}[`${borderColor}`] || "Story"; | |
} | |
const text = new String(fs.readFileSync("/dev/stdin")); | |
console.log("title,type,epic,role"); | |
const graph = JSON.parse(text); | |
const epics = graph.mockup.controls.control.filter(it => it.properties != undefined && it.properties.color == 11982760) | |
.map(it => ({ pos: it.x, epic: it.properties.text})) | |
.reduce((g, t) => { | |
g[t.pos] = t.epic; | |
return g; | |
}, {}); | |
const roles = graph.mockup.controls.control.filter(it => it.properties != undefined && it.properties.color == 12745632) | |
.map(it => ({ pos: it.x, role: it.properties.text})) | |
.sort((t, o) => o.pos - t.pos); | |
function rolesOf(pos) { | |
const role = roles.filter(r => r.pos <= parseInt(pos))[0]; | |
return role.role; | |
} | |
graph | |
.mockup | |
.controls | |
.control | |
.filter( | |
it => it.properties != undefined | |
&& it.properties.color == 16770457) | |
.map(it => { | |
return { | |
story: it.properties.text, | |
type: borderColorToType(it.properties.borderColor), | |
epic: epics[it.x], | |
role: rolesOf(it.x) | |
}; | |
}) | |
.forEach(it => { | |
console.log(`${it.story},${it.type},${it.epic},${it.role}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment