create-weapp-vite 2.0.47 → 2.0.48

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.
Files changed (45) hide show
  1. package/dist/{chunk-UECMRNKY.js → chunk-LIWR2QXJ.js} +8 -7
  2. package/dist/cli.js +1 -1
  3. package/dist/index.js +1 -1
  4. package/package.json +1 -1
  5. package/templates/default/gitignore +1 -0
  6. package/templates/default/package.json +1 -1
  7. package/templates/default/tsconfig.app.json +1 -9
  8. package/templates/lib/gitignore +1 -0
  9. package/templates/lib/package.json +1 -1
  10. package/templates/lib/tsconfig.app.json +1 -9
  11. package/templates/tailwindcss/gitignore +1 -0
  12. package/templates/tailwindcss/package.json +1 -1
  13. package/templates/tailwindcss/tsconfig.app.json +1 -9
  14. package/templates/tdesign/gitignore +1 -0
  15. package/templates/tdesign/package.json +1 -1
  16. package/templates/tdesign/tsconfig.app.json +1 -9
  17. package/templates/vant/gitignore +1 -0
  18. package/templates/vant/package.json +1 -1
  19. package/templates/vant/tsconfig.app.json +1 -9
  20. package/templates/wevu/README.md +1 -0
  21. package/templates/wevu/auto-import-components.json +2 -2
  22. package/templates/wevu/gitignore +1 -0
  23. package/templates/wevu/package.json +1 -1
  24. package/templates/wevu/src/app.vue +49 -7
  25. package/templates/wevu/src/components/InfoPanel/index.vue +52 -0
  26. package/templates/wevu/src/components/StatusPill/index.vue +42 -0
  27. package/templates/wevu/{components.d.ts → src/components.d.ts} +4 -4
  28. package/templates/wevu/src/packageA/pages/workspace/index.vue +137 -0
  29. package/templates/wevu/src/packageB/pages/settings/index.vue +131 -0
  30. package/templates/wevu/src/pages/index/index.vue +169 -304
  31. package/templates/wevu/src/pages/overview/index.vue +149 -0
  32. package/templates/wevu/{typed-components.d.ts → src/typed-components.d.ts} +6 -9
  33. package/templates/wevu/src/typed-router.d.ts +67 -0
  34. package/templates/wevu/tsconfig.app.json +2 -14
  35. package/templates/wevu/vite.config.ts +7 -5
  36. package/templates/wevu-tdesign/gitignore +1 -0
  37. package/templates/wevu-tdesign/package.json +1 -1
  38. package/templates/wevu-tdesign/src/typed-router.d.ts +75 -0
  39. package/templates/wevu-tdesign/src/vite-env.d.ts +0 -2
  40. package/templates/wevu-tdesign/tsconfig.app.json +2 -14
  41. package/templates/wevu-tdesign/vite.config.ts +7 -0
  42. package/templates/wevu/src/components/HelloWorld/index.vue +0 -473
  43. package/templates/wevu/src/components/InfoBanner/index.vue +0 -79
  44. /package/templates/wevu-tdesign/{components.d.ts → src/components.d.ts} +0 -0
  45. /package/templates/wevu-tdesign/{typed-components.d.ts → src/typed-components.d.ts} +0 -0
@@ -0,0 +1,149 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'wevu'
3
+ import { useRoute, useRouter } from 'wevu/router'
4
+
5
+ definePageJson({
6
+ navigationBarTitleText: '运营概览',
7
+ })
8
+
9
+ const HOME_PATH = '/pages/index/index'
10
+ const WORKSPACE_PATH = '/packageA/pages/workspace/index'
11
+ const SETTINGS_PATH = '/packageB/pages/settings/index'
12
+
13
+ const route = useRoute()
14
+ const router = useRouter()
15
+
16
+ const summary = computed(() => {
17
+ return route.fullPath || `/${route.path}`
18
+ })
19
+
20
+ const focusItems = [
21
+ {
22
+ title: '项目节奏稳定',
23
+ description: '需求冻结、设计评审与联调时间线已经对齐,适合继续扩展到实际业务场景。',
24
+ },
25
+ {
26
+ title: '协作角色清晰',
27
+ description: '可在此基础上继续接入团队成员、审批流或项目动态等正式模块。',
28
+ },
29
+ {
30
+ title: '模板结构简洁',
31
+ description: '页面布局保留必要层级,既能做展示页,也能平滑承接后台工作流。',
32
+ },
33
+ ]
34
+
35
+ async function toSettings() {
36
+ await router.push(SETTINGS_PATH)
37
+ }
38
+
39
+ async function backHome() {
40
+ await router.push(HOME_PATH)
41
+ }
42
+ </script>
43
+
44
+ <template>
45
+ <view class="page">
46
+ <view class="card">
47
+ <view class="card__eyebrow">
48
+ Overview
49
+ </view>
50
+ <view class="card__title">
51
+ 运营概览
52
+ </view>
53
+ <view class="card__desc">
54
+ 用正式模板的方式承载项目状态、团队节奏和阶段重点,而不是单纯展示路由跳转能力。
55
+ </view>
56
+ <view class="card__summary">
57
+ 当前路由:{{ summary }}
58
+ </view>
59
+ </view>
60
+
61
+ <view
62
+ v-for="item in focusItems"
63
+ :key="item.title"
64
+ class="panel-wrap"
65
+ >
66
+ <InfoPanel
67
+ eyebrow="FOCUS"
68
+ :title="item.title"
69
+ :description="item.description"
70
+ />
71
+ </view>
72
+
73
+ <view class="actions">
74
+ <button class="action-btn" @tap="router.push(WORKSPACE_PATH)">
75
+ 进入项目工作台
76
+ </button>
77
+ <button class="action-btn action-btn--secondary" @tap="toSettings">
78
+ 查看系统设置
79
+ </button>
80
+ <button class="action-btn action-btn--ghost" @tap="backHome">
81
+ 返回业务门户
82
+ </button>
83
+ </view>
84
+ </view>
85
+ </template>
86
+
87
+ <style>
88
+ .page {
89
+ box-sizing: border-box;
90
+ min-height: 100vh;
91
+ padding: 30rpx;
92
+ background:
93
+ radial-gradient(circle at top left, rgb(16 185 129 / 10%), transparent 28%),
94
+ linear-gradient(180deg, #f6fbf8 0%, #edf5f1 100%);
95
+ }
96
+
97
+ .card {
98
+ padding: 32rpx 28rpx;
99
+ background: #fff;
100
+ border: 2rpx solid #d1fae5;
101
+ border-radius: 30rpx;
102
+ box-shadow: 0 16rpx 36rpx rgb(15 23 42 / 5%);
103
+ }
104
+
105
+ .card__eyebrow {
106
+ font-size: 22rpx;
107
+ font-weight: 600;
108
+ color: #0f766e;
109
+ }
110
+
111
+ .card__title {
112
+ margin-top: 10rpx;
113
+ font-size: 40rpx;
114
+ font-weight: 700;
115
+ color: #134e4a;
116
+ }
117
+
118
+ .card__desc,
119
+ .card__summary {
120
+ margin-top: 12rpx;
121
+ font-size: 24rpx;
122
+ line-height: 1.6;
123
+ color: #335c58;
124
+ }
125
+
126
+ .panel-wrap {
127
+ margin-top: 18rpx;
128
+ }
129
+
130
+ .actions {
131
+ margin-top: 10rpx;
132
+ }
133
+
134
+ .action-btn {
135
+ margin-top: 18rpx;
136
+ color: #fff;
137
+ background: #0f766e;
138
+ border-radius: 999rpx;
139
+ }
140
+
141
+ .action-btn--secondary {
142
+ background: #1d4ed8;
143
+ }
144
+
145
+ .action-btn--ghost {
146
+ color: #134e4a;
147
+ background: #d1fae5;
148
+ }
149
+ </style>
@@ -6,18 +6,15 @@
6
6
  // 由 weapp-vite 自动生成,请勿编辑。
7
7
  declare module 'weapp-vite/typed-components' {
8
8
  export interface ComponentProps {
9
- HelloWorld: {
10
- readonly compact?: boolean;
11
- readonly features?: any[];
12
- readonly highlights?: any[];
13
- readonly subtitle?: string;
14
- readonly title?: string;
15
- };
16
- InfoBanner: {
17
- readonly badge?: string;
9
+ InfoPanel: {
18
10
  readonly description?: string;
11
+ readonly eyebrow?: string;
19
12
  readonly title?: string;
20
13
  };
14
+ StatusPill: {
15
+ readonly label?: string;
16
+ readonly tone?: string;
17
+ };
21
18
  }
22
19
  export type ComponentPropName = keyof ComponentProps;
23
20
  export type ComponentProp<Name extends string> = Name extends ComponentPropName ? ComponentProps[Name] : Record<string, any>;
@@ -0,0 +1,67 @@
1
+ /* eslint-disable */
2
+ // biome-ignore lint: disable
3
+ // oxlint-disable
4
+ // ------
5
+ // 由 weapp-vite 自动生成,请勿编辑。
6
+ import 'wevu/router';
7
+
8
+ declare module 'weapp-vite/auto-routes' {
9
+ export type AutoRoutesPages = [
10
+ "pages/index/index",
11
+ "pages/overview/index"
12
+ ];
13
+ export type AutoRoutesEntries = [
14
+ "pages/index/index",
15
+ "packageA/pages/workspace/index",
16
+ "packageB/pages/settings/index",
17
+ "pages/overview/index"
18
+ ];
19
+ export type AutoRoutesSubPackages = [
20
+ {
21
+ readonly root: "packageA";
22
+ readonly pages: [
23
+ "pages/workspace/index"
24
+ ];
25
+ [k: string]: unknown;
26
+ },
27
+ {
28
+ readonly root: "packageB";
29
+ readonly pages: [
30
+ "pages/settings/index"
31
+ ];
32
+ [k: string]: unknown;
33
+ }
34
+ ];
35
+ export type AutoRoutesSubPackage = AutoRoutesSubPackages[number];
36
+ export interface AutoRoutes {
37
+ readonly pages: AutoRoutesPages;
38
+ readonly entries: AutoRoutesEntries;
39
+ readonly subPackages: AutoRoutesSubPackages;
40
+ }
41
+ export type AutoRouteEntry = AutoRoutesEntries[number];
42
+ export type AutoRoutesRelativeUrl = `./${string}` | `../${string}`;
43
+ export type AutoRoutesAbsoluteUrl<Path extends string> = Path | `/${Path}` | `${Path}?${string}` | `/${Path}?${string}`;
44
+ export type AutoRoutesUrl = AutoRoutesAbsoluteUrl<AutoRouteEntry> | AutoRoutesRelativeUrl;
45
+ export type AutoRouteNavigateOption = {
46
+ readonly url: AutoRoutesUrl;
47
+ } & Record<string, any>;
48
+ export interface AutoRoutesWxRouter {
49
+ switchTab: (option: AutoRouteNavigateOption) => unknown;
50
+ reLaunch: (option: AutoRouteNavigateOption) => unknown;
51
+ redirectTo: (option: AutoRouteNavigateOption) => unknown;
52
+ navigateTo: (option: AutoRouteNavigateOption) => unknown;
53
+ navigateBack: (option?: Record<string, any>) => unknown;
54
+ }
55
+ export const routes: AutoRoutes;
56
+ export const pages: AutoRoutesPages;
57
+ export const entries: AutoRoutesEntries;
58
+ export const subPackages: AutoRoutesSubPackages;
59
+ export const wxRouter: AutoRoutesWxRouter;
60
+ export default routes;
61
+ }
62
+
63
+ declare module 'wevu/router' {
64
+ interface WevuTypedRouterRouteMap {
65
+ entries: import('weapp-vite/auto-routes').AutoRoutesEntries[number];
66
+ }
67
+ }
@@ -17,7 +17,7 @@
17
17
  "./src/*"
18
18
  ],
19
19
  "weapp-vite/typed-components": [
20
- "./typed-components.d.ts"
20
+ "./src/typed-components.d.ts"
21
21
  ]
22
22
  },
23
23
  "resolveJsonModule": true,
@@ -46,18 +46,6 @@
46
46
  "lib": "wevu"
47
47
  },
48
48
  "include": [
49
- "src/**/*.ts",
50
- "src/**/*.tsx",
51
- "src/**/*.js",
52
- "src/**/*.jsx",
53
- "src/**/*.mts",
54
- "src/**/*.cts",
55
- "src/**/*.vue",
56
- "src/**/*.json",
57
- "src/**/*.d.ts",
58
- "types/**/*.d.ts",
59
- "env.d.ts",
60
- "components.d.ts",
61
- "typed-components.d.ts"
49
+ "src/**/*"
62
50
  ]
63
51
  }
@@ -3,11 +3,13 @@ import { defineConfig } from 'weapp-vite/config'
3
3
  export default defineConfig(() => ({
4
4
  weapp: {
5
5
  srcRoot: 'src',
6
- autoImportComponents: {
7
- globs: ['components/**/*.vue', 'components/**/*.wxml'],
8
- typedComponents: true,
9
- vueComponents: true,
10
- vueComponentsModule: 'wevu',
6
+ autoRoutes: true,
7
+ autoImportComponents: true,
8
+ subPackages: {
9
+ packageA: {},
10
+ packageB: {
11
+ independent: true,
12
+ },
11
13
  },
12
14
  },
13
15
  // weapp-vite 内置的 Vue 支持会自动处理 .vue 文件,不需要额外插件
@@ -33,3 +33,4 @@ yarn-error.log*
33
33
  dist
34
34
  vite.config.ts.timestamp-*.mjs
35
35
  dist-web
36
+ .weapp-vite/
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite-wevu-tailwindcss-tdesign-template",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "private": true,
6
6
  "description": "weapp-vite + wevu (Vue SFC) 模板",
7
7
  "author": "ice breaker <1324318532@qq.com>",
@@ -0,0 +1,75 @@
1
+ /* eslint-disable */
2
+ // biome-ignore lint: disable
3
+ // oxlint-disable
4
+ // ------
5
+ // 由 weapp-vite 自动生成,请勿编辑。
6
+ import 'wevu/router';
7
+
8
+ declare module 'weapp-vite/auto-routes' {
9
+ export type AutoRoutesPages = [
10
+ "pages/index/index",
11
+ "pages/ability/index",
12
+ "pages/data/index",
13
+ "pages/form/index",
14
+ "pages/list/index"
15
+ ];
16
+ export type AutoRoutesEntries = [
17
+ "pages/index/index",
18
+ "pages/ability/index",
19
+ "pages/data/index",
20
+ "pages/form/index",
21
+ "pages/list/index",
22
+ "subpackages/ability/index",
23
+ "subpackages/lab/class-binding/index",
24
+ "subpackages/lab/index"
25
+ ];
26
+ export type AutoRoutesSubPackages = [
27
+ {
28
+ readonly root: "subpackages/ability";
29
+ readonly pages: [
30
+ "index"
31
+ ];
32
+ [k: string]: unknown;
33
+ },
34
+ {
35
+ readonly root: "subpackages/lab";
36
+ readonly pages: [
37
+ "class-binding/index",
38
+ "index"
39
+ ];
40
+ [k: string]: unknown;
41
+ }
42
+ ];
43
+ export type AutoRoutesSubPackage = AutoRoutesSubPackages[number];
44
+ export interface AutoRoutes {
45
+ readonly pages: AutoRoutesPages;
46
+ readonly entries: AutoRoutesEntries;
47
+ readonly subPackages: AutoRoutesSubPackages;
48
+ }
49
+ export type AutoRouteEntry = AutoRoutesEntries[number];
50
+ export type AutoRoutesRelativeUrl = `./${string}` | `../${string}`;
51
+ export type AutoRoutesAbsoluteUrl<Path extends string> = Path | `/${Path}` | `${Path}?${string}` | `/${Path}?${string}`;
52
+ export type AutoRoutesUrl = AutoRoutesAbsoluteUrl<AutoRouteEntry> | AutoRoutesRelativeUrl;
53
+ export type AutoRouteNavigateOption = {
54
+ readonly url: AutoRoutesUrl;
55
+ } & Record<string, any>;
56
+ export interface AutoRoutesWxRouter {
57
+ switchTab: (option: AutoRouteNavigateOption) => unknown;
58
+ reLaunch: (option: AutoRouteNavigateOption) => unknown;
59
+ redirectTo: (option: AutoRouteNavigateOption) => unknown;
60
+ navigateTo: (option: AutoRouteNavigateOption) => unknown;
61
+ navigateBack: (option?: Record<string, any>) => unknown;
62
+ }
63
+ export const routes: AutoRoutes;
64
+ export const pages: AutoRoutesPages;
65
+ export const entries: AutoRoutesEntries;
66
+ export const subPackages: AutoRoutesSubPackages;
67
+ export const wxRouter: AutoRoutesWxRouter;
68
+ export default routes;
69
+ }
70
+
71
+ declare module 'wevu/router' {
72
+ interface WevuTypedRouterRouteMap {
73
+ entries: import('weapp-vite/auto-routes').AutoRoutesEntries[number];
74
+ }
75
+ }
@@ -1,3 +1 @@
1
1
  /// <reference types="weapp-vite/client" />
2
- /// <reference path="../components.d.ts" />
3
- /// <reference path="../typed-components.d.ts" />
@@ -17,7 +17,7 @@
17
17
  "./src/*"
18
18
  ],
19
19
  "weapp-vite/typed-components": [
20
- "./typed-components.d.ts"
20
+ "./src/typed-components.d.ts"
21
21
  ],
22
22
  "tdesign-miniprogram/*": [
23
23
  "./node_modules/tdesign-miniprogram/miniprogram_dist/*"
@@ -49,18 +49,6 @@
49
49
  "lib": "wevu"
50
50
  },
51
51
  "include": [
52
- "src/**/*.ts",
53
- "src/**/*.tsx",
54
- "src/**/*.js",
55
- "src/**/*.jsx",
56
- "src/**/*.mts",
57
- "src/**/*.cts",
58
- "src/**/*.vue",
59
- "src/**/*.json",
60
- "src/**/*.d.ts",
61
- "types/**/*.d.ts",
62
- "env.d.ts",
63
- "components.d.ts",
64
- "typed-components.d.ts"
52
+ "src/**/*"
65
53
  ]
66
54
  }
@@ -1,10 +1,17 @@
1
+ import path from 'node:path'
1
2
  import { UnifiedViteWeappTailwindcssPlugin } from 'weapp-tailwindcss/vite'
2
3
  import { TDesignResolver } from 'weapp-vite/auto-import-components/resolvers'
3
4
  import { defineConfig } from 'weapp-vite/config'
4
5
 
5
6
  export default defineConfig({
7
+ resolve: {
8
+ alias: {
9
+ '@': path.resolve(import.meta.dirname, 'src'),
10
+ },
11
+ },
6
12
  weapp: {
7
13
  srcRoot: 'src',
14
+ autoRoutes: true,
8
15
  autoImportComponents: {
9
16
  resolvers: [TDesignResolver()],
10
17
  htmlCustomData: true,