38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
const fs = require("fs");
|
|
const util = require("node:util");
|
|
const exec = util.promisify(require("node:child_process").exec);
|
|
const readline = require("readline");
|
|
|
|
const outPath =
|
|
"./PackageSources/html_ui/Pages/VCockpit/Instruments/aircraft_efb/KH_TFDi_MD11_efb";
|
|
|
|
fs.copyFileSync("./EFB/efb.js", `${outPath}/efb.js`);
|
|
fs.copyFileSync("./EFB/efb.html", `${outPath}/efb.html`);
|
|
fs.copyFileSync("./EFB/efb.css", `${outPath}/efb.css`);
|
|
console.log("Files transferred.");
|
|
|
|
exec("git apply ./EFB/efb-js.patch").then(({ stdout, stderr }) => {
|
|
console.log("Patches efb.js applied.");
|
|
});
|
|
exec("git apply ./EFB/efb-html.patch").then(({ stdout, stderr }) => {
|
|
console.log("Patches efb.html applied.");
|
|
});
|
|
|
|
var output = "";
|
|
var lineReader = readline.createInterface({
|
|
input: fs.createReadStream(`${outPath}/App.js`),
|
|
});
|
|
lineReader.on("line", (line) => {
|
|
if (line.startsWith("import") || line.startsWith("export")) {
|
|
output += "// " + line + "\n";
|
|
} else {
|
|
output += line + "\n";
|
|
}
|
|
});
|
|
lineReader.on("close", () => {
|
|
fs.writeFile(`${outPath}/App.js`, output, (err) => {
|
|
if (err) console.log(err);
|
|
console.log("Import/Export removed.");
|
|
});
|
|
});
|