mvframe 1.0.68 → 1.0.69

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/README.cn.md CHANGED
@@ -163,7 +163,7 @@ yarn build
163
163
 
164
164
  ## 命令行:项目目录雏形(推荐)
165
165
 
166
- 在**空目录或已有 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),并复制 **`/.cursor/rules/*.mdc`**(与 mvframe 仓库内 Cursor 规则一致)。若不存在则附带 `index.html` 与 `vite.config.js`。会**合并** `package.json` 的 `dependencies` / `devDependencies`(与 Vite 模板一致;**同名包保留你原有版本**),最后请执行 **`yarn install`**;加 `--no-package-json` 可不改动 `package.json`。
166
+ 在**空目录或已有 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),并复制 **`/.cursor/rules/*.mdc`**(与 mvframe 仓库内 Cursor 规则一致)。若不存在则附带 `index.html` 与 `vite.config.js`。会**合并** `package.json` 的 `scripts` / `dependencies` / `devDependencies`(与 Vite 模板一致;**同名脚本和包保留你原有值**),并自动执行 **`yarn install`**,最后请执行 **`yarn dev`**;加 `--no-package-json` 可不改动 `package.json` 且跳过安装。
167
167
 
168
168
  ```bash
169
169
  cd /path/to/your-app
package/README.md CHANGED
@@ -163,7 +163,7 @@ Production uses **library mode** with entry `src/index.js` and obfuscation-relat
163
163
 
164
164
  ## CLI: project skeleton
165
165
 
166
- 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 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** `dependencies` / `devDependencies` into `package.json` (existing versions win for shared keys); use `--no-package-json` to skip. Then run **`yarn install`**.
166
+ 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 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), then runs **`yarn install`**; use `--no-package-json` to skip package changes and install. Then run **`yarn dev`**.
167
167
 
168
168
  ```bash
169
169
  cd /path/to/your-app
package/dist/vendor.js CHANGED
@@ -9320,7 +9320,7 @@ const gi = {
9320
9320
  }, Ai = {
9321
9321
  name: "Matt Avias Frame",
9322
9322
  copyright: "©2026",
9323
- version: "1.0.68",
9323
+ version: "1.0.69",
9324
9324
  author: "Matt Avias",
9325
9325
  date: "2026-02-26",
9326
9326
  /** 默认语言 key,与 `$getLang`、localStorage `lang` 一致;业务在 app.use(mvframe, { config }) 里覆盖 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mvframe",
3
3
  "packageManager": "yarn@4.4.1",
4
- "version": "1.0.68",
4
+ "version": "1.0.69",
5
5
  "author": "matt avis",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
File without changes
@@ -13,6 +13,7 @@
13
13
 
14
14
  const fs = require("fs");
15
15
  const path = require("path");
16
+ const { execFileSync } = require("child_process");
16
17
 
17
18
  const FORCE = process.argv.includes("--force");
18
19
  const NO_PKG = process.argv.includes("--no-package-json");
@@ -75,9 +76,16 @@ const SCAFFOLD_DEV_DEPENDENCIES = {
75
76
  "unplugin-auto-import": "^0.18.2",
76
77
  };
77
78
 
79
+ const SCAFFOLD_SCRIPTS = {
80
+ dev: "vite",
81
+ build: "vite build",
82
+ preview: "vite preview",
83
+ };
84
+
78
85
  /**
79
- * 合并 package.json:保留原有字段与其它依赖;仅补足脚手架所需包。
86
+ * 合并 package.json:保留原有字段与其它依赖;仅补足脚手架所需包与启动脚本。
80
87
  * 同名依赖以目标项目已有版本为准({ ...建议, ...已有 })。
88
+ * 同名 scripts 也以目标项目已有命令为准,避免覆盖自定义 dev/build。
81
89
  */
82
90
  function mergePackageJson(projectRoot) {
83
91
  const pkgPath = path.join(projectRoot, "package.json");
@@ -96,15 +104,15 @@ function mergePackageJson(projectRoot) {
96
104
  version: "0.1.0",
97
105
  private: true,
98
106
  type: "module",
99
- scripts: {
100
- dev: "vite",
101
- build: "vite build",
102
- preview: "vite preview",
103
- },
107
+ scripts: { ...SCAFFOLD_SCRIPTS },
104
108
  };
105
109
  console.log("[mvframe-init] 新建 package.json");
106
110
  }
107
111
 
112
+ pkg.scripts = {
113
+ ...SCAFFOLD_SCRIPTS,
114
+ ...(pkg.scripts && typeof pkg.scripts === "object" ? pkg.scripts : {}),
115
+ };
108
116
  pkg.dependencies = {
109
117
  ...SCAFFOLD_DEPENDENCIES,
110
118
  ...(pkg.dependencies && typeof pkg.dependencies === "object" ? pkg.dependencies : {}),
@@ -117,7 +125,17 @@ function mergePackageJson(projectRoot) {
117
125
  };
118
126
 
119
127
  fs.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
120
- console.log("[mvframe-init] 已合并 package.json 的 dependencies / devDependencies(已有版本优先)");
128
+ console.log(
129
+ "[mvframe-init] 已合并 package.json 的 scripts / dependencies / devDependencies(已有值优先)",
130
+ );
131
+ }
132
+
133
+ function installDependencies(projectRoot) {
134
+ console.log("[mvframe-init] 执行 yarn install");
135
+ execFileSync("yarn", ["install"], {
136
+ cwd: projectRoot,
137
+ stdio: "inherit",
138
+ });
121
139
  }
122
140
 
123
141
  function main() {
@@ -718,10 +736,10 @@ export default defineConfig({
718
736
 
719
737
  ## 依赖
720
738
 
721
- 初始化脚本会**合并**(不整文件覆盖)\`package.json\` 的 \`dependencies\` / \`devDependencies\`:**已声明的包保留你的版本号**,仅补上缺失项。然后执行:
739
+ 初始化脚本会**合并**(不整文件覆盖)\`package.json\` 的 \`scripts\` / \`dependencies\` / \`devDependencies\`:**已声明的脚本和包保留你的原值**,仅补上缺失项,并自动执行 \`yarn install\`。然后执行:
722
740
 
723
741
  \`\`\`bash
724
- yarn install
742
+ yarn dev
725
743
  \`\`\`
726
744
 
727
745
  若需跳过对 \`package.json\` 的修改:\`node scripts/scaffold-app.js --no-package-json\`。
@@ -793,11 +811,10 @@ yarn exec mvframe-install-cursor-skill
793
811
 
794
812
  if (!NO_PKG) {
795
813
  mergePackageJson(target);
814
+ installDependencies(target);
796
815
  }
797
816
 
798
- console.log(
799
- "[mvframe-init] 完成。请阅读 MVFRAME-SCAFFOLD.md 并在项目根执行 yarn install(或 npm install)。",
800
- );
817
+ console.log("[mvframe-init] 完成。请阅读 MVFRAME-SCAFFOLD.md 并在项目根执行 yarn dev。");
801
818
  }
802
819
 
803
820
  main();