@coze-arch/cli 0.0.1-alpha.d49256 → 0.0.1-alpha.d4acfb
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/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +1 -1
- package/lib/__templates__/expo/README.md +0 -1
- package/lib/__templates__/expo/client/contexts/AuthContext.tsx +5 -9
- package/lib/__templates__/expo/client/metro.config.js +3 -0
- package/lib/__templates__/expo/pnpm-lock.yaml +101 -45
- package/lib/__templates__/expo/server/package.json +9 -7
- 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/package.json +3 -1
- package/lib/__templates__/nextjs/pnpm-lock.yaml +119 -106
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +2 -2
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +4 -3
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +0 -15
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +117 -24
- package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -1
- package/lib/__templates__/taro/README.md +81 -17
- package/lib/__templates__/taro/config/index.ts +87 -37
- package/lib/__templates__/taro/config/prod.ts +4 -5
- package/lib/__templates__/taro/eslint.config.mjs +27 -4
- package/lib/__templates__/taro/package.json +16 -4
- package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
- package/lib/__templates__/taro/pnpm-lock.yaml +785 -115
- package/lib/__templates__/taro/server/package.json +3 -1
- package/lib/__templates__/taro/server/src/main.ts +14 -2
- package/lib/__templates__/taro/src/app.css +18 -18
- package/lib/__templates__/taro/src/app.tsx +9 -0
- package/lib/__templates__/taro/src/index.html +20 -1
- 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 +201 -0
- package/lib/__templates__/taro/src/presets/h5-styles.ts +142 -0
- package/lib/__templates__/taro/src/presets/index.tsx +18 -0
- package/lib/__templates__/templates.json +43 -0
- package/lib/__templates__/vite/package.json +5 -1
- package/lib/__templates__/vite/pnpm-lock.yaml +146 -1659
- package/lib/__templates__/vite/vite.config.ts +1 -0
- package/lib/__templates__/vite-vue/.coze +12 -0
- package/lib/__templates__/vite-vue/README.md +451 -0
- package/lib/__templates__/vite-vue/_gitignore +66 -0
- package/lib/__templates__/vite-vue/_npmrc +23 -0
- package/lib/__templates__/vite-vue/eslint.config.mjs +9 -0
- package/lib/__templates__/vite-vue/index.html +13 -0
- package/lib/__templates__/vite-vue/package.json +37 -0
- package/lib/__templates__/vite-vue/pnpm-lock.yaml +3151 -0
- package/lib/__templates__/vite-vue/postcss.config.mjs +6 -0
- package/lib/__templates__/vite-vue/scripts/build.sh +14 -0
- package/lib/__templates__/vite-vue/scripts/dev.sh +32 -0
- package/lib/__templates__/vite-vue/scripts/prepare.sh +9 -0
- package/lib/__templates__/vite-vue/scripts/start.sh +15 -0
- package/lib/__templates__/vite-vue/src/App.vue +6 -0
- package/lib/__templates__/vite-vue/src/index.css +29 -0
- package/lib/__templates__/vite-vue/src/main.ts +8 -0
- package/lib/__templates__/vite-vue/src/router/index.ts +17 -0
- package/lib/__templates__/vite-vue/src/views/Home.vue +37 -0
- package/lib/__templates__/vite-vue/src/vite-env.d.ts +8 -0
- package/lib/__templates__/vite-vue/tailwind.config.js +9 -0
- package/lib/__templates__/vite-vue/template.config.js +128 -0
- package/lib/__templates__/vite-vue/tsconfig.json +17 -0
- package/lib/__templates__/vite-vue/vite.config.ts +28 -0
- package/lib/cli.js +25 -65
- package/package.json +2 -1
- package/lib/__templates__/taro/src/app.ts +0 -14
- package/lib/__templates__/taro/src/utils/h5-styles.ts +0 -22
- package/lib/__templates__/taro/src/utils/wx-debug.ts +0 -23
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
# build_weapp.sh - 通过 PID 文件精确杀掉自己上次的构建进程
|
|
2
|
+
export OUTPUT_ROOT=dist
|
|
3
|
+
PID_FILE="/tmp/coze-build_weapp.pid"
|
|
4
|
+
|
|
5
|
+
# 杀掉上次的构建进程组
|
|
6
|
+
if [ -f "$PID_FILE" ]; then
|
|
7
|
+
OLD_PID=$(cat "$PID_FILE")
|
|
8
|
+
if kill -0 "$OLD_PID" 2>/dev/null; then
|
|
9
|
+
echo "正在终止上次的构建进程组 (PID: $OLD_PID)..."
|
|
10
|
+
# 关键:kill 负数 PID = 杀掉整个进程组
|
|
11
|
+
kill -9 -"$OLD_PID" 2>/dev/null
|
|
12
|
+
sleep 1
|
|
13
|
+
fi
|
|
14
|
+
rm -f "$PID_FILE"
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# 用 setsid 创建新的进程组,方便下次整组杀掉
|
|
18
|
+
setsid pnpm build:weapp &
|
|
19
|
+
echo $! > "$PID_FILE"
|
|
20
|
+
|
|
21
|
+
echo "构建已启动 (PID: $(cat $PID_FILE))"
|
|
22
|
+
|
|
23
|
+
wait $!
|
|
24
|
+
rm -f "$PID_FILE"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
- **样式**: TailwindCSS 4.1.18
|
|
11
11
|
- **Tailwind 适配层**: weapp-tailwindcss 4.9.2
|
|
12
12
|
- **状态管理**: Zustand 5.0.9
|
|
13
|
-
- **图标库**: lucide-react
|
|
13
|
+
- **图标库**: lucide-react-taro latest
|
|
14
14
|
- **工程化**: Vite 4.2.0
|
|
15
15
|
- **包管理**: pnpm
|
|
16
16
|
- **运行时**: Node.js >= 18
|
|
@@ -28,14 +28,16 @@
|
|
|
28
28
|
│ ├── dev.ts # 开发环境配置
|
|
29
29
|
│ └── prod.ts # 生产环境配置
|
|
30
30
|
├── server/ # NestJS 后端服务
|
|
31
|
-
│ └── src/
|
|
31
|
+
│ └── src/
|
|
32
32
|
│ ├── main.ts # 服务入口
|
|
33
33
|
│ ├── app.module.ts # 根模块
|
|
34
34
|
│ ├── app.controller.ts # 应用控制器
|
|
35
35
|
│ └── app.service.ts # 应用服务
|
|
36
36
|
├── src/ # 前端源码
|
|
37
37
|
│ ├── pages/ # 页面组件
|
|
38
|
+
│ ├── presets/ # 框架预置逻辑(无需读取,如无必要不改动)
|
|
38
39
|
│ ├── utils/ # 工具函数
|
|
40
|
+
│ ├── network.ts # 封装好的网络请求工具
|
|
39
41
|
│ ├── app.ts # 应用入口
|
|
40
42
|
│ ├── app.config.ts # 应用配置
|
|
41
43
|
│ └── app.css # 全局样式
|
|
@@ -237,8 +239,8 @@ Network 是对 Taro.request、Taro.uploadFile、Taro.downloadFile 的封装,
|
|
|
237
239
|
import { Network } from '@/network'
|
|
238
240
|
|
|
239
241
|
// GET 请求
|
|
240
|
-
const data = await Network.request({
|
|
241
|
-
url: '/api/hello'
|
|
242
|
+
const data = await Network.request({
|
|
243
|
+
url: '/api/hello'
|
|
242
244
|
})
|
|
243
245
|
|
|
244
246
|
// POST 请求
|
|
@@ -267,8 +269,8 @@ await Network.downloadFile({
|
|
|
267
269
|
import Taro from '@tarojs/taro'
|
|
268
270
|
|
|
269
271
|
// ❌ 会导致自动域名拼接无法生效,除非是特殊指定域名
|
|
270
|
-
const data = await Network.request({
|
|
271
|
-
url: 'http://localhost/api/hello'
|
|
272
|
+
const data = await Network.request({
|
|
273
|
+
url: 'http://localhost/api/hello'
|
|
272
274
|
})
|
|
273
275
|
|
|
274
276
|
// ❌ 不要直接使用 Taro.request
|
|
@@ -344,23 +346,29 @@ const router = useRouter()
|
|
|
344
346
|
const { id } = router.params
|
|
345
347
|
```
|
|
346
348
|
|
|
347
|
-
### 图标使用 (lucide-react)
|
|
349
|
+
### 图标使用 (lucide-react-taro)
|
|
350
|
+
|
|
351
|
+
**IMPORTANT: 禁止使用 lucide-react,必须使用 lucide-react-taro 替代。**
|
|
348
352
|
|
|
349
|
-
|
|
353
|
+
lucide-react-taro 是 Lucide 图标库的 Taro 适配版本,专为小程序环境优化,API 与 lucide-react 一致:
|
|
350
354
|
|
|
351
355
|
```tsx
|
|
352
356
|
import { View } from '@tarojs/components'
|
|
353
|
-
import {
|
|
357
|
+
import { House, Settings, User, Search, Camera, Zap } from 'lucide-react-taro'
|
|
354
358
|
|
|
355
359
|
const IconDemo = () => {
|
|
356
360
|
return (
|
|
357
361
|
<View className="flex gap-4">
|
|
358
|
-
|
|
359
|
-
<
|
|
360
|
-
|
|
361
|
-
<
|
|
362
|
-
|
|
363
|
-
<
|
|
362
|
+
{/* 基本用法 */}
|
|
363
|
+
<House />
|
|
364
|
+
{/* 自定义尺寸和颜色 */}
|
|
365
|
+
<Settings size={32} color="#1890ff" />
|
|
366
|
+
{/* 自定义描边宽度 */}
|
|
367
|
+
<User size={24} strokeWidth={1.5} />
|
|
368
|
+
{/* 绝对描边宽度(描边不随 size 缩放) */}
|
|
369
|
+
<Camera size={48} strokeWidth={2} absoluteStrokeWidth />
|
|
370
|
+
{/* 组合使用 */}
|
|
371
|
+
<Zap size={32} color="#ff6b00" strokeWidth={1.5} className="my-icon" />
|
|
364
372
|
</View>
|
|
365
373
|
)
|
|
366
374
|
}
|
|
@@ -368,12 +376,68 @@ const IconDemo = () => {
|
|
|
368
376
|
|
|
369
377
|
常用属性:
|
|
370
378
|
- `size` - 图标大小(默认 24)
|
|
371
|
-
- `color` -
|
|
379
|
+
- `color` - 图标颜色(默认 currentColor,小程序中建议显式设置)
|
|
372
380
|
- `strokeWidth` - 线条粗细(默认 2)
|
|
373
|
-
- `
|
|
381
|
+
- `absoluteStrokeWidth` - 绝对描边宽度,启用后描边不随 size 缩放
|
|
382
|
+
- `className` / `style` - 自定义样式
|
|
374
383
|
|
|
375
384
|
更多图标请访问:https://lucide.dev/icons
|
|
376
385
|
|
|
386
|
+
### TabBar 图标生成 (CLI 工具)
|
|
387
|
+
|
|
388
|
+
**IMPORTANT: 微信小程序的 TabBar 不支持 base64 或 SVG 图片,必须使用本地 PNG 文件。**
|
|
389
|
+
|
|
390
|
+
lucide-react-taro 提供了 CLI 工具来生成 TabBar 所需的 PNG 图标:
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
# 生成带选中状态的图标
|
|
394
|
+
npx taro-lucide-tabbar House Settings User -c "#999999" -a "#1890ff"
|
|
395
|
+
|
|
396
|
+
# 指定输出目录和尺寸
|
|
397
|
+
npx taro-lucide-tabbar House Settings User -c "#999999" -a "#1890ff" -o ./src/assets/tabbar -s 81
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
CLI 参数:
|
|
401
|
+
- `--color, -c` (默认 #000000): 图标颜色
|
|
402
|
+
- `--active-color, -a`: 选中状态颜色
|
|
403
|
+
- `--size, -s` (默认 81): 图标尺寸
|
|
404
|
+
- `--output, -o` (默认 ./tabbar-icons): 输出目录
|
|
405
|
+
- `--stroke-width` (默认 2): 描边宽度
|
|
406
|
+
|
|
407
|
+
在 `app.config.ts` 中使用生成的图标:
|
|
408
|
+
|
|
409
|
+
> IMPORTANT:iconPath 和 selectedIconPath 必须以 `./` 开头,否则图标无法渲染
|
|
410
|
+
|
|
411
|
+
```typescript
|
|
412
|
+
export default defineAppConfig({
|
|
413
|
+
tabBar: {
|
|
414
|
+
color: '#999999',
|
|
415
|
+
selectedColor: '#1890ff',
|
|
416
|
+
backgroundColor: '#ffffff',
|
|
417
|
+
borderStyle: 'black',
|
|
418
|
+
list: [
|
|
419
|
+
{
|
|
420
|
+
pagePath: 'pages/index/index',
|
|
421
|
+
text: '首页',
|
|
422
|
+
iconPath: './assets/tabbar/house.png',
|
|
423
|
+
selectedIconPath: './assets/tabbar/house-active.png',
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
pagePath: 'pages/settings/index',
|
|
427
|
+
text: '设置',
|
|
428
|
+
iconPath: './assets/tabbar/settings.png',
|
|
429
|
+
selectedIconPath: './assets/tabbar/settings-active.png',
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
pagePath: 'pages/user/index',
|
|
433
|
+
text: '用户',
|
|
434
|
+
iconPath: './assets/tabbar/user.png',
|
|
435
|
+
selectedIconPath: './assets/tabbar/user-active.png',
|
|
436
|
+
},
|
|
437
|
+
],
|
|
438
|
+
},
|
|
439
|
+
})
|
|
440
|
+
|
|
377
441
|
### Tailwind CSS 样式开发
|
|
378
442
|
|
|
379
443
|
IMPORTANT:必须使用 tailwindcss 实现样式,只有在必要情况下才能 fallback 到 css / less
|
|
@@ -1,22 +1,75 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
1
2
|
import path from 'node:path';
|
|
2
|
-
import dotenv from 'dotenv';
|
|
3
3
|
|
|
4
4
|
import tailwindcss from '@tailwindcss/postcss';
|
|
5
5
|
import { UnifiedViteWeappTailwindcssPlugin } from 'weapp-tailwindcss/vite';
|
|
6
6
|
import { defineConfig, type UserConfigExport } from '@tarojs/cli';
|
|
7
7
|
import type { PluginItem } from '@tarojs/taro/types/compile/config/project';
|
|
8
|
-
|
|
9
|
-
// 加载环境变量
|
|
10
|
-
dotenv.config({ path: path.resolve(__dirname, '../.env.local') });
|
|
11
|
-
|
|
8
|
+
import dotenv from 'dotenv';
|
|
12
9
|
import devConfig from './dev';
|
|
13
10
|
import prodConfig from './prod';
|
|
14
11
|
import pkg from '../package.json';
|
|
15
12
|
|
|
13
|
+
dotenv.config({ path: path.resolve(__dirname, '../.env.local') });
|
|
14
|
+
|
|
15
|
+
const generateTTProjectConfig = () => {
|
|
16
|
+
const config = {
|
|
17
|
+
miniprogramRoot: './',
|
|
18
|
+
projectname: '<%= appName %>',
|
|
19
|
+
appid: process.env.TARO_APP_TT_APPID || '',
|
|
20
|
+
setting: {
|
|
21
|
+
urlCheck: false,
|
|
22
|
+
es6: false,
|
|
23
|
+
postcss: false,
|
|
24
|
+
minified: false,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const outputDir = path.resolve(__dirname, '../dist-tt');
|
|
28
|
+
if (!fs.existsSync(outputDir)) {
|
|
29
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
fs.writeFileSync(
|
|
32
|
+
path.resolve(outputDir, 'project.config.json'),
|
|
33
|
+
JSON.stringify(config, null, 2),
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
16
37
|
// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数
|
|
17
38
|
export default defineConfig<'vite'>(async (merge, _env) => {
|
|
18
|
-
const
|
|
19
|
-
|
|
39
|
+
const outputRootMap: Record<string, string> = {
|
|
40
|
+
weapp: 'dist',
|
|
41
|
+
tt: 'dist-tt',
|
|
42
|
+
h5: 'dist-web',
|
|
43
|
+
};
|
|
44
|
+
const outputRoot = outputRootMap[process.env.TARO_ENV || ''] || 'dist-web';
|
|
45
|
+
|
|
46
|
+
const buildMiniCIPluginConfig = () => {
|
|
47
|
+
const hasWeappConfig = !!process.env.TARO_APP_WEAPP_APPID
|
|
48
|
+
const hasTTConfig = !!process.env.TARO_APP_TT_EMAIL
|
|
49
|
+
if (!hasWeappConfig && !hasTTConfig) {
|
|
50
|
+
return []
|
|
51
|
+
}
|
|
52
|
+
const miniCIConfig: Record<string, any> = {
|
|
53
|
+
version: pkg.version,
|
|
54
|
+
desc: pkg.description,
|
|
55
|
+
}
|
|
56
|
+
if (hasWeappConfig) {
|
|
57
|
+
miniCIConfig.weapp = {
|
|
58
|
+
appid: process.env.TARO_APP_WEAPP_APPID,
|
|
59
|
+
privateKeyPath: 'key/private.appid.key',
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (hasTTConfig) {
|
|
63
|
+
miniCIConfig.tt = {
|
|
64
|
+
email: process.env.TARO_APP_TT_EMAIL,
|
|
65
|
+
password: process.env.TARO_APP_TT_PASSWORD,
|
|
66
|
+
setting: {
|
|
67
|
+
skipDomainCheck: true,
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return [['@tarojs/plugin-mini-ci', miniCIConfig]] as PluginItem[]
|
|
72
|
+
}
|
|
20
73
|
|
|
21
74
|
const baseConfig: UserConfigExport<'vite'> = {
|
|
22
75
|
projectName: '<%= appName %>',
|
|
@@ -33,24 +86,7 @@ export default defineConfig<'vite'>(async (merge, _env) => {
|
|
|
33
86
|
},
|
|
34
87
|
sourceRoot: 'src',
|
|
35
88
|
outputRoot,
|
|
36
|
-
|
|
37
|
-
'@tarojs/plugin-generator',
|
|
38
|
-
...(process.env.TARO_APP_WEAPP_APPID
|
|
39
|
-
? ([
|
|
40
|
-
[
|
|
41
|
-
'@tarojs/plugin-mini-ci',
|
|
42
|
-
{
|
|
43
|
-
version: pkg.version,
|
|
44
|
-
desc: pkg.description,
|
|
45
|
-
weapp: {
|
|
46
|
-
appid: process.env.TARO_APP_WEAPP_APPID,
|
|
47
|
-
privateKeyPath: 'key/private.appid.key',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
] as PluginItem[])
|
|
52
|
-
: []),
|
|
53
|
-
],
|
|
89
|
+
plugins: ['@tarojs/plugin-generator', ...buildMiniCIPluginConfig()],
|
|
54
90
|
defineConstants: {
|
|
55
91
|
PROJECT_DOMAIN: JSON.stringify(
|
|
56
92
|
process.env.PROJECT_DOMAIN ||
|
|
@@ -63,6 +99,13 @@ export default defineConfig<'vite'>(async (merge, _env) => {
|
|
|
63
99
|
patterns: [],
|
|
64
100
|
options: {},
|
|
65
101
|
},
|
|
102
|
+
...(process.env.TARO_ENV === 'tt' && {
|
|
103
|
+
tt: {
|
|
104
|
+
appid: process.env.TARO_APP_TT_APPID,
|
|
105
|
+
projectName: '<%= appName %>',
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
jsMinimizer: 'esbuild',
|
|
66
109
|
framework: 'react',
|
|
67
110
|
compiler: {
|
|
68
111
|
type: 'vite',
|
|
@@ -97,11 +140,18 @@ export default defineConfig<'vite'>(async (merge, _env) => {
|
|
|
97
140
|
},
|
|
98
141
|
UnifiedViteWeappTailwindcssPlugin({
|
|
99
142
|
rem2rpx: true,
|
|
100
|
-
cssEntries: [
|
|
101
|
-
// 你 @import "tailwindcss"; 那个文件的绝对路径
|
|
102
|
-
path.resolve(__dirname, '../src/app.css'),
|
|
103
|
-
],
|
|
143
|
+
cssEntries: [path.resolve(__dirname, '../src/app.css')],
|
|
104
144
|
}),
|
|
145
|
+
...(process.env.TARO_ENV === 'tt'
|
|
146
|
+
? [
|
|
147
|
+
{
|
|
148
|
+
name: 'generate-tt-project-config',
|
|
149
|
+
closeBundle() {
|
|
150
|
+
generateTTProjectConfig();
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
]
|
|
154
|
+
: []),
|
|
105
155
|
],
|
|
106
156
|
},
|
|
107
157
|
mini: {
|
|
@@ -123,15 +173,15 @@ export default defineConfig<'vite'>(async (merge, _env) => {
|
|
|
123
173
|
publicPath: '/',
|
|
124
174
|
staticDirectory: 'static',
|
|
125
175
|
devServer: {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
176
|
+
port: <%= port %>,
|
|
177
|
+
host: '0.0.0.0',
|
|
178
|
+
open: false,
|
|
179
|
+
proxy: {
|
|
180
|
+
'/api': {
|
|
181
|
+
target: 'http://localhost:<%= serverPort %>',
|
|
182
|
+
changeOrigin: true,
|
|
134
183
|
},
|
|
184
|
+
},
|
|
135
185
|
},
|
|
136
186
|
miniCssExtractPluginOption: {
|
|
137
187
|
ignoreOrder: true,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { UserConfigExport } from
|
|
1
|
+
import type { UserConfigExport } from '@tarojs/cli';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
mini: {},
|
|
5
5
|
h5: {
|
|
6
|
-
|
|
7
|
-
legacy: true,
|
|
6
|
+
legacy: false,
|
|
8
7
|
/**
|
|
9
8
|
* WebpackChain 插件配置
|
|
10
9
|
* @docs https://github.com/neutrinojs/webpack-chain
|
|
@@ -31,5 +30,5 @@ export default {
|
|
|
31
30
|
// postProcess: (context) => ({ ...context, outputPath: path.join(staticDir, 'index.html') })
|
|
32
31
|
// }))
|
|
33
32
|
// }
|
|
34
|
-
}
|
|
35
|
-
} satisfies UserConfigExport<'vite'
|
|
33
|
+
},
|
|
34
|
+
} satisfies UserConfigExport<'vite'>;
|
|
@@ -16,6 +16,7 @@ export default [
|
|
|
16
16
|
'react/jsx-uses-react': 'off',
|
|
17
17
|
'react/react-in-jsx-scope': 'off',
|
|
18
18
|
'jsx-quotes': ['error', 'prefer-double'],
|
|
19
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
19
20
|
},
|
|
20
21
|
},
|
|
21
22
|
{
|
|
@@ -28,7 +29,13 @@ export default [
|
|
|
28
29
|
selector:
|
|
29
30
|
"MemberExpression[object.name='process'][property.name='env']",
|
|
30
31
|
message:
|
|
31
|
-
'请勿在 src 目录下直接使用 process.env\n如需获取 URL 请求前缀,请使用已经注入全局的 PROJECT_DOMAIN
|
|
32
|
+
'请勿在 src 目录下直接使用 process.env\n如需获取 URL 请求前缀,请使用已经注入全局的 PROJECT_DOMAIN',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
selector:
|
|
36
|
+
":matches(ExportNamedDeclaration, ExportDefaultDeclaration) :matches([id.name='Network'], [declaration.id.name='Network'])",
|
|
37
|
+
message:
|
|
38
|
+
"禁止自行定义 Network,项目已提供 src/network.ts,请直接使用: import { Network } from '@/network'",
|
|
32
39
|
},
|
|
33
40
|
],
|
|
34
41
|
'no-restricted-properties': [
|
|
@@ -36,17 +43,33 @@ export default [
|
|
|
36
43
|
{
|
|
37
44
|
object: 'Taro',
|
|
38
45
|
property: 'request',
|
|
39
|
-
message:
|
|
46
|
+
message:
|
|
47
|
+
"请使用 Network.request 替代 Taro.request,导入方式: import { Network } from '@/network'",
|
|
40
48
|
},
|
|
41
49
|
{
|
|
42
50
|
object: 'Taro',
|
|
43
51
|
property: 'uploadFile',
|
|
44
|
-
message:
|
|
52
|
+
message:
|
|
53
|
+
"请使用 Network.uploadFile 替代 Taro.uploadFile,导入方式: import { Network } from '@/network'",
|
|
45
54
|
},
|
|
46
55
|
{
|
|
47
56
|
object: 'Taro',
|
|
48
57
|
property: 'downloadFile',
|
|
49
|
-
message:
|
|
58
|
+
message:
|
|
59
|
+
"请使用 Network.downloadFile 替代 Taro.downloadFile,导入方式: import { Network } from '@/network'",
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
files: ['src/pages/index/index.tsx'],
|
|
66
|
+
rules: {
|
|
67
|
+
'no-restricted-syntax': [
|
|
68
|
+
'error',
|
|
69
|
+
{
|
|
70
|
+
selector: 'JSXText[value=/应用开发中/]',
|
|
71
|
+
message:
|
|
72
|
+
'检测到首页 (src/pages/index/index) 仍为默认占位页面,这会导致用户无法进入新增页面,请根据用户需求开发实际的首页功能和界面。如果已经开发了新的首页,也需要删除旧首页,并更新 src/app.config.ts 文件',
|
|
50
73
|
},
|
|
51
74
|
],
|
|
52
75
|
},
|
|
@@ -4,22 +4,27 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Coze Mini Program Application",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "pnpm exec concurrently -n lint,tsc,web,weapp,server -c red,blue,green,yellow,magenta \"pnpm lint:build\" \"pnpm tsc\" \"pnpm build:web\" \"pnpm build:weapp\" \"pnpm build:server\"",
|
|
7
|
+
"build": "pnpm exec concurrently --kill-others-on-fail --kill-signal SIGKILL -n lint,tsc,web,weapp,tt,server -c red,blue,green,yellow,cyan,magenta \"pnpm lint:build\" \"pnpm tsc\" \"pnpm build:web\" \"pnpm build:weapp\" \"pnpm build:tt\" \"pnpm build:server\"",
|
|
8
8
|
"build:server": "pnpm --filter server build",
|
|
9
|
+
"build:tt": "taro build --type tt",
|
|
9
10
|
"build:weapp": "taro build --type weapp",
|
|
10
11
|
"build:web": "taro build --type h5",
|
|
11
|
-
"dev": "pnpm exec concurrently -n web,server -c blue,green \"pnpm dev:web\" \"pnpm dev:server\"",
|
|
12
|
+
"dev": "pnpm exec concurrently --kill-others --kill-signal SIGKILL -n web,server -c blue,green \"pnpm dev:web\" \"pnpm dev:server\"",
|
|
12
13
|
"dev:server": "pnpm --filter server dev",
|
|
14
|
+
"dev:tt": "taro build --type tt --watch",
|
|
13
15
|
"dev:weapp": "taro build --type weapp --watch",
|
|
14
16
|
"dev:web": "taro build --type h5 --watch",
|
|
15
17
|
"preinstall": "npx only-allow pnpm",
|
|
16
18
|
"postinstall": "weapp-tw patch",
|
|
19
|
+
"kill:all": "pkill -9 -f 'concurrently' 2>/dev/null || true; pkill -9 -f 'nest start' 2>/dev/null || true; pkill -9 -f 'taro build' 2>/dev/null || true; pkill -9 -f 'node.*dev' 2>/dev/null || true; echo 'All dev processes cleaned'",
|
|
17
20
|
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
18
21
|
"lint:build": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --max-warnings=0",
|
|
19
22
|
"lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --fix",
|
|
20
23
|
"new": "taro new",
|
|
24
|
+
"preview:tt": "taro build --type tt --preview",
|
|
21
25
|
"preview:weapp": "taro build --type weapp --preview",
|
|
22
|
-
"tsc": "npx tsc --noEmit --skipLibCheck"
|
|
26
|
+
"tsc": "npx tsc --noEmit --skipLibCheck",
|
|
27
|
+
"validate": "pnpm exec concurrently --kill-others-on-fail --kill-signal SIGKILL -n lint,tsc -c red,blue \"pnpm lint:build\" \"pnpm tsc\""
|
|
23
28
|
},
|
|
24
29
|
"lint-staged": {
|
|
25
30
|
"src/**/*.{js,jsx,ts,tsx}": [
|
|
@@ -37,13 +42,14 @@
|
|
|
37
42
|
"@tarojs/helper": "4.1.9",
|
|
38
43
|
"@tarojs/plugin-framework-react": "4.1.9",
|
|
39
44
|
"@tarojs/plugin-platform-h5": "4.1.9",
|
|
45
|
+
"@tarojs/plugin-platform-tt": "4.1.9",
|
|
40
46
|
"@tarojs/plugin-platform-weapp": "4.1.9",
|
|
41
47
|
"@tarojs/react": "4.1.9",
|
|
42
48
|
"@tarojs/runtime": "4.1.9",
|
|
43
49
|
"@tarojs/shared": "4.1.9",
|
|
44
50
|
"@tarojs/taro": "4.1.9",
|
|
45
51
|
"drizzle-kit": "^0.31.8",
|
|
46
|
-
"lucide-react": "^
|
|
52
|
+
"lucide-react-taro": "^1.2.0",
|
|
47
53
|
"react": "^18.0.0",
|
|
48
54
|
"react-dom": "^18.0.0",
|
|
49
55
|
"zustand": "^5.0.9"
|
|
@@ -78,6 +84,7 @@
|
|
|
78
84
|
"stylelint-config-standard": "^38.0.0",
|
|
79
85
|
"tailwindcss": "^4.1.18",
|
|
80
86
|
"terser": "^5.30.4",
|
|
87
|
+
"tt-ide-cli": "^0.1.31",
|
|
81
88
|
"typescript": "^5.4.5",
|
|
82
89
|
"vite": "^4.2.0",
|
|
83
90
|
"weapp-tailwindcss": "^4.9.2"
|
|
@@ -86,6 +93,11 @@
|
|
|
86
93
|
"engines": {
|
|
87
94
|
"pnpm": ">=9.0.0"
|
|
88
95
|
},
|
|
96
|
+
"pnpm": {
|
|
97
|
+
"patchedDependencies": {
|
|
98
|
+
"@tarojs/plugin-mini-ci@4.1.9": "patches/@tarojs__plugin-mini-ci@4.1.9.patch"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
89
101
|
"templateInfo": {
|
|
90
102
|
"name": "default",
|
|
91
103
|
"typescript": true,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
diff --git a/dist/TTCI.js b/dist/TTCI.js
|
|
2
|
+
index e5fe6a5f9a0ca8670ffa2b7e14cdfd8d49d0d792..6f24020a3388ea8fc7d1cbc41c1df104a8c37cb8 100644
|
|
3
|
+
--- a/dist/TTCI.js
|
|
4
|
+
+++ b/dist/TTCI.js
|
|
5
|
+
@@ -63,7 +63,10 @@ class TTCI extends BaseCi_1.default {
|
|
6
|
+
output: previewQrcodePath,
|
|
7
|
+
},
|
|
8
|
+
copyToClipboard: true,
|
|
9
|
+
- cache: true
|
|
10
|
+
+ cache: true,
|
|
11
|
+
+ ideConfig: {
|
|
12
|
+
+ skipDomainCheck: this.pluginOpts.tt && this.pluginOpts.tt.setting && this.pluginOpts.tt.setting.skipDomainCheck
|
|
13
|
+
+ }
|
|
14
|
+
});
|
|
15
|
+
console.log(chalk.green(`开发版上传成功 ${new Date().toLocaleString()}\n`));
|
|
16
|
+
const qrContent = previewResult.shortUrl;
|
|
17
|
+
diff --git a/dist/index.js b/dist/index.js
|
|
18
|
+
index bb245e34a477bcd738b18fdd754b252a456efe4f..588fe56131be52de2d798ee959ef257b4fa53313 100644
|
|
19
|
+
--- a/dist/index.js
|
|
20
|
+
+++ b/dist/index.js
|
|
21
|
+
@@ -43,7 +43,8 @@ exports.default = (ctx, _pluginOpts) => {
|
|
22
|
+
/** 字节跳动小程序上传配置 */
|
|
23
|
+
tt: joi.object({
|
|
24
|
+
email: joi.string().required(),
|
|
25
|
+
- password: joi.string().required()
|
|
26
|
+
+ password: joi.string().required(),
|
|
27
|
+
+ setting: joi.object()
|
|
28
|
+
}),
|
|
29
|
+
/** 阿里小程序上传配置 */
|
|
30
|
+
alipay: joi.alternatives().try(joi.object({
|