docs: 调整文档
This commit is contained in:
parent
eaa2ad1e89
commit
8899018a4e
|
@ -17,7 +17,6 @@ module.exports = {
|
||||||
segment: true
|
segment: true
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'eqeqeq': ['off'],
|
|
||||||
'prefer-const': ['off'],
|
'prefer-const': ['off'],
|
||||||
'arrow-body-style': 'off'
|
'arrow-body-style': 'off'
|
||||||
}
|
}
|
||||||
|
|
141
README.md
141
README.md
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
推荐使用`18.18.2`版本,如果系统不支持,最低要求`16.14.0`,这是新版`puppeteer`的限制
|
推荐使用`18.18.2`版本,如果系统不支持,最低要求`16.14.0`,这是新版`puppeteer`的限制
|
||||||
|
|
||||||
|
[!点击阅读Miao-Yunzai文档了解更多](https://ningmengchongshui.github.io/Miao-Yunzai-Docs/)
|
||||||
|
|
||||||
## 使用教程
|
## 使用教程
|
||||||
|
|
||||||
- 安装源码
|
- 安装源码
|
||||||
|
@ -47,7 +49,7 @@ npm run app
|
||||||
- 重新登录
|
- 重新登录
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run app login
|
npm run login
|
||||||
```
|
```
|
||||||
|
|
||||||
- 进程托管
|
- 进程托管
|
||||||
|
@ -62,133 +64,12 @@ npm run start
|
||||||
npm run kill
|
npm run kill
|
||||||
```
|
```
|
||||||
|
|
||||||
## 新特性
|
## 致谢
|
||||||
|
|
||||||
支持TS、TSX环境,提供Miao-Yunzai完全的类型声明及其开发文档。
|
| Nickname | Contribution |
|
||||||
|
| :-----------------------------------------------------------: | -------------------- |
|
||||||
- 消息回调
|
| [Yunzai v3.0](https://gitee.com/le-niao/Yunzai-Bot) | 乐神的Yunzai-Bot V3 |
|
||||||
|
| [GardenHamster](https://github.com/GardenHamster/GenshinPray) | 模拟抽卡背景素材来源 |
|
||||||
[查看 开发示例](./example/apps.ts)
|
| [西风驿站](https://bbs.mihoyo.com/ys/collection/839181) | 角色攻略图来源 |
|
||||||
|
| [米游社友人A](https://bbs.mihoyo.com/ys/collection/428421) | 角色突破素材图来源 |
|
||||||
- 图片组件
|
| [icqq](https://github.com/icqqjs/icqq) | ICQQ |
|
||||||
|
|
||||||
你无需再写原生的html,React将为你进行组件和管理
|
|
||||||
|
|
||||||
[学习 React.js](https://react.docschina.org/)
|
|
||||||
|
|
||||||
你无需再写原生从css !
|
|
||||||
|
|
||||||
tailwindcss将识别plugins目录下的tsx和jsx文件
|
|
||||||
|
|
||||||
为你自动生成css , 存放在`./public/output.css`
|
|
||||||
|
|
||||||
[学习 tailwindcss](https://www.tailwindcss.cn/)
|
|
||||||
|
|
||||||
- 测试生成HTML
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm run css
|
|
||||||
npx ts-node ./example/index.ts
|
|
||||||
```
|
|
||||||
|
|
||||||
> 插件间浏览器都将独立控制
|
|
||||||
|
|
||||||
[查看 开发示例](./example/index.tsx)
|
|
||||||
|
|
||||||
- 热开发图片
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm run image
|
|
||||||
```
|
|
||||||
|
|
||||||
[查看 配置示例](./example/routes.tsx)
|
|
||||||
|
|
||||||
## 生成开发文档
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm run docs
|
|
||||||
```
|
|
||||||
|
|
||||||
浏览器打开文件`docs/index.html`
|
|
||||||
|
|
||||||
## 关于lib
|
|
||||||
|
|
||||||
将在未来逐渐放弃,在版本发布后,开发者需要有意识的对此变化做出调整.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// 已废弃
|
|
||||||
--lib / puppeteer
|
|
||||||
// 无扩展性,计划废弃
|
|
||||||
--lib / renderer
|
|
||||||
// 非机器人框架的核心处理代码
|
|
||||||
// 消耗服务器内存,无扩展性,计划废弃
|
|
||||||
--lib / tools / web.js / test.js / log.js / ksr.js
|
|
||||||
// 计划废弃
|
|
||||||
--renderers
|
|
||||||
|
|
||||||
// 其他内容逐步优化。。。
|
|
||||||
```
|
|
||||||
|
|
||||||
# 开发者需知
|
|
||||||
|
|
||||||
- 提交
|
|
||||||
|
|
||||||
```ts
|
|
||||||
/**
|
|
||||||
* feature:新功能
|
|
||||||
* update:更新某功能
|
|
||||||
* fix:修补某功能
|
|
||||||
* refactor:重构某个功能
|
|
||||||
* optimize: 优化构建工具或运行时性能
|
|
||||||
* style:仅样式改动
|
|
||||||
* docs:仅文档新增/改动
|
|
||||||
* chore:构建过程或辅助工具的变动
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
|
|
||||||
- 注释风格
|
|
||||||
|
|
||||||
```ts
|
|
||||||
/**
|
|
||||||
* 返回false
|
|
||||||
* @param T 任意字符串
|
|
||||||
* @returns false
|
|
||||||
*/
|
|
||||||
function getTest(T: string) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
- 命名风格
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// 获得test值
|
|
||||||
function getTest(T: string) {}
|
|
||||||
// 设置
|
|
||||||
function setTest(T: string) {}
|
|
||||||
// 删除
|
|
||||||
function delTest(T: string) {}
|
|
||||||
// 获取某数据依据为id
|
|
||||||
function getDataById(T: string) {}
|
|
||||||
|
|
||||||
// 系统常量
|
|
||||||
const ENV_TEST = 'dev'
|
|
||||||
|
|
||||||
// 局域常量
|
|
||||||
const MyName = 'yunzai'
|
|
||||||
|
|
||||||
// 可修改变量
|
|
||||||
let values = ''
|
|
||||||
|
|
||||||
// 禁止使用 var values = ''
|
|
||||||
|
|
||||||
// 声明数组
|
|
||||||
const Arr = []
|
|
||||||
|
|
||||||
// 不推荐 new
|
|
||||||
|
|
||||||
// 声明对象
|
|
||||||
const Obj = {}
|
|
||||||
|
|
||||||
// 不推荐new
|
|
||||||
```
|
|
||||||
|
|
18
deploy.sh
18
deploy.sh
|
@ -1,18 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
# 确保脚本抛出遇到的错误
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# 生成静态文件
|
|
||||||
|
|
||||||
npm run docs
|
|
||||||
|
|
||||||
# 进入生成的文件夹
|
|
||||||
|
|
||||||
cd docs/
|
|
||||||
|
|
||||||
git init
|
|
||||||
git add -A
|
|
||||||
git commit -m 'add'
|
|
||||||
|
|
||||||
git push -f git@github.com:yoimiya-kokomi/Miao-Yunzai.git master:docs
|
|
|
@ -1,7 +0,0 @@
|
||||||
import { Messages } from '../src/core/index.js'
|
|
||||||
const message = new Messages({
|
|
||||||
priority: 9000
|
|
||||||
})
|
|
||||||
message.response(/^你好/, async e => {
|
|
||||||
e.reply('你好')
|
|
||||||
})
|
|
|
@ -1,12 +0,0 @@
|
||||||
import React from 'react'
|
|
||||||
export type DataType = {
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
export type PropsType = {
|
|
||||||
data: DataType
|
|
||||||
}
|
|
||||||
export default function App({ data }: PropsType) {
|
|
||||||
return (
|
|
||||||
<div className="text-red-500 p-2 text-xl m-80">Hello, {data.name}!</div>
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
import React from 'react'
|
|
||||||
import { Component, Puppeteer } from '../src/utils/index.js'
|
|
||||||
import Hello, { type DataType } from './hello.tsx'
|
|
||||||
export const Com = new Component()
|
|
||||||
export const Pup = new Puppeteer()
|
|
||||||
export class Image {
|
|
||||||
constructor() {
|
|
||||||
// 启动
|
|
||||||
Pup.start()
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 为指定用户生成html 生成指定数据下的html文件
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
getHelloComponent(uid: number, data: DataType) {
|
|
||||||
// 生成 html 地址 或 html字符串
|
|
||||||
const Address = Com.create(<Hello data={data} />, {
|
|
||||||
/**
|
|
||||||
* 注意,不设置json_dir时,
|
|
||||||
* html_head路径应该是../public/output.css
|
|
||||||
* 且html_head默认值路径也是../public/output.css
|
|
||||||
* 因此,不增加其他head的话,html_head和join_dir都可以省略
|
|
||||||
* { html_name: `${uid}.html`}
|
|
||||||
*/
|
|
||||||
html_head: `<link rel="stylesheet" href="../../public/output.css"></link>`,
|
|
||||||
// html/hello/uid.html
|
|
||||||
join_dir: 'hello',
|
|
||||||
html_name: `${uid}.html`
|
|
||||||
// 不生成文件,返回的将是html字符串
|
|
||||||
// file_create:false
|
|
||||||
})
|
|
||||||
return Pup.render(Address)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const imgae = new Image()
|
|
||||||
// render 是异步的,因此 此处也是异步的
|
|
||||||
await imgae.getHelloComponent(1715713638, { name: 'word' })
|
|
||||||
// e.reply(segment.buffer(img))
|
|
|
@ -1,17 +0,0 @@
|
||||||
import React from 'react'
|
|
||||||
import { type RouterType } from '../image/types.js'
|
|
||||||
import Hello from './hello.tsx'
|
|
||||||
/**
|
|
||||||
* *********
|
|
||||||
* 该应该放置于插件目录下,
|
|
||||||
* 命名为 routes.jsx
|
|
||||||
* 或 routes.tsx
|
|
||||||
* 启动热开发时,将读取该配置
|
|
||||||
* *********
|
|
||||||
*/
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: '/',
|
|
||||||
element: <Hello data={{ name: 'word' }}></Hello>
|
|
||||||
}
|
|
||||||
] as RouterType
|
|
2
index.js
2
index.js
|
@ -9,7 +9,7 @@ const argvs = argv.join(' ').replace(/(\S+\.js|\S+\.ts)/g, '')
|
||||||
*/
|
*/
|
||||||
exec(
|
exec(
|
||||||
'tailwindcss -i ./src/input.css -o ./public/output.css',
|
'tailwindcss -i ./src/input.css -o ./public/output.css',
|
||||||
(error, stdout, stderr) => {
|
(error, _, __) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
"monit": "pm2 monit",
|
"monit": "pm2 monit",
|
||||||
"pm2": "pm2",
|
"pm2": "pm2",
|
||||||
"image": "nodemon --config image/nodemon.json",
|
"image": "nodemon --config image/nodemon.json",
|
||||||
"docs": "typedoc --options typedoc.json",
|
|
||||||
"css": "tailwindcss -i ./src/input.css -o ./public/output.css",
|
"css": "tailwindcss -i ./src/input.css -o ./public/output.css",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
|
@ -77,7 +76,6 @@
|
||||||
"rollup": "^4.16.4",
|
"rollup": "^4.16.4",
|
||||||
"tailwindcss": "^3.4.3",
|
"tailwindcss": "^3.4.3",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typedoc": "^0.25.4",
|
|
||||||
"typescript": "^5.0.4"
|
"typescript": "^5.0.4"
|
||||||
},
|
},
|
||||||
"imports": {
|
"imports": {
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"entryPoints": ["./src"],
|
|
||||||
"out": "./docs"
|
|
||||||
}
|
|
Loading…
Reference in New Issue