mirror of
https://github.com/MCSManager/MCSManager.git
synced 2024-12-15 07:40:01 +08:00
Fix: auto open page & npm command
This commit is contained in:
parent
68659d7dd8
commit
9b07f1568c
@ -21,7 +21,6 @@
|
||||
"@koa/router": "^10.0.0",
|
||||
"archiver": "^5.3.1",
|
||||
"axios": "^1.1.3",
|
||||
"common": "file:../common",
|
||||
"compressing": "^1.5.1",
|
||||
"crypto": "^1.0.1",
|
||||
"dockerode": "3.1.0",
|
||||
@ -32,7 +31,6 @@
|
||||
"koa-body": "^4.2.0",
|
||||
"koa-send": "^5.0.1",
|
||||
"log4js": "^6.4.0",
|
||||
"mcsmanager-common": "file:../common/dist",
|
||||
"module-alias": "^2.2.3",
|
||||
"node-disk-info": "^1.3.0",
|
||||
"node-schedule": "^2.0.0",
|
||||
@ -46,6 +44,7 @@
|
||||
"yaml": "^1.10.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"common": "file:../common",
|
||||
"@types/archiver": "^5.3.1",
|
||||
"@types/axios": "^0.14.0",
|
||||
"@types/dockerode": "^3.2.7",
|
||||
|
@ -3,7 +3,7 @@
|
||||
currentPath="$(pwd)"
|
||||
for action in "daemon" "panel" "frontend"
|
||||
do
|
||||
terminalCmd="tell app \"Terminal\" to do script \"cd $currentPath && npm run start-$action\""
|
||||
terminalCmd="tell app \"Terminal\" to do script \"cd $currentPath && npm run $action\""
|
||||
echo "Run: $terminalCmd"
|
||||
osascript -e "$terminalCmd"
|
||||
done
|
||||
|
@ -1,5 +1,5 @@
|
||||
start npm run start-daemon
|
||||
start npm run start-panel
|
||||
start npm run start-frontend
|
||||
start npm run daemon
|
||||
start npm run panel
|
||||
start npm run frontend
|
||||
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
"scripts": {
|
||||
"i18n": "i18next-scanner --config i18-scanner.config.js",
|
||||
"preview-build": "cd common && npm install && npm run build",
|
||||
"start-daemon": "cd daemon && npm run dev",
|
||||
"start-frontend": "cd frontend && npm run dev",
|
||||
"start-panel": "cd panel && npm run dev"
|
||||
"daemon": "cd daemon && npm run dev",
|
||||
"frontend": "cd frontend && npm run dev",
|
||||
"panel": "cd panel && npm run dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"crc": "^4.3.2",
|
||||
|
@ -21,7 +21,6 @@
|
||||
"@koa/router": "^10.0.0",
|
||||
"axios": "^1.6.2",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"common": "file:../common",
|
||||
"crypto": "^1.0.1",
|
||||
"i18n": "^0.15.0",
|
||||
"i18next": "^21.8.14",
|
||||
@ -42,6 +41,7 @@
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"common": "file:../common",
|
||||
"@types/bcryptjs": "^2.4.2",
|
||||
"@types/fs-extra": "^9.0.11",
|
||||
"@types/koa": "^2.13.1",
|
||||
|
@ -20,6 +20,10 @@ import { middleware as protocolMiddleware } from "./app/middleware/protocol";
|
||||
import { mountRouters } from "./app/index";
|
||||
import versionAdapter from "./app/service/version_adapter";
|
||||
|
||||
function hasParams(name: string) {
|
||||
return process.argv.includes(name);
|
||||
}
|
||||
|
||||
function setupHttp(koaApp: Koa, port: number, host?: string) {
|
||||
const httpServer = http.createServer(koaApp.callback());
|
||||
|
||||
@ -38,8 +42,8 @@ function setupHttp(koaApp: Koa, port: number, host?: string) {
|
||||
logger.info($t("TXT_CODE_app.exitTip", { port }));
|
||||
logger.info("==================================");
|
||||
|
||||
if (os.platform() == "win32") {
|
||||
open(`http://localhost:${port}/`).then(() => {});
|
||||
if (os.platform() == "win32" && hasParams("--open")) {
|
||||
open(`http://localhost:${port}/`);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user