Skip to content

Commit

Permalink
Changed program to run at system tray & bundle with nexe
Browse files Browse the repository at this point in the history
  • Loading branch information
Barocena committed Dec 20, 2023
1 parent 9cf1671 commit bcd7fa3
Show file tree
Hide file tree
Showing 4 changed files with 1,502 additions and 911 deletions.
25 changes: 11 additions & 14 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
// build.js
const exe = require("@angablue/exe");
const { compile } = require("nexe");

const build = exe({
entry: "./index.js",
out: "./out/StyLua-Plugin.exe",
version: "1.0.0",
target: "latest-win-x64",
icon: "./assets/icon.ico",
executionLevel: "asInvoker",
properties: {
compile({
input: "./index.js",
output: "StyLua-Roblox.exe",
build: true,
verbose: true,
resources: "assets/icon.ico",
rc: {
FileDescription: "StyLua Roblox Plugin",
ProductName: "StyLua Roblox Plugin",
LegalCopyright: "https://github.com/Barocena/StyLua-Roblox-Plugin",
OriginalFilename: "StyLua-Plugin.exe",
},
});

build.then(() => console.log("Build completed!"));
})
.then(() => console.log("Build completed!"))
.catch(console.error);
22 changes: 22 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const express = require("express");
const StyLua = require("@johnnymorganz/stylua");
const app = express();
const Tray = require("trayicon");
const ConsoleWindow = require("node-hide-console-window");
const fs = require("fs");
const path = require("path");

// StyLua Roblox Plugin
// Version 1.0.0
Expand Down Expand Up @@ -47,3 +51,21 @@ app.post("/stylua", (req, res) => {
app.listen(18259, () => {
console.log("Server started on port 18259");
});

Tray.create(
{
useTempDir: "clean",

icon: fs.readFileSync(
path.join(path.dirname(__filename), "assets/icon.ico")
),
title: "StyLua",
},
function (tray) {
tray.setMenu(
tray.item("Quit", () => process.exit(0))
);
}
);

ConsoleWindow.hideConsole();
Loading

0 comments on commit bcd7fa3

Please sign in to comment.