pkg fixes

This commit is contained in:
CoolElectronics 2023-08-22 21:14:41 -04:00
parent 5ce4f60514
commit 30bf6cb8f1
No known key found for this signature in database
GPG key ID: F63593D168636C50
5 changed files with 22 additions and 6 deletions

View file

@ -12,8 +12,20 @@ build({
platform: "node",
// format: "esm",
bundle: true,
minify: true,
outfile: "dist/main.js",
plugins: [
makeAllPackagesExternalPlugin
],
})
build({
entryPoints: ["src/autoupdater.ts"],
platform: "node",
bundle: true,
minify: true,
outfile: "dist/autoupdater.js",
plugins: [
makeAllPackagesExternalPlugin
],
})

View file

@ -4,9 +4,9 @@
"description": "",
"main": "src/main.ts",
"scripts": {
"start": "tsx src/main.ts",
"start": "tsx src/main.ts --start",
"dev": "nodemon -x tsx src/dev.ts",
"prod": "node esbuild.bundle.js && pkg src/main.js"
"prod": "node esbuild.bundle.js && pkg dist/main.js --targets node18 -o dist/adrift-server && pkg dist/autoupdater.js --targets node18 -o dist/adrift-server-autoupdate"
},
"keywords": [],
"author": "",

View file

@ -53,5 +53,4 @@ function start() {
}
// downloadAndStart();
start();
downloadAndStart();

View file

@ -20,6 +20,8 @@ import { exit } from "process";
import { datadir } from "./lib";
import { PROTOCOL_VERSION } from "protocol";
export const SERVER_MILESTONE = "1.0";
async function config() {
let dir = datadir();
@ -102,6 +104,7 @@ async function login(credentials: any) {
async function start() {
let dir = datadir();
let conf;
try {
conf = JSON.parse(fs.readFileSync(`${dir}/config.json`).toString());
@ -111,6 +114,8 @@ async function start() {
let tracker = TrackerList[conf.tracker as keyof typeof TrackerList];
console.log(chalk.blue("Starting server!"));
console.log(chalk.blue(`Server version: ${SERVER_MILESTONE} - Protocol version: ${PROTOCOL_VERSION}`));
if (conf.type == "swarm") {
let connect = () => {
let trackerws = new WebSocket(`${tracker.tracker}/join?protocol=${PROTOCOL_VERSION}`);

View file

@ -26,5 +26,5 @@ let trackers = {
tracker: "wss://rafftracker.mercurywork.shop",
description: "a second official backup tracker",
}
};
} as const;
export default trackers;