code-sensei/sensei-grading-bookmarklet/index.js
2021-01-02 14:30:47 -08:00

13 lines
458 B
JavaScript

const fs = require("fs");
const bookmarklet = require("bookmarklet"); // https://github.com/mrcoles/bookmarklet
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);
fs.writeFile("bookmarklet.txt", dist, undefined, () => {
console.log(`Here is your bookmarklet:\n${dist}`);
});
});