Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
93a4be25
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
11 个月 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
93a4be25
编写于
3月 04, 2022
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
kill ztf process
上级
cc75f102
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
51 deletion
+25
-51
client/package.json
client/package.json
+1
-0
client/src/consts.js
client/src/consts.js
+4
-0
client/src/service.js
client/src/service.js
+11
-42
ui/.env.production
ui/.env.production
+2
-2
ui/vue.config.js
ui/vue.config.js
+7
-7
未找到文件。
client/package.json
浏览文件 @
93a4be25
...
...
@@ -43,6 +43,7 @@
"electron-squirrel-startup"
:
"^1.0.0"
,
"express"
:
"^4.17.3"
,
"find-process"
:
"^1.4.7"
,
"kill-port-process"
:
"^3.0.1"
,
"ps-tree"
:
"^1.2.0"
,
"tree-kill"
:
"^1.2.2"
}
...
...
client/src/consts.js
0 → 100644
浏览文件 @
93a4be25
export
const
portClient
=
55231
export
const
portServer
=
55232
export
const
uuid
=
'
ZTF@1CF17A46-B136-4AEB-96B4-F21C8200EF5A~
'
client/src/service.js
浏览文件 @
93a4be25
...
...
@@ -3,54 +3,23 @@ import cp, {execSync, spawn} from 'child_process';
import
os
from
'
os
'
;
import
{
app
}
from
'
electron
'
;
import
express
from
'
express
'
;
const
psTree
=
require
(
'
ps-tree
'
);
const
{
killPortProcess
}
=
require
(
'
kill-port-process
'
);
import
{
portClient
,
portServer
,
uuid
}
from
'
./consts
'
;
import
{
logInfo
,
logErr
}
from
'
./log
'
;
const
psTree
=
require
(
'
ps-tree
'
);
const
DEBUG
=
process
.
env
.
NODE_ENV
===
'
development
'
;
const
isWin
=
/^win/
.
test
(
process
.
platform
);
const
isMac
=
/^darwin/
.
test
(
process
.
platform
);
const
uuid
=
'
ZTF@1CF17A46-B136-4AEB-96B4-F21C8200EF5A~
'
const
port
=
8085
let
_ztfServerProcess
;
let
_ztfSubProcessIds
=
[];
export
function
checkZtfPort
()
{
let
cmd
=
''
if
(
!
isWin
)
{
cmd
=
`lsof -i:
${
port
}
| grep :
${
port
}
`
}
else
{
cmd
=
`netstat -aon`
}
const
cp
=
require
(
'
child_process
'
);
const
stdout
=
cp
.
execSync
(
cmd
).
toString
().
trim
()
const
msg
=
`exec
${
cmd
}
, stdout:
${
stdout
}
`
console
.
log
(
msg
);
logInfo
(
msg
)
if
(
stdout
.
indexOf
(
'
:
'
+
port
)
>
-
1
)
{
if
(
stdout
.
indexOf
(
uuid
)
<
0
)
{
const
msg
=
'
Port ${port} is used by another process. exit.
'
console
.
log
(
msg
);
logErr
(
msg
);
return
false
}
const
msg
=
'
Port ${port} is used by ztf process. kill previous one.
'
console
.
log
(
msg
);
logInfo
(
msg
);
killZtfServer
()
}
else
{
return
true
}
}
export
function
startZtfServer
()
{
const
pass
=
checkZtfPort
()
if
(
!
pass
)
{
return
}
(
async
()
=>
{
await
killPortProcess
([
portClient
,
portServer
])
})();
if
(
process
.
env
.
SKIP_SERVER
)
{
logInfo
(
`>> Skip to start ZTF Server by env "SKIP_SERVER=
${
process
.
env
.
SKIP_SERVER
}
".`
);
...
...
@@ -72,8 +41,8 @@ export function startZtfServer() {
}
return
new
Promise
((
resolve
,
reject
)
=>
{
const
cwd
=
process
.
env
.
SERVER_CWD_PATH
||
path
.
dirname
(
serverExePath
);
logInfo
(
`>> Starting ZTF Server from exe path with command "
${
serverExePath
}
-P
8085
" in "
${
cwd
}
"...`
);
const
cmd
=
spawn
(
serverExePath
,
[
'
-p
'
,
'
8085
'
,
"
-uuid
"
,
uuid
],
{
logInfo
(
`>> Starting ZTF Server from exe path with command "
${
serverExePath
}
-P
${
portServer
}
" in "
${
cwd
}
"...`
);
const
cmd
=
spawn
(
serverExePath
,
[
'
-p
'
,
portServer
,
"
-uuid
"
,
uuid
],
{
cwd
,
shell
:
true
,
});
...
...
@@ -187,7 +156,7 @@ export function getUIServerUrl() {
uiServerUrl
=
path
.
resolve
(
app
.
getAppPath
(),
uiServerUrl
);
}
const
port
=
process
.
env
.
UI_SERVER_PORT
||
8000
;
const
port
=
process
.
env
.
UI_SERVER_PORT
||
portClient
;
logInfo
(
`>> Starting UI serer at
${
uiServerUrl
}
with port
${
port
}
`
);
const
uiServer
=
express
();
...
...
ui/.env.production
浏览文件 @
93a4be25
...
...
@@ -2,10 +2,10 @@
NODE_ENV = 'production'
# devServer port
VUE_APP_PORT=
8000
VUE_APP_PORT=
55231
# mock 是否开启 true|false , development环境有效
VUE_APP_MOCK = false
#api接口域名
VUE_APP_APIHOST = http://127.0.0.1:
8085
/api/v1
VUE_APP_APIHOST = http://127.0.0.1:
55232
/api/v1
ui/vue.config.js
浏览文件 @
93a4be25
...
...
@@ -2,7 +2,7 @@
const
bodyParser
=
require
(
'
body-parser
'
)
const
{
NODE_ENV
,
VUE_APP_PORT
,
VUE_APP_MOCK
}
=
process
.
env
;
const
MonacoWebpackPlugin
=
require
(
'
monaco-editor-webpack-plugin
'
)
//
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
module
.
exports
=
{
publicPath
:
'
/
'
,
...
...
@@ -75,11 +75,11 @@ module.exports = {
config
.
resolve
.
alias
.
set
(
'
vue-i18n
'
,
'
vue-i18n/dist/vue-i18n.cjs.js
'
)
config
.
plugin
(
'
monaco-editor
'
).
use
(
MonacoWebpackPlugin
,
[
{
// Languages are loaded on demand at runtime
languages
:
[
'
json
'
,
'
javascript
'
,
'
html
'
,
'
xml
'
]
}
])
//
config.plugin('monaco-editor').use(MonacoWebpackPlugin, [
//
{
//
// Languages are loaded on demand at runtime
//
languages: ['json', 'javascript', 'html', 'xml']
//
}
//
])
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录