# AIroot-UISYS-RELEASE
**Repository Path**: uucckk/AIroot-UISYS-LIB
## Basic Information
- **Project Name**: AIroot-UISYS-RELEASE
- **Description**: 精简的WEB前端模块化工具,UI 引擎可以充分的发挥HTML“语义化”的思想,把开发人员的思想有效的转化为代码。
- **Primary Language**: JavaScript
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: http://www.airoot.cn/
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2019-07-12
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: webframework
**Tags**: None
## README
| [中文](doc/zh_CN/index.md) | [English](doc/en_US/index.md) | [日语](doc/jp_CH/index.md) |
# UI-SYSTEM-LIB
UI-SYSTEM 的官方库项目
# 说明
- UI-SYSTEM 是一套轻巧、高性能、静态前端系统,可以快速构建稳健的WEB服务。
整套系统采用了混合式的开发思想,即“选择合适的技术做擅长的事,各尽其职,优势融合”。
- UI-SYSTEM 设计思想是 “简单明了,直截了当”,让前端工程师直接进入开发状态。
- UI-SYSTEM 在模块化设计上,采用微模块方案,你可以把他理解为DNA和氨基酸的配合,一切展现模块都是即时组合,并且在渲染上做了大量优化,能提供原生性能的渲染体验。
- UI-SYSTEM 提供了命令行控制服务和自动配置文件两种方式部署,服务采用热更新方式,动态切换服务参数。
- UI-SYSTEM 采用Go作为开发语言,充分利用了Go的高并发能力,很高兴选择了Go作为服务开发(之前一直使用Java,实际上GO在复杂业务上处理速度已经远远高于Java这门语言,网上很多人用JIT命中高例子和Go对比是不正确的。)
# 如何使用
> WINDOWS
- **方式1**
1. window系统运行uisys.exe
2. 从example里面添加一个工程,写法如下:
```linux
pub example/v1 :80
```
其中:80是开启服务的端口好,也可以指定发布地址,如127.0.0.1:80
3. 打开chrome浏览器,输入:http://127.0.0.1/
- **方式2**
1. 也可以直接将您的工程目录拖动到uisys.exe图标上。

2. 确保弹出的控制台没有端口占用错误错误。
3. 打开chrome浏览器,输入:http://127.0.0.1/
> LINUX 和 CENTOS
> DARWIN
> ARM
# 服务运行方式
UI-SYS 的服务节点运行方式,默认是以 开发(Development) 模式运行的,在此模式下,UISYS的WEB SERVER 会对扩展名为\*.ui,\*.es 两种文件进行实时解析,当我们要发布的时候,需要切换到静态发布模式,届时,所有的*.ui,*.es都会变成*.ui.hmtl这样的扩展名。
如果想了解UISYS的*.ui,*.es扩展名文件的概念可以点击这里。
静态模式命令如下:
```linux
$> pub example/v1 :80 -s
```
命令的格式是在原有格式后加上 -s 即可(-s 代表 static)。
我们介绍下 UISYS 平台的基本命令,包括服务控制命令和项目参数设置命令。
# 命令解析
## 服务控制命令
### 1. help
获取帮助信息
```linux
$> --help
---------------------------------------------
lang Language Setting.
COMMAND: lang
pub Publishing websites.
COMMAND: pub [HTTP Service IP:PORT]
ls Show services list.
COMMAND: ls
add Add services and don't use command as services name.
COMMAND: add [Project Path] [HTTP Service IP:PORT]
...
```
### 2. version
获取软件版本
```linux
$> version
---------------------------------------------
AIroot UI-SYSTEM 0.9.5beta
```
### 3. pub
发布指定目录为网站
命令格式: pub [HTTP Service IP:PORT]
```linux
$> pub example/v1
---------------------------------------------
The [p0] setted in [E:\UISYS-RELEASE\example\v1].
The [p0] starting at [:80]
WEB Server Started At: [:80]. Use protocol http
```
可以指定端口:
```linux
$> pub example/v1 :8888
---------------------------------------------
The [p0] setted in [E:\UISYS-RELEASE\example\v1].
The [p0] starting at [:8888]
WEB Server Started At: [:8888]. Use protocol http
```
可以指定绝对路径:
```linux
$> pub E:\UISYS-RELEASE\example\v1 :8888
---------------------------------------------
The [p0] setted in [E:\UISYS-RELEASE-0.9.5BETA\example\v1].
The [p0] starting at [:8888]
WEB Server Started At: [:8888]. Use protocol http
```
对于带空格的路径可以用引号括起来,如下:
```linux
$> pub "E:\UISYS RELEASE\example\v1" :8888
---------------------------------------------
The [p0] setted in [E:\UISYS RELEASE\example\v1\example\v1].
The [p0] starting at [:8888]
WEB Server Started At: [:8888]. Use protocol http
```
可以指定https服务
```linux
$> pub "E:\UISYS-RELEASE\example\v1" https://:80
---------------------------------------------
The [p0] starting at [https://:80]
WEB Server Started At: [:80]. Use protocol https
```
可以全部制定:
```linux
$> pub "E:\UISYS-RELEASE\example\v1" https://10.110.10.34:80
---------------------------------------------
The [p0] starting at [https://10.110.10.34:80]
WEB Server Started At: [10.110.10.34:80]. Use protocol https
```
### 4. ls
列出当前存在的服务节点。
```linux
$> ls
---------------------------------------------
0. p1 Running 2019-07-10 23:43:28 D:\UISYS-RELEASE\example\v1 http://0.0.0.0:80/
1. a2 Stopping 2019-07-10 23:43:43 D:\UISYS-RELEASE\example\v2 http:///
----list over----
```
### 5. add
Add services and don't use command as services name.
添加服务节点,用于挂在被发布的工程。
注意:服务名称不能使用add作为服务的名字。
- 命令格式: add \ [Project Path] [HTTP Service IP:PORT]
```linux
$> add a0 example/v1 :80
---------------------------------------------
The [a0] setted in [E:\UISYS-RELEASE\example\v1].
The [a0] starting at [:80]
WEB Server Started At: [:80]. Use protocol http
```
也可以只创建服务节点,但是不挂在项目:
```linux
$> add a0
---------------------------------------------
The [a0] added successfully.
```
如果需要挂在节点,可以通过 stp(set project)命令挂在项目目录:
```linux
$> a0 stp example/v1
---------------------------------------------
The [a0] setted in [C:\Users\Administrator\Desktop\UISYS-RELEASE-0.9.5BETA\example\v1].
```
此时,我们只是挂在了项目,如果要运行需要使用 run 命令:
```linux
$> run a0 :80
---------------------------------------------
The [a0] starting at [:80]
WEB Server Started At: [:80]. Use protocol http
```
### 6. run
Start service.
运行服务节点
- 命令格式: run \ [IP:PORT], For Example:run test 127.0.0.1:1511
```linux
$> run a0
---------------------------------------------
The [a2] starting at [:80]
WEB Server Started At: [:80]. Use protocol http
```
可以指定端口
```linux
$> run a0 :80
---------------------------------------------
The [a2] starting at [:80]
WEB Server Started At: [:80]. Use protocol http
```
可以指定IP
```linux
$> run a0 10.110.10.34:80
---------------------------------------------
The [a2] starting at [10.110.10.34:80]
WEB Server Started At: [10.110.10.34:80]. Use protocol http
```
可以指定https服务
```linux
$> run a0 https://:80
---------------------------------------------
The [a2] starting at [https://:80]
WEB Server Started At: [:80]. Use protocol https
```
可以全部制定:
```linux
$> run a0 https://10.110.10.34:80
---------------------------------------------
The [a2] starting at [https://10.110.10.34:80]
WEB Server Started At: [10.110.10.34:80]. Use protocol https
```
### 7. stop
停止服务
- 命令格式: stop \
```linux
$> stop a0
---------------------------------------------
a0 Stop [a0]
status: [:80]http: Server closed.
[:80]JUS Server END.
```
### 8. rm
移除服务
- 命令格式: rm \
```linux
$> rm a0
---------------------------------------------
[a0] remove success.
status: [:80]http: Server closed.
[:80]JUS Server END.
```
### 9. nat
实现端口穿透功能。
- 命令格式: nat <-add/-remove> <本机端口> <映射机器IP:端口号>
例如,我们希望将本机的12000端口映射到10.110.10.28的3389端口。
3389 端口是window服务器的远程桌面服务端口,这样就可以暴露本机的12000端口来对外提供服务。
写法如下:
```linux
$> nat -add desktop :12000 10.110.10.28:3389
---------------------------------------------
The [desktop] starting at [:12000-->10.110.10.28:3389]
----list over----
```
查看本平台用了多少个对外映射可以:
```linux
$> nat
---------------------------------------------
desktop [:12000-->127.0.0.1:3389] Running 0
----list over----
```
如果要删除这个映射服务可以用一下命令:
```linux
$> nat -remove desktop
---------------------------------------------
>> accept tcp [::]:12000: use of closed network connection
desktop Close havs error: close tcp [::]:12000: use of closed network connection
----list over----
```
### 10. -c
关闭控制台(Console)的输入功能。
```linux
$> -c
---------------------------------------------
Console Input Method Unabled.
```
### 11. webc
启动Web版的服务器命令窗口。该功能默认以https发布。
- 命令格式: webc [HTTP Service IP:PORT]
```linux
$> webc
---------------------------------------------
Web Control Server Started At: [:3690]. Use protocol https
```
如果自己设定服务端口,可以用:
```linux
$> webc :10000
---------------------------------------------
Web Control Server Started At: [:10000]. Use protocol https
```
### 12. bat
执行批处理命令,可以指定多个批处理文件。
- 命令格式:bat [batch file Name...]
UI-SYSTEM 可以运行多个WEB服务,因此如果每次服务重启都要手工重新敲击一边太慢了。
我们可以将经常重服务输入的命令写在一个文件或多个文件里。
例如,我们编写一个“config.conf”,如下:
```txt
#发布example/v1工程到80端口
pub example/v1 :80
#发布example/v2工程到90端口
pub example/v2 :90
```
然后保存到uisys.exe 可以访问的目录,例如,放到uisys目录下。
然后再uisys控制台输入命令:
```linux
$> bat config.conf
---------------------------------------------
#发布example/v1工程到80端口
The [p0] setted in [C:\UISYS-RELEASE\example\v1].
The [p0] starting at [:80]
#发布example/v2工程到90端口
WEB Server Started At: [:80]. Use protocol http
The [p1] setted in [C:\UISYS-RELEASE\example\v2].
The [p1] starting at [:90]
WEB Server Started At: [:90]. Use protocol http
```
bat 多个执行多个命令文件,如下:
```linux
$> bat config.conf config1.conf "E:/uisys conf/config2.conf"
---------------------------------------------
...
```
### 13. stat
get application status,for example time and so on.
获取平台的运行状态,用以显示当前平台的起始时间和运行时间。
```linux
$> stat
---------------------------------------------
Date 2019-07-13 23:27:45
Now 2019-07-13 23:33:20
```
### 14. exit
Exit.
退出服务
## 项目参数设置
### 1. ctp
create project dir.
创建一个UI交互工程目录,ctp 是 create project 的缩写。
COMMAND: ctp \
命令格式:ctp \<项目路径>
说明:被创建的工程平台会直接帮您挂在到一个临时服务节点上。
```linux
$> ctp D:\uisys\project01
---------------------------------------------
create project [D:\uisys\project01].
The [a0] added successfully.
The [a0] setted in [D:\uisys\project01].
The project mount at[a0] server.
```
### 2. stp
set project dir.
重新设置一个服务节点的工程目录,stp 是 set project 的缩写。
COMMAND: stp \
例如,如果平台已有一个服务节点a0,可以重新让其指向"D:\uisys\project01"的路径。
```linux
$> stp a0 D:\uisys\project01
---------------------------------------------
The [a0] setted in [D:\uisys\project01].
```
### 3. ctf
create module file.
COMMAND: ctf [-Create Method(-h|m|s|r)] \
For Example:ctf test component.Test
ctf test -hr component.Test
### 4. release
release project.
发布工程为原生工程,以便其他服务器可以使用。
COMMAND: release \ [Project Path]
```linux
$> release a0 D:\uisys\project-release\
---------------------------------------------
----Release Complete----
```
### 5. send
push data to Service by websocket.
通过UI-System自建的websocket数据服务,推送数据到WEB客户端。
COMMAND: send \ \ \ \
### 6. lw
display websocket list of Service
查看服务节点提供的websocket服务被多少个WEB客户端连接。
COMMAND: lw \ [-h]
### 7. info
The project infomation
显示项目信息
COMMAND: rm \
### 8. set
Set project attributes.
设置WEB工程的属性
COMMAND: set \ \ \ [Value...]
### 9. ret
Remove project attributes.
COMMAND: ret \ \