Skip to content

Commit

Permalink
ui 图形界面初始化 #45
Browse files Browse the repository at this point in the history
  • Loading branch information
LDmoxeii committed May 4, 2024
1 parent 7bdae3b commit ca36e75
Show file tree
Hide file tree
Showing 39 changed files with 135 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/log
/db
/ui
**/*.js
tc.json
23 changes: 19 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,33 @@
{
"label": "deno test",
"type": "shell",
"command": "zsh cli/db.zsh; deno test --allow-net --allow-read tst",
"command": "zsh cli/db.zsh; deno test --allow-net --allow-read ismism.ts/tst",
"group": "test",
"presentation": {
"echo": true,
"reveal": "always",
"panel": "dedicated",
"showReuseMessage": true,
"clear": true
},
"problemMatcher": []
},
{
"label": "build",
"type": "shell",
"command": "zsh cli/build.zsh",
"group": {
"kind": "test",
"isDefault": true,
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"panel": "dedicated",
"showReuseMessage": true,
"clear": true,
}
"clear": true
},
"problemMatcher": []
}
]
}
14 changes: 14 additions & 0 deletions cli/build.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
echo "building ismism.ts\n"

rm -f cli/*.js
rm -rf ui
mkdir ui

cd ismism.ts

set -e
deno check src/ser.ts ui/bind/bind.ts
deno run -A cli/bundle.ts src/ser ui/bind/bind
deno run -A ui/ui.ts

mv src/ser.js ../cli
7 changes: 7 additions & 0 deletions ismism.ts/cli/bundle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { bundle } from "https://deno.land/x/[email protected]/mod.ts"

await Promise.all(Deno.args.map(async p => {
const b = await bundle(`${p}.ts`)
const c = b.code
await Deno.writeTextFile(`${p}.js`, c)
}))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions ismism.ts/ui/bind/bind.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("从零开发!")
35 changes: 35 additions & 0 deletions ismism.ts/ui/index/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="zh-CN">

<head>
<meta charset="utf-8">
<title>主义主义</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="refresh" content="3600">
<link rel="icon" type="image/png" sizes="32x32" href="//s1.ax1x.com/2023/06/15/pCu2bZQ.png">
<link rel="icon" type="image/png" sizes="16x16" href="//s1.ax1x.com/2023/06/15/pCu2LIs.png">
<link rel="icon" type="image/png" href="//s1.ax1x.com/2023/06/15/pCu25xf.png">
<link rel="apple-touch-icon" sizes="180x180" href="//s1.ax1x.com/2023/06/15/pCu25xf.png">
</head>

<template></template>

<style></style>

<body>
<nav>
<menu>
<li><a href="">主义主义</a></li>
<li><a href="#soc">同城俱乐部</a></li>
<li><a href="#wsl">法律援助</a></li>
<li><a href="#lit">理论学习</a></li>
<li><a href="#pas">用户登录</a></li>
</menu>
</nav>
<hr>
<div id="main"></div>
</body>

<script></script>

</html>
10 changes: 10 additions & 0 deletions ismism.ts/ui/ui.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const [index, bind] = await Promise.all([
Deno.readTextFile("./ui/index/index.html"),
Deno.readTextFile("./ui/bind/bind.js"),
])

const ui = index
.replace("<script></script>", `<script type="module">${bind}</script>`)

console.log(`emitting ui/index.html #${ui.length}`)
Deno.writeTextFileSync("../ui/index.html", ui)
80 changes: 47 additions & 33 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,51 @@
## 代码结构

* `cli` 命令接口 `command line interface`
* `src` 源代码 `source`
* `ont` 基础操作 `ontic`
- `base.ts` 进制转换
- `utc.ts` 时间格式 `Universal Time Convention`
- `crypt.ts` 签名验证 `cryptography`
- `jwt.ts` 身份验证 `JSON Web Token`
- `adm.ts` 行政区划 `administrative region`
- `json.ts` JSON数据声明
* `eid` 核心操作 `eidetic`
- `typ.ts` 数据类型声明 `type`
- `db.ts` 数据库初始化与数据操作类型声明 `database`
- `is.ts` 数据定义与检查
- `id.ts` 实体数据操作 `identity`
- `usr.ts` 用户数据操作 `user`
- `soc.ts` 俱乐部数据操作 `sociation` `social`
- `agd.ts` 活动数据操作 `agenda`
- `rec.ts` 记录数据操作 `record` - `credit` `debit` `earn`
- `msg.ts` 文章数据操作 `message` - `wsl` `lit`
- `aut.ts` 权限数据操作 `author` `authority`
* `pra` 业务操作 `praxic`
- `can.ts` 操作权限
- `doc.ts` 数据组合 `document`
- `que.ts` 查询接口 `query`
- `pas.ts` 用户登陆 `pass`
- `que.ts` 查询接口 `query` `HTTP GET` 对数据组合做请求
- `pas.ts` 用户登陆 `pass` (的操作组合)
- `pre.ts` 创建操作 `pre-data` `prepare` (的操作组合)
- `put.ts` 更新操作 `put-data`(的操作组合)
- `pos.ts` 请求接口 `post` `HTTP POST` 对操作组合做请求
* `ser.ts` 服务接口 `serve`
* `tst` 测试代码 `tests`
* `ui` 图形界面 `user interface`
* `ismism.ts` 编译环境
* `cli` 命令接口 `command line interface`
- `sendsms.ts` 发送测试短信
- `bundle.ts` 编译并打包 `build and bundle`
* `src` 源代码 `source`
* `ont` 基础操作 `ontic`
- `base.ts` 进制转换
- `utc.ts` 时间格式 `Universal Time Convention`
- `crypt.ts` 签名验证 `cryptography`
- `jwt.ts` 身份验证 `JSON Web Token`
- `adm.ts` 行政区划 `administrative region`
- `json.ts` JSON数据声明
* `eid` 核心操作 `eidetic`
- `typ.ts` 数据类型声明 `type`
- `db.ts` 数据库初始化与数据操作类型声明 `database`
- `is.ts` 数据定义与检查
- `id.ts` 实体数据操作 `identity`
- `usr.ts` 用户数据操作 `user`
- `soc.ts` 俱乐部数据操作 `sociation` `social`
- `agd.ts` 活动数据操作 `agenda`
- `rec.ts` 记录数据操作 `record` - `credit` `debit` `earn`
- `msg.ts` 文章数据操作 `message` - `wsl` `lit`
- `aut.ts` 权限数据操作 `author` `authority`
* `pra` 业务操作 `praxic`
- `can.ts` 操作权限
- `doc.ts` 数据组合 `document`
- `que.ts` 查询接口 `query` `HTTP GET` 对数据组合做请求
- `pas.ts` 用户登陆 `pass` (的操作组合)
- `pre.ts` 创建操作 `pre-data` `prepare` (的操作组合)
- `put.ts` 更新操作 `put-data`(的操作组合)
- `pos.ts` 请求接口 `post` `HTTP POST` 对操作组合做请求
* `ser.ts` 服务接口 `serve`
* `tst` 测试代码 `tests`
* `ui` 图形界面 `graphical user interface`
* `index` UI声明(HTML/CSS)
- `index.html` UI入口
- `template.html` UI元素
- `style.css` UI样式
* `bind` UI定义(TS/JS)绑定服务器端与浏览器端的数据
- `bind.ts` 绑定UI入口
- `template.ts` 绑定UI元素
* `ui.ts` 打包UI `ui bundle`
* `cli` 命令接口(运行环境)(服务器端)
- `build.zsh` 构建运行环境
* `ui` 图形界面(运行环境)(浏览器端)
* `mongod.service` `mongod.yaml` 数据库配置(服务器端)
* `nginx.conf` 端口配置(服务器端)

## [系列视频](https://space.bilibili.com/483417795/video)

0 comments on commit ca36e75

Please sign in to comment.