code-sensei/sensei-grading-bookmarklet/index.js

14 lines
458 B
JavaScript
Raw Normal View History

2020-12-26 17:48:38 -05:00
const fs = require("fs");
2021-01-02 17:30:47 -05:00
const bookmarklet = require("bookmarklet"); // https://github.com/mrcoles/bookmarklet
2020-12-26 17:48:38 -05:00
fs.readFile("./app.js", "utf8", (error, content) => {
if (error !== null) {
throw new Error(error);
}
const { code, options } = bookmarklet.parseFile(content);
const dist = bookmarklet.convert(code, options);
2021-01-02 17:30:47 -05:00
fs.writeFile("bookmarklet.txt", dist, undefined, () => {
console.log(`Here is your bookmarklet:\n${dist}`);
});
2020-12-26 17:48:38 -05:00
});