create-vite-vue 1.6.0 → 1.6.1

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.md CHANGED
@@ -232,6 +232,34 @@ console.log(route.params.id)
232
232
  console.log(route.params.name)
233
233
  ```
234
234
 
235
+ ### ✅ meta.json 自动注入路由
236
+
237
+ 在每个页面目录下可以新增一个 `meta.json` 文件:
238
+
239
+ ```text
240
+ src/views/home/
241
+ ├─ index.vue
242
+ └─ meta.json
243
+ ```
244
+
245
+ #### 示例:
246
+
247
+ ```json
248
+ {
249
+ "name": "首页",
250
+ "orderMenu": 1
251
+ }
252
+ ```
253
+
254
+ 👉 脚手架会自动读取该文件,并注入到对应路由的 `meta` 属性中:
255
+
256
+ ```js
257
+ route.meta = {
258
+ name: "首页",
259
+ orderMenu: 1
260
+ }
261
+ ```
262
+
235
263
  ---
236
264
 
237
265
  ### 4️⃣ 页面内容与样式
package/bin/index.js CHANGED
@@ -282,6 +282,20 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
282
282
  .replace('__PROJECT_NAME__', projectName)
283
283
  .replace('__OPTIONAL_DEP__', depsStr)
284
284
 
285
+ // ⭐ 新增逻辑
286
+ let pkgObj = JSON.parse(pkg)
287
+
288
+ if(pkgManager === 'pnpm' && features.ui.includes('vant')) {
289
+ pkgObj.pnpm = {
290
+ overrides: {
291
+ "@vant/use": "^1.0.0",
292
+ "@vant/popperjs": "^1.0.0"
293
+ }
294
+ }
295
+ }
296
+
297
+ pkg = JSON.stringify(pkgObj, null, 2)
298
+
285
299
  fs.writeFileSync(path.join(targetDir, 'package.json'), pkg)
286
300
  fs.unlinkSync(pkgTpl)
287
301
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vite-vue",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "基于Vite+Vue3创建基础项目模板",
5
5
  "main": "index.js",
6
6
  "author": "YwaiX",
@@ -232,6 +232,34 @@ console.log(route.params.id)
232
232
  console.log(route.params.name)
233
233
  ```
234
234
 
235
+ ### ✅ meta.json 自动注入路由
236
+
237
+ 在每个页面目录下可以新增一个 `meta.json` 文件:
238
+
239
+ ```text
240
+ src/views/home/
241
+ ├─ index.vue
242
+ └─ meta.json
243
+ ```
244
+
245
+ #### 示例:
246
+
247
+ ```json
248
+ {
249
+ "name": "首页",
250
+ "orderMenu": 1
251
+ }
252
+ ```
253
+
254
+ 👉 脚手架会自动读取该文件,并注入到对应路由的 `meta` 属性中:
255
+
256
+ ```js
257
+ route.meta = {
258
+ name: "首页",
259
+ orderMenu: 1
260
+ }
261
+ ```
262
+
235
263
  ---
236
264
 
237
265
  ### 4️⃣ 页面内容与样式
@@ -37,7 +37,7 @@
37
37
  🧰 VueUse · Lodash · Day.js
38
38
  🎨 Tailwind CSS
39
39
  🔔 Mitt
40
- 🛡️ mkcert (本地 HTTPS)
40
+ 🛡️ mkcert (本地 HTTPS)
41
41
 
42
42
  ---
43
43
 
@@ -232,6 +232,34 @@ console.log(route.params.id)
232
232
  console.log(route.params.name)
233
233
  ```
234
234
 
235
+ ### ✅ meta.json 自动注入路由
236
+
237
+ 在每个页面目录下可以新增一个 `meta.json` 文件:
238
+
239
+ ```text
240
+ src/views/home/
241
+ ├─ index.vue
242
+ └─ meta.json
243
+ ```
244
+
245
+ #### 示例:
246
+
247
+ ```json
248
+ {
249
+ "name": "首页",
250
+ "orderMenu": 1
251
+ }
252
+ ```
253
+
254
+ 👉 脚手架会自动读取该文件,并注入到对应路由的 `meta` 属性中:
255
+
256
+ ```js
257
+ route.meta = {
258
+ name: "首页",
259
+ orderMenu: 1
260
+ }
261
+ ```
262
+
235
263
  ---
236
264
 
237
265
  ### 4️⃣ 页面内容与样式