Skip to content

Commit

Permalink
upgrade client
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronchen2k committed Feb 23, 2023
1 parent 99bd3e3 commit 37e5079
Show file tree
Hide file tree
Showing 273 changed files with 26,105 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.webpack/
out/
bin/
ui/
/node_modules/
/yarn.lock
/package-lock.json
100 changes: 100 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# ZD 客户端

## 开发

### 安装依赖

执行:

```
npm install
```

### 启动调试模式

启动默认的调试模式,此时会预先自动启动 UI 开发服务器和 ZD 开发服务器。

```
npm run start
```

参考:https://www.electronforge.io/cli#start

### 环境变量

在调试模式下可以通过制定环境变量来设置 ZD UI 服务访问地址和 ZD 可执行程序位置。

* `UI_SERVER_URL`:ZD UI 服务访问地址或静态资源文件目录,如果不指定会自动进入 `../ui/` 目录执行 `npm run serve` 获取开发服务器地址;
* `UI_SERVER_PORT`:ZD UI 服务端口,如果不指定则使用 `8000`
* `SERVER_EXE_PATH`:ZD 服务可执行文件位置(相对于 `/client` 目录),如果不指定则会自动进入 `../cmd/server/` 目录下执行 `go run main.go -p 8085` 启动 ZD 服务器。
* `SERVER_CWD_PATH`:ZD 服务运行目录;
* `SKIP_SERVER`:跳过启动 ZD 服务,适用于 ZD 服务已经在外部启动的情况。

### 特殊调试模式

**模式一:使用外部 UI 服务**

```
SKIP_SERVER=1 UI_SERVER_URL=http://localhost:8000 npm run start
```

**模式二:使用本地 UI 静态文件目录**

```
UI_SERVER_URL=../ui/dist UI_SERVER_PORT=8000 npm run start
```

**模式三:自定义 ZD 服务执行文件路径**

```
SERVER_EXE_PATH=bin/darwin/zd npm run start
```

**模式四:跳过启动 ZD 服务,使用外部 ZD 服务**

```
SKIP_SERVER=1 npm run start
```

**模式五:综合使用外部 UI 服务和外部 ZD 服务**

```
UI_SERVER_URL=http://localhost:8000 SKIP_SERVER=1 npm run start
```

## 代码检查

```
npm run lint
```

## 构建

```
npm run make
```

参考:https://www.electronforge.io/cli#make

## 打包

```
npm run package
```

参考:https://www.electronforge.io/cli#package

打包之前确保如下目录有相应的资源文件:

* `ui/dist/`:包含 UI 服务相关的所有文件
* `client/bin/win32/`:包含适用于 Windows 的 ZD 程序;
* `client/bin/darwin/`:包含适用于 macOS 的 ZD 程序;
* `client/bin/linux/`:包含适用于 Linux 的 ZD 程序;

## 发布

```
npm run publish
```

参考:https://www.electronforge.io/cli#publish
55 changes: 55 additions & 0 deletions client/forge.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module.exports = {
electronPackagerConfig: {
"name": "ztf",
"icon": "./ui/favicon.ico"
},
packagerConfig: {
"name": "ztf",
"icon": "./icon/favicon",
extraResource: [
'./bin',
'./ui',
'./lang',
]
},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
name: 'ztf'
}
},
{
name: '@electron-forge/maker-zip',
platforms: [
'darwin'
]
},
{
name: '@electron-forge/maker-deb',
config: {}
},
{
name: '@electron-forge/maker-rpm',
config: {}
}
],
plugins: [
{
'name': '@electron-forge/plugin-webpack',
'config': {
mainConfig: './webpack.main.config.js',
renderer: {
config: './webpack.renderer.config.js',
entryPoints: [
// {
// html: './src/index.html',
// js: './src/renderer.js',
// name: 'main_window'
// }
]
}
}
}
]
}
Binary file added client/icon/favicon.icns
Binary file not shown.
Binary file added client/icon/favicon.ico
Binary file not shown.
20 changes: 20 additions & 0 deletions client/lang/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"app.title": "ZenData",
"app.about": "About",
"app.exit": "Exit",
"app.edit": "Edit",
"app.undo": "Undo",
"app.redo": "Redo",
"app.cut": "Cut",
"app.copy": "Copy",
"app.paste": "Paste",
"app.select_all": "Select All",
"app.view": "View",
"app.switch_to_full_screen": "Switch To Full Screen",
"app.window": "Window",
"app.minimize": "Minimize",
"app.close": "Close",
"app.bring_all_to_front": "Bring All To Front",
"app.help": "Help",
"app.website": "Web Site"
}
20 changes: 20 additions & 0 deletions client/lang/zh-cn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"app.title": "ZenData",
"app.about": "关于",
"app.exit": "退出",
"app.edit": "编辑",
"app.undo": "撤销",
"app.redo": "重做",
"app.cut": "剪切",
"app.copy": "复制",
"app.paste": "黏贴",
"app.select_all": "选择所有",
"app.view": "查看",
"app.switch_to_full_screen": "切换全屏",
"app.window": "窗口",
"app.minimize": "最小化",
"app.close": "关闭",
"app.bring_all_to_front": "全部置于顶层",
"app.help": "帮助",
"app.website": "网站"
}
57 changes: 57 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "zd",
"productName": "zd",
"version": "1.0.0",
"description": "zd",
"main": ".webpack/main",
"scripts": {
"start": "NODE_ENV=development electron-forge start",
"package": "electron-forge package",
"package-mac": "npm run package -- --platform=darwin",
"package-linux": "npm run package -- --platform=linux",
"package-win64": "npm run package -- --platform=win32 --arch=x64",
"package-win32": "npm run package -- --platform=win32 --arch=ia32",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "Aaron Chen",
"email": "[email protected]"
},
"license": "GPL3",
"config": {
"forge": "./forge.config.js"
},
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.61",
"@electron-forge/maker-deb": "^6.0.0-beta.61",
"@electron-forge/maker-rpm": "^6.0.0-beta.61",
"@electron-forge/maker-squirrel": "^6.0.0-beta.61",
"@electron-forge/maker-zip": "^6.0.0-beta.61",
"@electron-forge/plugin-webpack": "^6.0.0-beta.61",
"@vercel/webpack-asset-relocator-loader": "^1.7.0",
"css-loader": "^6.5.1",
"electron": "16.0.6",
"electron-packager": "^15.4.0",
"node-loader": "^2.0.0",
"style-loader": "^3.3.1"
},
"dependencies": {
"@electron/remote": "^2.0.8",
"adm-zip": "^0.5.10",
"crypto": "^1.0.1",
"electron-log": "^4.4.6",
"electron-remote": "^1.3.0",
"electron-squirrel-startup": "^1.0.0",
"express": "^4.17.3",
"find-process": "^1.4.7",
"fs-extra": "^11.1.0",
"got": "^12.5.3",
"kill-port-process": "^3.0.1",
"open-term": "^2.0.4",
"ps-tree": "^1.2.0",
"tree-kill": "^1.2.2"
}
}
Loading

0 comments on commit 37e5079

Please sign in to comment.