diff --git a/AuthorHours.json b/AuthorHours.json new file mode 100644 index 00000000..98e08e17 --- /dev/null +++ b/AuthorHours.json @@ -0,0 +1 @@ +{"time":"479h6m27s"} \ No newline at end of file diff --git a/AuthorHours.txt b/AuthorHours.txt new file mode 100644 index 00000000..96be4a9c --- /dev/null +++ b/AuthorHours.txt @@ -0,0 +1 @@ +From "2018-02-01" to "today" : 479h6m27s diff --git a/hourstxtToJSON.js b/hourstxtToJSON.js new file mode 100644 index 00000000..3d11ef8c --- /dev/null +++ b/hourstxtToJSON.js @@ -0,0 +1,14 @@ +/* global require */ +/* global process */ +const fs = require("fs"); +const path = require("path"); + +// open AuthorHours.txt and write time into JSON file + +const hours = fs.readFileSync("AuthorHours.txt", "utf8"); +console.log(hours.split("\n")[0].split(": ")[1]); +const json = { time: hours.split("\n")[0].split(": ")[1] }; + +fs.writeFile("AuthorHours.json", JSON.stringify(json), "utf8", function (err) { + if (err) return console.log(err); +}); diff --git a/package.json b/package.json index 24191e2f..3535eac6 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "lint": "web-ext lint", "esLint": "npx eslint firefox/ chrome/", "test": "cd firefox && web-ext build --overwrite-dest && cd .. && node refreshXPI.js && python test.py", - "hours": "git hours -since 2018-02-01 -before today -author Marvin Alexander Krebber" + "hours": "git hours -since 2018-02-01 -before today -author marvinkrebber@yahoo.de > AuthorHours.txt && node hourstxtToJSON.js" }, "repository": { "type": "git",