Update server platforms to v2 paths #465

Merged
Sirherobrine23 merged 4 commits from multi-server-installs into main 2022-09-27 23:29:33 +00:00
4 changed files with 22 additions and 13 deletions
Showing only changes of commit f25c3f61b6 - Show all commits

View File

@@ -8,4 +8,6 @@ updates:
- package-ecosystem: npm
directory: /
schedule:
interval: daily
interval: monthly
assignees:
- Sirherobrine23

View File

@@ -20,6 +20,8 @@ jobs:
- Spigot
runs-on: ubuntu-latest
name: "${{ matrix.platform }}"
env:
BDS_HOME: "~/.bdsCore"
steps:
- uses: actions/checkout@v3
name: Code checkout
@@ -50,4 +52,15 @@ jobs:
# Run test
- name: Test
run: npm run test:partial -- tests/${{ matrix.platform }}.ts
run: npm run test:partial -- tests/${{ matrix.platform }}.ts
# Upload bds root
- name: Upload BdsCore folder
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}
path: |
~/.bdsCore
!~/.bdsCore/**/*.debug
!~/.bdsCore/**/bedrock_server
!~/.bdsCore/**/*_packs/

View File

@@ -1,10 +0,0 @@
import { installServer, startServer } from "../src/pocketmine";
(async function(){
await installServer("latest");
const serverManeger = await startServer();
serverManeger.on("log", console.log);
serverManeger.on("portListening", console.log);
serverManeger.on("serverStarted", () => serverManeger.stopServer());
return serverManeger.waitExit();
})().catch(err => console.trace(err));

View File

@@ -3,7 +3,11 @@ import path from "node:path";
import fs from "node:fs/promises";
import os from "node:os";
export const bdsRoot = process.env.BDS_HOME||path.join(os.homedir(), ".bdsManeger");
export let bdsRoot = path.join(os.homedir(), ".bdsManeger");
if (process.env.BDS_HOME) {
if (process.env.BDS_HOME.startsWith("~")) process.env.BDS_HOME = process.env.BDS_HOME.replace("~", os.homedir());
bdsRoot = process.env.BDS_HOME;
}
async function exists(filePath: string) {
return fs.access(filePath).then(() => true).catch((() => false));
}