@coze-arch/cli 0.0.1-beta.6 → 0.0.3
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 +1 -0
- package/lib/__templates__/expo/.coze +7 -2
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +229 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +47 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +34 -0
- package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
- package/lib/__templates__/expo/README.md +68 -7
- package/lib/__templates__/expo/_gitignore +2 -1
- package/lib/__templates__/expo/_npmrc +4 -5
- package/lib/__templates__/expo/client/app/+not-found.tsx +15 -64
- package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
- package/lib/__templates__/expo/client/app/index.tsx +1 -0
- package/lib/__templates__/expo/client/app.config.ts +76 -0
- package/lib/__templates__/expo/client/components/Screen.tsx +3 -19
- package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
- package/lib/__templates__/expo/client/components/ThemedView.tsx +37 -0
- package/lib/__templates__/expo/client/constants/theme.ts +117 -58
- package/lib/__templates__/expo/client/contexts/AuthContext.tsx +14 -107
- package/lib/__templates__/expo/client/declarations.d.ts +5 -0
- package/lib/__templates__/expo/{eslint.config.mjs → client/eslint.config.mjs} +40 -10
- package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
- package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
- package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
- package/lib/__templates__/expo/client/metro.config.js +124 -0
- package/lib/__templates__/expo/client/package.json +95 -0
- package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
- package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
- package/lib/__templates__/expo/client/scripts/install-missing-deps.js +11 -10
- package/lib/__templates__/expo/client/tsconfig.json +24 -0
- package/lib/__templates__/expo/client/utils/index.ts +23 -2
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/rule.js +112 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/tech.md +94 -0
- package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
- package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/rule.js +120 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/tech.md +58 -0
- package/lib/__templates__/expo/package.json +16 -101
- package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
- package/lib/__templates__/expo/pnpm-lock.yaml +1622 -3274
- package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
- package/lib/__templates__/expo/server/build.js +21 -0
- package/lib/__templates__/expo/server/package.json +34 -0
- package/lib/__templates__/expo/server/src/index.ts +20 -0
- package/lib/__templates__/expo/server/tsconfig.json +24 -0
- package/lib/__templates__/expo/template.config.js +58 -1
- package/lib/__templates__/expo/tsconfig.json +1 -24
- package/lib/__templates__/native-static/.coze +11 -0
- package/lib/__templates__/native-static/index.html +33 -0
- package/lib/__templates__/native-static/styles/main.css +136 -0
- package/lib/__templates__/native-static/template.config.js +22 -0
- package/lib/__templates__/nextjs/.coze +4 -3
- package/lib/__templates__/nextjs/README.md +5 -0
- package/lib/__templates__/nextjs/_gitignore +1 -0
- package/lib/__templates__/nextjs/_npmrc +2 -1
- package/lib/__templates__/nextjs/eslint.config.mjs +5 -0
- package/lib/__templates__/nextjs/next.config.ts +11 -0
- package/lib/__templates__/nextjs/package.json +15 -1
- package/lib/__templates__/nextjs/pnpm-lock.yaml +7694 -4394
- package/lib/__templates__/nextjs/scripts/build.sh +4 -1
- package/lib/__templates__/nextjs/scripts/dev.sh +15 -28
- package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
- package/lib/__templates__/nextjs/scripts/start.sh +7 -1
- package/lib/__templates__/nextjs/src/app/globals.css +109 -89
- package/lib/__templates__/nextjs/src/app/layout.tsx +20 -33
- package/lib/__templates__/nextjs/src/app/page.tsx +18 -49
- package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
- package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
- package/lib/__templates__/nextjs/src/server.ts +35 -0
- package/lib/__templates__/nextjs/template.config.js +68 -3
- package/lib/__templates__/nextjs/tsconfig.json +1 -1
- package/lib/__templates__/nuxt-vue/.coze +12 -0
- package/lib/__templates__/nuxt-vue/README.md +73 -0
- package/lib/__templates__/nuxt-vue/_gitignore +25 -0
- package/lib/__templates__/nuxt-vue/_npmrc +23 -0
- package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
- package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
- package/lib/__templates__/nuxt-vue/assets/css/main.css +24 -0
- package/lib/__templates__/nuxt-vue/nuxt.config.ts +126 -0
- package/lib/__templates__/nuxt-vue/package.json +35 -0
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8759 -0
- package/lib/__templates__/nuxt-vue/postcss.config.mjs +8 -0
- package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
- package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
- package/lib/__templates__/nuxt-vue/scripts/build.sh +14 -0
- package/lib/__templates__/nuxt-vue/scripts/dev.sh +39 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare.sh +14 -0
- package/lib/__templates__/nuxt-vue/scripts/start.sh +21 -0
- package/lib/__templates__/nuxt-vue/server/api/hello.ts +10 -0
- package/lib/__templates__/nuxt-vue/server/middleware/logger.ts +10 -0
- package/lib/__templates__/nuxt-vue/server/routes/health.ts +10 -0
- package/lib/__templates__/nuxt-vue/tailwind.config.js +13 -0
- package/lib/__templates__/nuxt-vue/template.config.js +87 -0
- package/lib/__templates__/nuxt-vue/tsconfig.json +18 -0
- package/lib/__templates__/taro/.coze +14 -0
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
- package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
- package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -0
- package/lib/__templates__/taro/README.md +763 -0
- package/lib/__templates__/taro/_gitignore +41 -0
- package/lib/__templates__/taro/_npmrc +18 -0
- package/lib/__templates__/taro/babel.config.js +12 -0
- package/lib/__templates__/taro/config/dev.ts +9 -0
- package/lib/__templates__/taro/config/index.ts +238 -0
- package/lib/__templates__/taro/config/prod.ts +34 -0
- package/lib/__templates__/taro/eslint.config.mjs +135 -0
- package/lib/__templates__/taro/key/private.appid.key +0 -0
- package/lib/__templates__/taro/package.json +112 -0
- package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
- package/lib/__templates__/taro/pnpm-lock.yaml +23412 -0
- package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
- package/lib/__templates__/taro/project.config.json +15 -0
- package/lib/__templates__/taro/server/nest-cli.json +10 -0
- package/lib/__templates__/taro/server/package.json +40 -0
- package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
- package/lib/__templates__/taro/server/src/app.module.ts +10 -0
- package/lib/__templates__/taro/server/src/app.service.ts +8 -0
- package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
- package/lib/__templates__/taro/server/src/main.ts +49 -0
- package/lib/__templates__/taro/server/tsconfig.json +24 -0
- package/lib/__templates__/taro/src/app.config.ts +11 -0
- package/lib/__templates__/taro/src/app.css +156 -0
- package/lib/__templates__/taro/src/app.tsx +9 -0
- package/lib/__templates__/taro/src/components/ui/accordion.tsx +159 -0
- package/lib/__templates__/taro/src/components/ui/alert-dialog.tsx +260 -0
- package/lib/__templates__/taro/src/components/ui/alert.tsx +60 -0
- package/lib/__templates__/taro/src/components/ui/aspect-ratio.tsx +36 -0
- package/lib/__templates__/taro/src/components/ui/avatar.tsx +84 -0
- package/lib/__templates__/taro/src/components/ui/badge.tsx +37 -0
- package/lib/__templates__/taro/src/components/ui/breadcrumb.tsx +117 -0
- package/lib/__templates__/taro/src/components/ui/button-group.tsx +83 -0
- package/lib/__templates__/taro/src/components/ui/button.tsx +67 -0
- package/lib/__templates__/taro/src/components/ui/calendar.tsx +394 -0
- package/lib/__templates__/taro/src/components/ui/card.tsx +108 -0
- package/lib/__templates__/taro/src/components/ui/carousel.tsx +228 -0
- package/lib/__templates__/taro/src/components/ui/checkbox.tsx +58 -0
- package/lib/__templates__/taro/src/components/ui/code-block.tsx +169 -0
- package/lib/__templates__/taro/src/components/ui/collapsible.tsx +71 -0
- package/lib/__templates__/taro/src/components/ui/command.tsx +385 -0
- package/lib/__templates__/taro/src/components/ui/context-menu.tsx +614 -0
- package/lib/__templates__/taro/src/components/ui/dialog.tsx +256 -0
- package/lib/__templates__/taro/src/components/ui/drawer.tsx +192 -0
- package/lib/__templates__/taro/src/components/ui/dropdown-menu.tsx +561 -0
- package/lib/__templates__/taro/src/components/ui/field.tsx +228 -0
- package/lib/__templates__/taro/src/components/ui/hover-card.tsx +282 -0
- package/lib/__templates__/taro/src/components/ui/input-group.tsx +197 -0
- package/lib/__templates__/taro/src/components/ui/input-otp.tsx +136 -0
- package/lib/__templates__/taro/src/components/ui/input.tsx +56 -0
- package/lib/__templates__/taro/src/components/ui/label.tsx +24 -0
- package/lib/__templates__/taro/src/components/ui/menubar.tsx +595 -0
- package/lib/__templates__/taro/src/components/ui/navigation-menu.tsx +264 -0
- package/lib/__templates__/taro/src/components/ui/pagination.tsx +118 -0
- package/lib/__templates__/taro/src/components/ui/popover.tsx +291 -0
- package/lib/__templates__/taro/src/components/ui/portal.tsx +19 -0
- package/lib/__templates__/taro/src/components/ui/progress.tsx +28 -0
- package/lib/__templates__/taro/src/components/ui/radio-group.tsx +64 -0
- package/lib/__templates__/taro/src/components/ui/resizable.tsx +346 -0
- package/lib/__templates__/taro/src/components/ui/scroll-area.tsx +34 -0
- package/lib/__templates__/taro/src/components/ui/select.tsx +438 -0
- package/lib/__templates__/taro/src/components/ui/separator.tsx +30 -0
- package/lib/__templates__/taro/src/components/ui/sheet.tsx +262 -0
- package/lib/__templates__/taro/src/components/ui/skeleton.tsx +17 -0
- package/lib/__templates__/taro/src/components/ui/slider.tsx +203 -0
- package/lib/__templates__/taro/src/components/ui/sonner.tsx +1 -0
- package/lib/__templates__/taro/src/components/ui/switch.tsx +55 -0
- package/lib/__templates__/taro/src/components/ui/table.tsx +142 -0
- package/lib/__templates__/taro/src/components/ui/tabs.tsx +114 -0
- package/lib/__templates__/taro/src/components/ui/textarea.tsx +54 -0
- package/lib/__templates__/taro/src/components/ui/toast.tsx +517 -0
- package/lib/__templates__/taro/src/components/ui/toggle-group.tsx +120 -0
- package/lib/__templates__/taro/src/components/ui/toggle.tsx +77 -0
- package/lib/__templates__/taro/src/components/ui/tooltip.tsx +455 -0
- package/lib/__templates__/taro/src/index.html +39 -0
- package/lib/__templates__/taro/src/lib/hooks/use-keyboard-offset.ts +37 -0
- package/lib/__templates__/taro/src/lib/measure.ts +115 -0
- package/lib/__templates__/taro/src/lib/platform.ts +12 -0
- package/lib/__templates__/taro/src/lib/utils.ts +6 -0
- package/lib/__templates__/taro/src/network.ts +39 -0
- package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
- package/lib/__templates__/taro/src/pages/index/index.css +1 -0
- package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
- package/lib/__templates__/taro/src/presets/dev-debug.ts +23 -0
- package/lib/__templates__/taro/src/presets/h5-container.tsx +15 -0
- package/lib/__templates__/taro/src/presets/h5-navbar.tsx +238 -0
- package/lib/__templates__/taro/src/presets/h5-styles.ts +220 -0
- package/lib/__templates__/taro/src/presets/index.tsx +18 -0
- package/lib/__templates__/taro/stylelint.config.mjs +4 -0
- package/lib/__templates__/taro/template.config.js +68 -0
- package/lib/__templates__/taro/tsconfig.json +29 -0
- package/lib/__templates__/taro/types/global.d.ts +32 -0
- package/lib/__templates__/templates.json +173 -36
- package/lib/__templates__/vite/.coze +4 -3
- package/lib/__templates__/vite/README.md +383 -26
- package/lib/__templates__/vite/_gitignore +2 -0
- package/lib/__templates__/vite/_npmrc +2 -1
- package/lib/__templates__/vite/eslint.config.mjs +14 -0
- package/lib/__templates__/vite/package.json +23 -3
- package/lib/__templates__/vite/pnpm-lock.yaml +2509 -293
- package/lib/__templates__/vite/scripts/build.sh +4 -1
- package/lib/__templates__/vite/scripts/dev.sh +16 -28
- package/lib/__templates__/vite/scripts/prepare.sh +9 -0
- package/lib/__templates__/vite/scripts/start.sh +9 -3
- package/lib/__templates__/vite/server/routes/index.ts +31 -0
- package/lib/__templates__/vite/server/server.ts +65 -0
- package/lib/__templates__/vite/server/vite.ts +67 -0
- package/lib/__templates__/vite/src/main.ts +17 -48
- package/lib/__templates__/vite/template.config.js +77 -7
- package/lib/__templates__/vite/tsconfig.json +4 -3
- package/lib/__templates__/vite/vite.config.ts +8 -3
- package/lib/cli.js +1545 -526
- package/package.json +20 -7
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_build.sh +0 -109
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +0 -257
- package/lib/__templates__/expo/app.json +0 -63
- package/lib/__templates__/expo/babel.config.js +0 -9
- package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +0 -43
- package/lib/__templates__/expo/client/app/(tabs)/home.tsx +0 -1
- package/lib/__templates__/expo/client/app/(tabs)/index.tsx +0 -7
- package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
- package/lib/__templates__/expo/client/index.js +0 -12
- package/lib/__templates__/expo/client/screens/home/index.tsx +0 -54
- package/lib/__templates__/expo/client/screens/home/styles.ts +0 -332
- package/lib/__templates__/expo/metro.config.js +0 -53
- package/lib/__templates__/expo/src/index.ts +0 -12
- package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
- package/lib/__templates__/nextjs/server.mjs +0 -50
- package/lib/__templates__/vite/.vscode/settings.json +0 -7
- /package/lib/__templates__/expo/{eslint-formatter-simple.mjs → client/eslint-formatter-simple.mjs} +0 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* H5 端特殊样式注入
|
|
3
|
+
* 如无必要,请勿修改本文件
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const H5_BASE_STYLES = `
|
|
7
|
+
/* H5 端隐藏 TabBar 空图标(只隐藏没有 src 的图标) */
|
|
8
|
+
.weui-tabbar__icon:not([src]),
|
|
9
|
+
.weui-tabbar__icon[src=''] {
|
|
10
|
+
display: none !important;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.weui-tabbar__item:has(.weui-tabbar__icon:not([src])) .weui-tabbar__label,
|
|
14
|
+
.weui-tabbar__item:has(.weui-tabbar__icon[src='']) .weui-tabbar__label {
|
|
15
|
+
margin-top: 0 !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Vite 错误覆盖层无法选择文本的问题 */
|
|
19
|
+
vite-error-overlay {
|
|
20
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
21
|
+
-webkit-user-select: text !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
vite-error-overlay::part(window) {
|
|
25
|
+
max-width: 90vw;
|
|
26
|
+
padding: 10px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.taro_page {
|
|
30
|
+
overflow: auto;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
::-webkit-scrollbar {
|
|
34
|
+
width: 4px;
|
|
35
|
+
height: 4px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
::-webkit-scrollbar-track {
|
|
39
|
+
background: transparent;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
::-webkit-scrollbar-thumb {
|
|
43
|
+
background: rgba(0, 0, 0, 0.2);
|
|
44
|
+
border-radius: 2px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
::-webkit-scrollbar-thumb:hover {
|
|
48
|
+
background: rgba(0, 0, 0, 0.3);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* H5 导航栏页面自动添加顶部间距 */
|
|
52
|
+
body.h5-navbar-visible .taro_page {
|
|
53
|
+
padding-top: 44px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
body.h5-navbar-visible .toaster[data-position^="top"] {
|
|
57
|
+
top: 44px !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Sheet 组件在 H5 导航栏下的位置修正 */
|
|
61
|
+
body.h5-navbar-visible .sheet-content:not([data-side="bottom"]) {
|
|
62
|
+
top: 44px !important;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* H5 端 rem 适配:与小程序 rpx 缩放一致
|
|
67
|
+
* 375px 屏幕:1rem = 16px,小程序 32rpx = 16px
|
|
68
|
+
*/
|
|
69
|
+
html {
|
|
70
|
+
font-size: 4vw !important;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* H5 端组件默认样式修复 */
|
|
74
|
+
taro-view-core {
|
|
75
|
+
display: block;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
taro-text-core {
|
|
79
|
+
display: inline;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
taro-input-core {
|
|
83
|
+
display: block;
|
|
84
|
+
width: 100%;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
taro-input-core input {
|
|
88
|
+
width: 100%;
|
|
89
|
+
background: transparent;
|
|
90
|
+
border: none;
|
|
91
|
+
outline: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
taro-input-core.taro-otp-hidden-input input {
|
|
95
|
+
color: transparent;
|
|
96
|
+
caret-color: transparent;
|
|
97
|
+
-webkit-text-fill-color: transparent;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* 全局按钮样式重置 */
|
|
101
|
+
taro-button-core,
|
|
102
|
+
button {
|
|
103
|
+
margin: 0 !important;
|
|
104
|
+
padding: 0 !important;
|
|
105
|
+
line-height: inherit;
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
taro-button-core::after,
|
|
112
|
+
button::after {
|
|
113
|
+
border: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
taro-textarea-core > textarea,
|
|
117
|
+
.taro-textarea,
|
|
118
|
+
textarea.taro-textarea {
|
|
119
|
+
resize: none !important;
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
|
|
123
|
+
const PC_WIDESCREEN_STYLES = `
|
|
124
|
+
/* PC 宽屏适配 - 基础布局 */
|
|
125
|
+
@media (min-width: 769px) {
|
|
126
|
+
html {
|
|
127
|
+
font-size: 15px !important;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
body {
|
|
131
|
+
background-color: #f3f4f6 !important;
|
|
132
|
+
display: flex !important;
|
|
133
|
+
justify-content: center !important;
|
|
134
|
+
align-items: center !important;
|
|
135
|
+
min-height: 100vh !important;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
`;
|
|
139
|
+
|
|
140
|
+
const PC_WIDESCREEN_PHONE_FRAME = `
|
|
141
|
+
/* PC 宽屏适配 - 手机框样式(有 TabBar 页面) */
|
|
142
|
+
@media (min-width: 769px) {
|
|
143
|
+
.taro-tabbar__container {
|
|
144
|
+
width: 375px !important;
|
|
145
|
+
max-width: 375px !important;
|
|
146
|
+
height: calc(100vh - 40px) !important;
|
|
147
|
+
max-height: 900px !important;
|
|
148
|
+
background-color: #fff !important;
|
|
149
|
+
transform: translateX(0) !important;
|
|
150
|
+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1) !important;
|
|
151
|
+
border-radius: 20px !important;
|
|
152
|
+
overflow: hidden !important;
|
|
153
|
+
position: relative !important;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.taro-tabbar__panel {
|
|
157
|
+
height: 100% !important;
|
|
158
|
+
overflow: auto !important;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* PC 宽屏适配 - Toast 定位到手机框范围内 */
|
|
163
|
+
@media (min-width: 769px) {
|
|
164
|
+
body .toaster {
|
|
165
|
+
left: 50% !important;
|
|
166
|
+
right: auto !important;
|
|
167
|
+
width: 375px !important;
|
|
168
|
+
max-width: 375px !important;
|
|
169
|
+
transform: translateX(-50%) !important;
|
|
170
|
+
box-sizing: border-box !important;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* PC 宽屏适配 - 手机框样式(无 TabBar 页面,通过 JS 添加 no-tabbar 类) */
|
|
175
|
+
@media (min-width: 769px) {
|
|
176
|
+
body.no-tabbar #app {
|
|
177
|
+
width: 375px !important;
|
|
178
|
+
max-width: 375px !important;
|
|
179
|
+
height: calc(100vh - 40px) !important;
|
|
180
|
+
max-height: 900px !important;
|
|
181
|
+
background-color: #fff !important;
|
|
182
|
+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1) !important;
|
|
183
|
+
border-radius: 20px !important;
|
|
184
|
+
overflow: hidden !important;
|
|
185
|
+
position: relative !important;
|
|
186
|
+
transform: translateX(0) !important;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
body.no-tabbar #app .taro_router {
|
|
190
|
+
height: 100% !important;
|
|
191
|
+
overflow: auto !important;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
`;
|
|
195
|
+
|
|
196
|
+
function injectStyles() {
|
|
197
|
+
const style = document.createElement('style');
|
|
198
|
+
style.innerHTML =
|
|
199
|
+
H5_BASE_STYLES + PC_WIDESCREEN_STYLES + PC_WIDESCREEN_PHONE_FRAME;
|
|
200
|
+
document.head.appendChild(style);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function setupTabbarDetection() {
|
|
204
|
+
const checkTabbar = () => {
|
|
205
|
+
const hasTabbar = !!document.querySelector('.taro-tabbar__container');
|
|
206
|
+
document.body.classList.toggle('no-tabbar', !hasTabbar);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
checkTabbar();
|
|
210
|
+
|
|
211
|
+
const observer = new MutationObserver(checkTabbar);
|
|
212
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function injectH5Styles() {
|
|
216
|
+
if (TARO_ENV !== 'h5') return;
|
|
217
|
+
|
|
218
|
+
injectStyles();
|
|
219
|
+
setupTabbarDetection();
|
|
220
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useLaunch } from '@tarojs/taro';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { injectH5Styles } from './h5-styles';
|
|
4
|
+
import { devDebug } from './dev-debug';
|
|
5
|
+
import { H5Container } from './h5-container';
|
|
6
|
+
|
|
7
|
+
export const Preset = ({ children }: PropsWithChildren) => {
|
|
8
|
+
useLaunch(() => {
|
|
9
|
+
devDebug();
|
|
10
|
+
injectH5Styles();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
if (TARO_ENV === 'h5') {
|
|
14
|
+
return <H5Container>{children}</H5Container>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return <>{children}</>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const description = `Taro(小程序 + H5):\`coze init \${COZE_WORKSPACE_PATH} --template taro\`
|
|
11
|
+
- 适用:微信小程序、H5 跨端应用
|
|
12
|
+
- 前后端分离架构:Taro 4 + NestJS
|
|
13
|
+
- 支持微信小程序和 H5 双端构建
|
|
14
|
+
- 使用 TailwindCSS + weapp-tailwindcss 实现跨端样式`;
|
|
15
|
+
|
|
16
|
+
export const paramsSchema = {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
appName: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
minLength: 1,
|
|
22
|
+
pattern: '^[a-z0-9-]+$',
|
|
23
|
+
description:
|
|
24
|
+
'Application name (lowercase, alphanumeric and hyphens only)',
|
|
25
|
+
},
|
|
26
|
+
port: {
|
|
27
|
+
type: 'number',
|
|
28
|
+
default: 5000,
|
|
29
|
+
minimum: 1024,
|
|
30
|
+
maximum: 65535,
|
|
31
|
+
description: 'H5 development server port',
|
|
32
|
+
},
|
|
33
|
+
serverPort: {
|
|
34
|
+
type: 'number',
|
|
35
|
+
default: 3000,
|
|
36
|
+
minimum: 1024,
|
|
37
|
+
maximum: 65535,
|
|
38
|
+
description: 'NestJS backend server port',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
required: [],
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const config = {
|
|
46
|
+
description: description,
|
|
47
|
+
paramsSchema,
|
|
48
|
+
defaultParams: {
|
|
49
|
+
port: 5000,
|
|
50
|
+
serverPort: 3000,
|
|
51
|
+
appName: 'coze-mini-program',
|
|
52
|
+
},
|
|
53
|
+
onBeforeRender: async context => {
|
|
54
|
+
console.log(`Creating Taro project: ${context.appName}`);
|
|
55
|
+
return context;
|
|
56
|
+
},
|
|
57
|
+
onAfterRender: async (context, outputPath) => {
|
|
58
|
+
console.log(`\nProject created at: ${outputPath}`);
|
|
59
|
+
console.log('\nConfiguration:');
|
|
60
|
+
console.log(' - Framework: Taro 4 + NestJS');
|
|
61
|
+
console.log(' - TypeScript: enabled');
|
|
62
|
+
console.log(' - Platforms: H5, WeChat Mini Program');
|
|
63
|
+
console.log(` - H5 Port: ${context.port}`);
|
|
64
|
+
console.log(` - Server Port: ${context.serverPort}`);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default config;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2017",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"removeComments": false,
|
|
6
|
+
"preserveConstEnums": true,
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"experimentalDecorators": true,
|
|
9
|
+
"noImplicitAny": false,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"outDir": "lib",
|
|
12
|
+
"noUnusedLocals": true,
|
|
13
|
+
"noUnusedParameters": true,
|
|
14
|
+
"strictNullChecks": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"rootDir": ".",
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"resolveJsonModule": true,
|
|
20
|
+
"typeRoots": [
|
|
21
|
+
"node_modules/@types"
|
|
22
|
+
],
|
|
23
|
+
"paths": {
|
|
24
|
+
"@/*": ["./src/*"]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"include": ["./src", "./types", "./config"],
|
|
28
|
+
"compileOnSave": false
|
|
29
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="@tarojs/taro" />
|
|
2
|
+
|
|
3
|
+
declare const PROJECT_DOMAIN: string | undefined;
|
|
4
|
+
declare const TARO_ENV: "weapp" | "h5" | undefined;
|
|
5
|
+
|
|
6
|
+
declare module '*.png';
|
|
7
|
+
declare module '*.gif';
|
|
8
|
+
declare module '*.jpg';
|
|
9
|
+
declare module '*.jpeg';
|
|
10
|
+
declare module '*.svg';
|
|
11
|
+
declare module '*.css';
|
|
12
|
+
declare module '*.less';
|
|
13
|
+
declare module '*.scss';
|
|
14
|
+
declare module '*.sass';
|
|
15
|
+
declare module '*.styl';
|
|
16
|
+
|
|
17
|
+
declare namespace NodeJS {
|
|
18
|
+
interface ProcessEnv {
|
|
19
|
+
/** NODE 内置环境变量, 会影响到最终构建生成产物 */
|
|
20
|
+
NODE_ENV: 'development' | 'production',
|
|
21
|
+
/** 当前构建的平台 */
|
|
22
|
+
TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'qq' | 'jd' | 'harmony' | 'jdrn'
|
|
23
|
+
/**
|
|
24
|
+
* 当前构建的小程序 appid
|
|
25
|
+
* @description 若不同环境有不同的小程序,可通过在 env 文件中配置环境变量`TARO_APP_ID`来方便快速切换 appid, 而不必手动去修改 dist/project.config.json 文件
|
|
26
|
+
* @see https://taro-docs.jd.com/docs/next/env-mode-config#特殊环境变量-taro_app_id
|
|
27
|
+
*/
|
|
28
|
+
TARO_APP_ID: string
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
@@ -3,59 +3,196 @@
|
|
|
3
3
|
"templates": [
|
|
4
4
|
{
|
|
5
5
|
"name": "expo",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Expo template for React Native applications",
|
|
7
7
|
"location": "./expo",
|
|
8
8
|
"paramsSchema": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"appName": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"minLength": 1,
|
|
14
|
+
"pattern": "^[a-z0-9-]+$",
|
|
15
|
+
"description": "Application name (lowercase, alphanumeric and hyphens only)"
|
|
16
|
+
},
|
|
17
|
+
"port": {
|
|
18
|
+
"type": "number",
|
|
19
|
+
"default": 8081,
|
|
20
|
+
"minimum": 1024,
|
|
21
|
+
"maximum": 65535,
|
|
22
|
+
"description": "Metro bundler port"
|
|
23
|
+
}
|
|
13
24
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
"required": [],
|
|
26
|
+
"additionalProperties": false
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "native-static",
|
|
31
|
+
"description": "Native Static(纯静态):`coze init ${COZE_WORKSPACE_PATH} --template native-static`\n- 适用:纯静态 HTML/CSS/JS 项目、静态网站\n- 使用 Python http.server 作为开发服务器\n- 不需要 Node.js 环境,适合简单静态内容",
|
|
32
|
+
"location": "./native-static",
|
|
33
|
+
"paramsSchema": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {},
|
|
36
|
+
"required": [],
|
|
37
|
+
"additionalProperties": false
|
|
21
38
|
}
|
|
22
39
|
},
|
|
23
40
|
{
|
|
24
41
|
"name": "nextjs",
|
|
25
|
-
"description": "nextjs
|
|
42
|
+
"description": "Next.js(复杂项目):`coze init ${COZE_WORKSPACE_PATH} --template nextjs`\n- 适用:全栈应用、复杂多页面等复杂项目\n- 使用默认nextjs项目规范\n - **目录规范**: 默认开启src目录(打开--src-dir选项):项目文件(如 app 目录、pages 目录、components 等)初始化到 src/ 目录下。\n - **项目理解加速**:初始可以依赖项目下 `package.json` 文件理解项目类型,如果没有或无法理解退化成阅读其他文件。\n - **UI设计与组件规范**:Next.js项目**必须默认**采用 shadcn/ui 风格和规范,`shadcn/ui`组件默认完整的预装在`src/components/ui/`目录下",
|
|
26
43
|
"location": "./nextjs",
|
|
27
44
|
"paramsSchema": {
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
45
|
+
"type": "object",
|
|
46
|
+
"properties": {
|
|
47
|
+
"appName": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"minLength": 1,
|
|
50
|
+
"pattern": "^[a-z0-9-]+$",
|
|
51
|
+
"description": "Application name (lowercase, alphanumeric and hyphens only)"
|
|
52
|
+
},
|
|
53
|
+
"port": {
|
|
54
|
+
"type": "number",
|
|
55
|
+
"default": 5000,
|
|
56
|
+
"minimum": 1024,
|
|
57
|
+
"maximum": 65535,
|
|
58
|
+
"description": "Development server port (for Next.js dev server)"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"required": [],
|
|
62
|
+
"additionalProperties": false
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "nuxt-vue",
|
|
67
|
+
"description": "Nuxt.js(服务端 + Vue):`coze init ${COZE_WORKSPACE_PATH} --template nuxt-vue`\n- 适用:全栈应用、需要服务端接口能力的 Vue 项目\n- 特点:\n - **服务端能力**:内置服务端 API 路由,可直接创建后端接口\n - **Vue 3**:基于最新的 Vue 3 Composition API\n - **Vite**:使用 Vite 作为构建工具,开发体验极佳\n - **TypeScript**:完整的 TypeScript 支持\n - **文件路由**:基于文件系统的自动路由\n - **项目理解加速**:可依赖项目下 `package.json` 和 `nuxt.config.ts` 理解项目配置",
|
|
68
|
+
"location": "./nuxt-vue",
|
|
69
|
+
"paramsSchema": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"properties": {
|
|
72
|
+
"appName": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"minLength": 1,
|
|
75
|
+
"pattern": "^[a-z0-9-]+$",
|
|
76
|
+
"description": "Application name (lowercase, alphanumeric and hyphens only)"
|
|
77
|
+
},
|
|
78
|
+
"port": {
|
|
79
|
+
"type": "number",
|
|
80
|
+
"default": 5000,
|
|
81
|
+
"minimum": 1024,
|
|
82
|
+
"maximum": 65535,
|
|
83
|
+
"description": "Development server port (for Nuxt dev server)"
|
|
84
|
+
},
|
|
85
|
+
"hmrPort": {
|
|
86
|
+
"type": "number",
|
|
87
|
+
"default": 6000,
|
|
88
|
+
"minimum": 1024,
|
|
89
|
+
"maximum": 65535,
|
|
90
|
+
"description": "Hot Module Replacement (HMR) port"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"required": [],
|
|
94
|
+
"additionalProperties": false
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "taro",
|
|
99
|
+
"description": "Taro(小程序 + H5):`coze init ${COZE_WORKSPACE_PATH} --template taro`\n- 适用:微信小程序、H5 跨端应用\n- 前后端分离架构:Taro 4 + NestJS\n- 支持微信小程序和 H5 双端构建\n- 使用 TailwindCSS + weapp-tailwindcss 实现跨端样式",
|
|
100
|
+
"location": "./taro",
|
|
101
|
+
"paramsSchema": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"properties": {
|
|
104
|
+
"appName": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"minLength": 1,
|
|
107
|
+
"pattern": "^[a-z0-9-]+$",
|
|
108
|
+
"description": "Application name (lowercase, alphanumeric and hyphens only)"
|
|
109
|
+
},
|
|
110
|
+
"port": {
|
|
111
|
+
"type": "number",
|
|
112
|
+
"default": 5000,
|
|
113
|
+
"minimum": 1024,
|
|
114
|
+
"maximum": 65535,
|
|
115
|
+
"description": "H5 development server port"
|
|
116
|
+
},
|
|
117
|
+
"serverPort": {
|
|
118
|
+
"type": "number",
|
|
119
|
+
"default": 3000,
|
|
120
|
+
"minimum": 1024,
|
|
121
|
+
"maximum": 65535,
|
|
122
|
+
"description": "NestJS backend server port"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"required": [],
|
|
126
|
+
"additionalProperties": false
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "test-only",
|
|
131
|
+
"description": "Test template showcasing all template hooks and features",
|
|
132
|
+
"location": "./test-only",
|
|
133
|
+
"paramsSchema": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"properties": {
|
|
136
|
+
"appName": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"minLength": 1,
|
|
139
|
+
"pattern": "^[a-z0-9-]+$",
|
|
140
|
+
"description": "Application name (lowercase, alphanumeric and hyphens only)"
|
|
141
|
+
},
|
|
142
|
+
"port": {
|
|
143
|
+
"type": "number",
|
|
144
|
+
"default": 5000,
|
|
145
|
+
"minimum": 1024,
|
|
146
|
+
"maximum": 65535,
|
|
147
|
+
"description": "Development server port"
|
|
148
|
+
},
|
|
149
|
+
"includeTests": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"default": true,
|
|
152
|
+
"nullable": true,
|
|
153
|
+
"description": "Include test files"
|
|
154
|
+
},
|
|
155
|
+
"addCopyright": {
|
|
156
|
+
"type": "boolean",
|
|
157
|
+
"default": false,
|
|
158
|
+
"nullable": true,
|
|
159
|
+
"description": "Add copyright header to source files"
|
|
160
|
+
}
|
|
32
161
|
},
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
"description": "Development server port (for Next.js dev server)",
|
|
36
|
-
"default": 5000,
|
|
37
|
-
"minimum": 1024,
|
|
38
|
-
"maximum": 65535
|
|
39
|
-
}
|
|
162
|
+
"required": [],
|
|
163
|
+
"additionalProperties": false
|
|
40
164
|
}
|
|
41
165
|
},
|
|
42
166
|
{
|
|
43
167
|
"name": "vite",
|
|
44
|
-
"description": "vite
|
|
168
|
+
"description": "Vite(简单项目):`coze init ${COZE_WORKSPACE_PATH} --template vite`\n- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。",
|
|
45
169
|
"location": "./vite",
|
|
46
170
|
"paramsSchema": {
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
171
|
+
"type": "object",
|
|
172
|
+
"properties": {
|
|
173
|
+
"appName": {
|
|
174
|
+
"type": "string",
|
|
175
|
+
"minLength": 1,
|
|
176
|
+
"pattern": "^[a-z0-9-]+$",
|
|
177
|
+
"description": "Application name (lowercase, alphanumeric and hyphens only)"
|
|
178
|
+
},
|
|
179
|
+
"port": {
|
|
180
|
+
"type": "number",
|
|
181
|
+
"default": 5000,
|
|
182
|
+
"minimum": 1024,
|
|
183
|
+
"maximum": 65535,
|
|
184
|
+
"description": "Development server port"
|
|
185
|
+
},
|
|
186
|
+
"hmrPort": {
|
|
187
|
+
"type": "number",
|
|
188
|
+
"default": 6000,
|
|
189
|
+
"minimum": 1024,
|
|
190
|
+
"maximum": 65535,
|
|
191
|
+
"description": "Development HMR server port"
|
|
192
|
+
}
|
|
51
193
|
},
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
"description": "Development server port",
|
|
55
|
-
"default": 5000,
|
|
56
|
-
"minimum": 1024,
|
|
57
|
-
"maximum": 65535
|
|
58
|
-
}
|
|
194
|
+
"required": [],
|
|
195
|
+
"additionalProperties": false
|
|
59
196
|
}
|
|
60
197
|
}
|
|
61
198
|
]
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
requires = ["nodejs-24"]
|
|
3
3
|
|
|
4
4
|
[dev]
|
|
5
|
-
|
|
5
|
+
build = ["bash", "./scripts/prepare.sh"]
|
|
6
|
+
run = ["bash", "./scripts/dev.sh"]
|
|
6
7
|
deps = ["git"] # -> apt install git
|
|
7
8
|
|
|
8
9
|
[deploy]
|
|
9
|
-
build = ["
|
|
10
|
-
run = ["
|
|
10
|
+
build = ["bash","./scripts/build.sh"]
|
|
11
|
+
run = ["bash","./scripts/start.sh"]
|
|
11
12
|
deps = ["git"] # -> apt install git
|