mvframe 1.1.16 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/rules/util.mdc +2 -0
- package/README.cn.md +8 -3
- package/README.md +5 -2
- package/dist/composition.js +201 -203
- package/dist/css/cpt.css +1 -1
- package/dist/vendor.js +862 -859
- package/package.json +1 -1
- package/scripts/dev-with-notify.js +40 -4
- package/scripts/install-codex-agents.js +2 -1
- package/scripts/scaffold-app.js +2 -2
package/.cursor/rules/util.mdc
CHANGED
|
@@ -19,6 +19,7 @@ alwaysApply: true
|
|
|
19
19
|
| 方法 | 用途 |
|
|
20
20
|
|------|------|
|
|
21
21
|
| `$getImg(url)` | 获取图片 URL,支持相对路径和 `/` 开头绝对路径 |
|
|
22
|
+
| `$l(key, vars?)` | 多语言文案;`vars` 支持 `{name}` 变量占位替换 |
|
|
22
23
|
| `$getLang()` | 获取当前语言 |
|
|
23
24
|
| `$d` | **dayjs**:`globalThis.$d` 与默认导出一致;`$d()`、`$d(ts)`、`$d().format(...)`、`$d().add(n, 'day')` 等,勿在业务中重复 `import dayjs`(插件仅在应用入口统一 `extend`) |
|
|
24
25
|
| `$md5(v)` | 提取数字并拼接(简易 md5) |
|
|
@@ -46,6 +47,7 @@ alwaysApply: true
|
|
|
46
47
|
## 使用建议
|
|
47
48
|
|
|
48
49
|
- 直接调用全局方法即可,无需在业务代码中 import util
|
|
50
|
+
- 多语言变量统一使用 `$l("helloUser", { name: userName })`,字典文案写作 `"Hello {name}"`;变量名仅使用字母、数字、下划线、点、短横线或 `$`,缺失变量会保留原 `{name}` 占位
|
|
49
51
|
- 新增工具方法时,应挂载到 `globalThis` 并补充到本 rules
|
|
50
52
|
|
|
51
53
|
## 全局封装方法的注释规范
|
package/README.cn.md
CHANGED
|
@@ -189,12 +189,17 @@ yarn notify
|
|
|
189
189
|
# 或发布包命令
|
|
190
190
|
yarn exec mvframe-notify
|
|
191
191
|
|
|
192
|
-
#
|
|
192
|
+
# 启动 MVFrame 封装的 Vite dev
|
|
193
193
|
yarn d
|
|
194
194
|
# 或发布包命令
|
|
195
195
|
yarn exec mvframe-d
|
|
196
|
+
|
|
197
|
+
# 同时启动 Vite dev 与通知服务
|
|
198
|
+
yarn exec mvframe-d -n
|
|
196
199
|
```
|
|
197
200
|
|
|
201
|
+
`mvframe-d` 默认只启动封装后的 Vite dev server;追加 `-n` / `--notify` 时才启动通知服务。通知服务启动失败只打印异常,不会停止 Vite。
|
|
202
|
+
|
|
198
203
|
服务读取宿主项目根目录的 `.env.mvframe-notify`(可用 `--env` 指定):
|
|
199
204
|
|
|
200
205
|
```env
|
|
@@ -265,7 +270,7 @@ await notify("需要发送到钉钉的消息");
|
|
|
265
270
|
|
|
266
271
|
## 命令行:项目目录雏形(推荐)
|
|
267
272
|
|
|
268
|
-
在**空目录或已有 Vite 工程根目录**执行,生成 `src/views`、`src/component`、`src/api`、`src/assets/img`、`src/assets/style`、`src/router`、`src/pinia/chip`、`src/config` 及示例 `main.js` / `App.vue`(已 `app.use(mvframe, …)` 挂好路由、Pinia `storeChips`、config,并写入 `components.async: ["VTable"]`),同时写入/更新宿主项目 **`AGENTS.md`** 的 MVFrame Codex 规则,其中包含 **每次 AI 完成开发后执行 `yarn exec mvframe-notify --once --message "..."` 发送完成通知** 的要求,并复制 **`/.cursor/rules/*.mdc`**(与 mvframe 仓库内 Cursor 规则一致)。若不存在则附带 `index.html` 与 `vite.config.js`。会**合并** `package.json` 的 `scripts` / `dependencies` / `devDependencies`(与 Vite 模板一致;**同名脚本和包保留你原有值**),初始化 `.env.mvframe-notify.example` / `.env.local.example` 与 `config.notify`,并自动执行 **`yarn install`**,最后请执行 **`yarn dev`**;需要同时启动通知服务时显式执行 **`yarn exec mvframe-d`**。加 `--no-package-json` 可不改动 `package.json` 且跳过安装。
|
|
273
|
+
在**空目录或已有 Vite 工程根目录**执行,生成 `src/views`、`src/component`、`src/api`、`src/assets/img`、`src/assets/style`、`src/router`、`src/pinia/chip`、`src/config` 及示例 `main.js` / `App.vue`(已 `app.use(mvframe, …)` 挂好路由、Pinia `storeChips`、config,并写入 `components.async: ["VTable"]`),同时写入/更新宿主项目 **`AGENTS.md`** 的 MVFrame Codex 规则,其中包含 **每次 AI 完成开发后执行 `yarn exec mvframe-notify --once --message "..."` 发送完成通知** 的要求,并复制 **`/.cursor/rules/*.mdc`**(与 mvframe 仓库内 Cursor 规则一致)。若不存在则附带 `index.html` 与 `vite.config.js`。会**合并** `package.json` 的 `scripts` / `dependencies` / `devDependencies`(与 Vite 模板一致;**同名脚本和包保留你原有值**),初始化 `.env.mvframe-notify.example` / `.env.local.example` 与 `config.notify`,并自动执行 **`yarn install`**,最后请执行 **`yarn dev`**;需要同时启动通知服务时显式执行 **`yarn exec mvframe-d -n`**。加 `--no-package-json` 可不改动 `package.json` 且跳过安装。
|
|
269
274
|
|
|
270
275
|
```bash
|
|
271
276
|
cd /path/to/your-app
|
|
@@ -353,7 +358,7 @@ yarn exec mvframe-install-cursor-skill
|
|
|
353
358
|
|
|
354
359
|
- 新增 `mvframe-notify`:只支持钉钉机器人的本地通知服务,钉钉 webhook / secret 留在 Node 环境变量。
|
|
355
360
|
- 新增 `mvframe/notify` 与全局 `$notify`:前端通过 `config.notify` 请求本地通知服务。
|
|
356
|
-
- 新增框架命令 `yarn d` / `mvframe-d
|
|
361
|
+
- 新增框架命令 `yarn d` / `mvframe-d`:启动 MVFrame 封装的 Vite dev,追加 `-n` 时同时启动钉钉通知服务。
|
|
357
362
|
- `mvframe-init-app` 初始化 `config.notify`、带测试钉钉机器人的 `.env.mvframe-notify` / `.env.mvframe-notify.example` 与 `.env.local.example`,不自动覆盖宿主 `d` 脚本。
|
|
358
363
|
- `VTable` 默认使用异步全局注册;`mvframe-init-app` 会在 `main.js` 写入 `components.async: ["VTable"]`。
|
|
359
364
|
|
package/README.md
CHANGED
|
@@ -189,8 +189,11 @@ yarn exec mvframe-notify
|
|
|
189
189
|
|
|
190
190
|
yarn d
|
|
191
191
|
yarn exec mvframe-d
|
|
192
|
+
yarn exec mvframe-d -n
|
|
192
193
|
```
|
|
193
194
|
|
|
195
|
+
`mvframe-d` starts the wrapped Vite dev server only. Add `-n` / `--notify` when the notify service should also run; notify startup failures are reported without stopping Vite.
|
|
196
|
+
|
|
194
197
|
The service reads `.env.mvframe-notify` from the host root:
|
|
195
198
|
|
|
196
199
|
```env
|
|
@@ -252,7 +255,7 @@ The floating label shell is implemented centrally in `src/style/chip/element.scs
|
|
|
252
255
|
|
|
253
256
|
## CLI: project skeleton
|
|
254
257
|
|
|
255
|
-
From an **empty folder or existing Vite root**, generates `src/views`, `src/component`, `src/api`, `src/assets/img`, `src/assets/style`, `src/router`, `src/pinia/chip`, `src/config`, plus starter `main.js` / `App.vue` with `app.use(mvframe, …)` (routes, Pinia `storeChips`, config, and `components.async: ["VTable"]`). It also writes/updates host-project **`AGENTS.md`** with MVFrame Codex rules, including a requirement that AI send a completion message with `yarn exec mvframe-notify --once --message "..."` after each finished development task, and copies **`/.cursor/rules/*.mdc`** from the package (same as this repo’s Cursor rules). Adds `index.html` and `vite.config.js` only if missing (use `--force` to overwrite). **Merges** `scripts` / `dependencies` / `devDependencies` into `package.json` (existing values win for shared keys), initializes `.env.mvframe-notify.example` / `.env.local.example` and `config.notify`, then runs **`yarn install`**; use `--no-package-json` to skip package changes and install. Then run **`yarn dev`** or explicitly run **`yarn exec mvframe-d`** to start Vite with the notify service.
|
|
258
|
+
From an **empty folder or existing Vite root**, generates `src/views`, `src/component`, `src/api`, `src/assets/img`, `src/assets/style`, `src/router`, `src/pinia/chip`, `src/config`, plus starter `main.js` / `App.vue` with `app.use(mvframe, …)` (routes, Pinia `storeChips`, config, and `components.async: ["VTable"]`). It also writes/updates host-project **`AGENTS.md`** with MVFrame Codex rules, including a requirement that AI send a completion message with `yarn exec mvframe-notify --once --message "..."` after each finished development task, and copies **`/.cursor/rules/*.mdc`** from the package (same as this repo’s Cursor rules). Adds `index.html` and `vite.config.js` only if missing (use `--force` to overwrite). **Merges** `scripts` / `dependencies` / `devDependencies` into `package.json` (existing values win for shared keys), initializes `.env.mvframe-notify.example` / `.env.local.example` and `config.notify`, then runs **`yarn install`**; use `--no-package-json` to skip package changes and install. Then run **`yarn dev`** or explicitly run **`yarn exec mvframe-d -n`** to start Vite with the notify service.
|
|
256
259
|
|
|
257
260
|
```bash
|
|
258
261
|
cd /path/to/your-app
|
|
@@ -338,7 +341,7 @@ Default target is **`./.cursor/skills/mvframe-app-init`** under the current work
|
|
|
338
341
|
|
|
339
342
|
- Added `mvframe-notify`, a DingTalk-only local Node notification service.
|
|
340
343
|
- Added `mvframe/notify` and global `$notify` for browser calls through `config.notify`.
|
|
341
|
-
- Added framework command `yarn d` / `mvframe-d` to run
|
|
344
|
+
- Added framework command `yarn d` / `mvframe-d` to run the MVFrame-wrapped Vite dev server; add `-n` to start the notify service too.
|
|
342
345
|
- `mvframe-init-app` now initializes `config.notify`, `.env.mvframe-notify` / `.env.mvframe-notify.example` with the MVFrame test DingTalk robot, and `.env.local.example` without forcing host `d` scripts.
|
|
343
346
|
- `VTable` now uses async global registration by default; `mvframe-init-app` writes `components.async: ["VTable"]` in `main.js`.
|
|
344
347
|
|