This repository has been archived on 2025-05-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
code-sensei/sensei-grading-bookmarklet/index.js

14 lines
458 B
JavaScript
Raw Normal View History

2020-12-26 14:48:38 -08:00
const fs = require("fs");
2021-01-02 14:30:47 -08:00
const bookmarklet = require("bookmarklet"); // https://github.com/mrcoles/bookmarklet
2020-12-26 14:48:38 -08: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 14:30:47 -08:00
fs.writeFile("bookmarklet.txt", dist, undefined, () => {
console.log(`Here is your bookmarklet:\n${dist}`);
});
2020-12-26 14:48:38 -08:00
});