CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
ProdigyPNP

CoCalc is a real-time collaborative commercial alternative to JupyterHub and Overleaf that provides Jupyter Notebooks, LaTeX documents, and SageMath.

GitHub Repository: ProdigyPNP/ProdigyMathGameHacking
Path: blob/master/PHEx/build.mjs
Views: 713
1
"use strict";
2
// PHEx Build Script
3
4
5
/** Directory Zipper */
6
import zipdir from "zip-dir";
7
8
9
/** console.log prefix */
10
const prefix = "[PHEx Builder] ";
11
12
// newline cuz it looks nicer in the terminal when i do.
13
console.log("\n");
14
15
/** old console.log function */
16
var backup = console.log;
17
18
// console.log plus prefix
19
console.log = ((message) => {
20
// im so smart lol
21
backup(prefix + message);
22
})
23
24
25
// Tell the user that the chromium extension is being zipped
26
console.log("Zipping chromium extension...");
27
28
29
// Zip ./src to ./build.extension.zip
30
zipdir("./src/", { saveTo: "./build/extension.zip" }, function (err, buffer) {
31
32
// If this encounters an error, print the error and return.
33
if (err) return console.error(err);
34
35
// If the program has gotten to this step, then the program has not encountered any errors.
36
// Tell the user that extension.zip has been built.
37
console.log(".ZIP chromium extension built -> extension.zip");
38
39
// Tell the user that we've build the chromium extension successfully.
40
console.log("Chromium extension Success!\n");
41
42
43
44
45
46
// Tell the user that the firefox extension is being zipped
47
console.log("Zipping firefox extension...");
48
49
// Zip ./firefox to ./build.extension.zip
50
zipdir("./firefox/", { saveTo: "./build/extension.xpi" }, function (err, _buffer) {
51
52
// If this encounters an error, print the error and return.
53
if (err) return console.error(err);
54
55
// If the program has gotten to this step, then the program has not encountered any errors.
56
// Tell the user that extension.xpi has been built.
57
console.log(".XPI file built -> extension.xpi");
58
59
// Tell the user that we've build the firefox extension successfully.
60
console.log("Firefox extension Success!\n");
61
62
63
// When making .crx extensions, it needs to be signed with a private key file to work.
64
// Tell the user that extension.crx needs to be signed if it's a production-used release.
65
console.warn("IMPORTANT: IF YOU ARE MAKING AN OFFICIAL PHEx RELEASE, THEN PLEASE REMEMBER TO SIGN THE .CRX WITH A PRIVATE KEY FILE.\n");
66
67
68
// Tell the user that we're done.
69
console.log("Done!");
70
71
});
72
73
74
});
75
76