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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Run Vite
|
|
3
|
+
* Run Vite, optionally with the MVFrame DingTalk notify service.
|
|
4
4
|
* This mirrors `mvframe-b`: the package owns the command, the host may opt in
|
|
5
5
|
* with `yarn exec mvframe-d` or a local script.
|
|
6
6
|
*/
|
|
@@ -10,13 +10,29 @@ const path = require("path");
|
|
|
10
10
|
const children = new Set();
|
|
11
11
|
let shuttingDown = false;
|
|
12
12
|
|
|
13
|
+
function parseArgs(argv) {
|
|
14
|
+
const notifyArgs = [];
|
|
15
|
+
let shouldStartNotify = false;
|
|
16
|
+
|
|
17
|
+
for (const arg of argv) {
|
|
18
|
+
if (arg === "-n" || arg === "--notify") {
|
|
19
|
+
shouldStartNotify = true;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
notifyArgs.push(arg);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return { notifyArgs, shouldStartNotify };
|
|
26
|
+
}
|
|
27
|
+
|
|
13
28
|
function spawnChild(name, command, args, options = {}) {
|
|
29
|
+
const { optional = false, ...spawnOptions } = options;
|
|
14
30
|
const child = spawn(command, args, {
|
|
15
31
|
cwd: process.cwd(),
|
|
16
32
|
env: process.env,
|
|
17
33
|
stdio: "inherit",
|
|
18
34
|
shell: false,
|
|
19
|
-
...
|
|
35
|
+
...spawnOptions,
|
|
20
36
|
});
|
|
21
37
|
|
|
22
38
|
children.add(child);
|
|
@@ -24,13 +40,28 @@ function spawnChild(name, command, args, options = {}) {
|
|
|
24
40
|
child.on("exit", (code, signal) => {
|
|
25
41
|
children.delete(child);
|
|
26
42
|
if (shuttingDown) return;
|
|
43
|
+
|
|
44
|
+
if (optional) {
|
|
45
|
+
if (code !== 0) {
|
|
46
|
+
console.error(`[mvframe-d] ${name} exited with ${signal || code}; vite will keep running`);
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
27
51
|
if (code !== 0) {
|
|
28
52
|
console.error(`[mvframe-d] ${name} exited with ${signal || code}`);
|
|
29
53
|
shutdown(code || 1);
|
|
54
|
+
return;
|
|
30
55
|
}
|
|
56
|
+
shutdown(0);
|
|
31
57
|
});
|
|
32
58
|
|
|
33
59
|
child.on("error", (error) => {
|
|
60
|
+
if (optional) {
|
|
61
|
+
children.delete(child);
|
|
62
|
+
console.error(`[mvframe-d] failed to start ${name}: ${error.message}; vite will keep running`);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
34
65
|
console.error(`[mvframe-d] failed to start ${name}: ${error.message}`);
|
|
35
66
|
shutdown(1);
|
|
36
67
|
});
|
|
@@ -52,9 +83,14 @@ function shutdown(code = 0) {
|
|
|
52
83
|
process.on("SIGINT", () => shutdown(0));
|
|
53
84
|
process.on("SIGTERM", () => shutdown(0));
|
|
54
85
|
|
|
55
|
-
const notifyArgs = process.argv.slice(2);
|
|
86
|
+
const { notifyArgs, shouldStartNotify } = parseArgs(process.argv.slice(2));
|
|
56
87
|
const notifyScript = path.join(__dirname, "notify-server.js");
|
|
57
88
|
const viteScript = path.join(__dirname, "dev-vite-server.js");
|
|
58
89
|
|
|
59
|
-
|
|
90
|
+
if (shouldStartNotify) {
|
|
91
|
+
spawnChild("notify", process.execPath, [notifyScript, ...notifyArgs], {
|
|
92
|
+
optional: true,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
60
96
|
spawnChild("vite", process.execPath, [viteScript]);
|
|
@@ -63,9 +63,10 @@ ${getSharedStyleRulesForCodex()}
|
|
|
63
63
|
|
|
64
64
|
## 全局方法
|
|
65
65
|
|
|
66
|
-
- 优先使用 MVFrame 全局方法,不要重复 import 或本地封装等价 helper:\`globalThis.$d\`、\`$fa\`、\`$fu\`、\`$pm\`、\`$db\`、\`$copy\`、\`$deepClone\`、\`$getLang\`、\`$getImg\`、\`$sc\`、\`$c.info\`。
|
|
66
|
+
- 优先使用 MVFrame 全局方法,不要重复 import 或本地封装等价 helper:\`globalThis.$d\`、\`$l\`、\`$fa\`、\`$fu\`、\`$pm\`、\`$db\`、\`$copy\`、\`$deepClone\`、\`$getLang\`、\`$getImg\`、\`$sc\`、\`$c.info\`。
|
|
67
67
|
- 在模板里,如果这些方法已经通过 Vue globalProperties 注入,直接调用即可。
|
|
68
68
|
- 对普通 JS 模块,优先使用 \`globalThis.$xxx\`;只有确实需要显式 import 时,再使用 MVFrame 的子路径导出。
|
|
69
|
+
- 多语言变量统一使用 \`$l("helloUser", { name: userName })\`,字典文案写作 \`"Hello {name}"\`;变量名仅使用字母、数字、下划线、点、短横线或 \`$\`,缺失变量会保留原 \`{name}\` 占位。
|
|
69
70
|
|
|
70
71
|
## 路由、Store 与 Maps
|
|
71
72
|
|
package/scripts/scaffold-app.js
CHANGED
|
@@ -902,7 +902,7 @@ yarn dev
|
|
|
902
902
|
如需同时启动 Vite 与 MVFrame 钉钉通知服务,可显式执行框架命令(与 \`mvframe-b\` 类似由 MVFrame 包提供,不会自动覆盖宿主脚本):
|
|
903
903
|
|
|
904
904
|
\`\`\`bash
|
|
905
|
-
yarn exec mvframe-d
|
|
905
|
+
yarn exec mvframe-d -n
|
|
906
906
|
\`\`\`
|
|
907
907
|
|
|
908
908
|
若需跳过对 \`package.json\` 的修改:\`node scripts/scaffold-app.js --no-package-json\` 或 \`node scripts/scaffold-app.js -n\`。
|
|
@@ -1007,7 +1007,7 @@ yarn exec mvframe-notify
|
|
|
1007
1007
|
同时启动 Vite 和通知服务:
|
|
1008
1008
|
|
|
1009
1009
|
\`\`\`bash
|
|
1010
|
-
yarn exec mvframe-d
|
|
1010
|
+
yarn exec mvframe-d -n
|
|
1011
1011
|
\`\`\`
|
|
1012
1012
|
|
|
1013
1013
|
前端发送:
|