@coze-arch/cli 0.0.1-alpha.d85d9d → 0.0.1-alpha.de5a13
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/dev_run.sh +13 -12
- package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +9 -8
- package/lib/__templates__/expo/client/package.json +35 -35
- package/lib/__templates__/expo/client/screens/demo/index.tsx +3 -3
- package/lib/__templates__/expo/package.json +1 -1
- package/lib/__templates__/expo/patches/{expo@54.0.32.patch → expo@54.0.33.patch} +3 -2
- package/lib/__templates__/expo/pnpm-lock.yaml +336 -1735
- package/lib/__templates__/expo/server/package.json +9 -7
- package/lib/__templates__/expo/server/src/index.ts +1 -0
- package/lib/__templates__/expo/template.config.js +56 -0
- package/lib/__templates__/nextjs/.babelrc +0 -3
- package/lib/__templates__/nextjs/package.json +3 -1
- package/lib/__templates__/nextjs/pnpm-lock.yaml +116 -106
- package/lib/__templates__/nextjs/src/app/page.tsx +18 -60
- package/lib/__templates__/nextjs/template.config.js +49 -14
- package/lib/__templates__/taro/.coze +1 -1
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +5 -6
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +6 -8
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +0 -15
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +28 -5
- package/lib/__templates__/taro/_gitignore +40 -0
- package/lib/__templates__/taro/_npmrc +18 -0
- package/lib/__templates__/taro/config/index.ts +3 -2
- package/lib/__templates__/taro/eslint.config.mjs +57 -0
- package/lib/__templates__/taro/package.json +30 -32
- package/lib/__templates__/taro/pnpm-lock.yaml +466 -679
- package/lib/__templates__/taro/server/package.json +8 -7
- package/lib/__templates__/taro/server/src/main.ts +14 -2
- package/lib/__templates__/taro/src/app.css +29 -18
- package/lib/__templates__/taro/src/app.ts +11 -25
- package/lib/__templates__/taro/src/index.html +20 -1
- package/lib/__templates__/taro/src/pages/index/index.tsx +14 -11
- package/lib/__templates__/taro/src/utils/wx-debug.ts +23 -0
- package/lib/__templates__/vite/package.json +3 -1
- package/lib/__templates__/vite/pnpm-lock.yaml +142 -1659
- package/lib/__templates__/vite/src/main.ts +17 -47
- package/lib/__templates__/vite/template.config.js +49 -14
- package/lib/cli.js +42 -62
- package/package.json +1 -1
- package/lib/__templates__/taro/.eslintrc +0 -40
- package/lib/__templates__/taro/commitlint.config.mjs +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Metadata } from 'next';
|
|
2
2
|
import Image from 'next/image';
|
|
3
|
-
import { Button } from '@/components/ui/button';
|
|
4
3
|
|
|
5
4
|
export const metadata: Metadata = {
|
|
6
5
|
title: '扣子编程 - AI 开发伙伴',
|
|
@@ -9,68 +8,27 @@ export const metadata: Metadata = {
|
|
|
9
8
|
|
|
10
9
|
export default function Home() {
|
|
11
10
|
return (
|
|
12
|
-
<div className="flex
|
|
11
|
+
<div className="flex h-full items-center justify-center bg-background text-foreground transition-colors duration-300 dark:bg-background dark:text-foreground overflow-hidden min-h-screen">
|
|
13
12
|
{/* 主容器 */}
|
|
14
|
-
<main className="flex
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/
|
|
13
|
+
<main className="flex w-full h-full max-w-3xl flex-col items-center justify-center px-16 py-32 sm:items-center">
|
|
14
|
+
<div className="flex flex-col items-center justify-between gap-4">
|
|
15
|
+
<Image
|
|
16
|
+
className="dark:invert"
|
|
17
|
+
src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif"
|
|
19
18
|
alt="扣子编程 Logo"
|
|
20
|
-
width={
|
|
21
|
-
height={
|
|
22
|
-
unoptimized
|
|
19
|
+
width={156}
|
|
20
|
+
height={130}
|
|
23
21
|
/>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</
|
|
34
|
-
<p className="max-w-2xl text-lg leading-8 text-muted-foreground dark:text-muted-foreground">
|
|
35
|
-
当前是空白入口文件,项目正在开发中,请稍候...
|
|
36
|
-
<br />
|
|
37
|
-
开发完成后界面将自动更新。如未自动更新成功,可以手动点击右上角刷新或重启按钮查看效果。
|
|
38
|
-
</p>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
{/* 底部按钮区 */}
|
|
42
|
-
<div className="flex w-full flex-col gap-4 text-base font-medium sm:w-auto sm:flex-row">
|
|
43
|
-
{/* 按钮 1:前往首页 */}
|
|
44
|
-
<Button
|
|
45
|
-
asChild
|
|
46
|
-
variant="default"
|
|
47
|
-
size="lg"
|
|
48
|
-
className="h-12 min-w-[160px] rounded-full px-8"
|
|
49
|
-
>
|
|
50
|
-
<a
|
|
51
|
-
href="https://code.coze.cn/"
|
|
52
|
-
target="_blank"
|
|
53
|
-
rel="noopener noreferrer"
|
|
54
|
-
>
|
|
55
|
-
前往首页
|
|
56
|
-
</a>
|
|
57
|
-
</Button>
|
|
58
|
-
|
|
59
|
-
{/* 按钮 2:查看文档 */}
|
|
60
|
-
<Button
|
|
61
|
-
asChild
|
|
62
|
-
variant="outline"
|
|
63
|
-
size="lg"
|
|
64
|
-
className="h-12 min-w-[160px] rounded-full px-8"
|
|
65
|
-
>
|
|
66
|
-
<a
|
|
67
|
-
href="https://docs.coze.cn/"
|
|
68
|
-
target="_blank"
|
|
69
|
-
rel="noopener noreferrer"
|
|
70
|
-
>
|
|
71
|
-
查看文档
|
|
72
|
-
</a>
|
|
73
|
-
</Button>
|
|
22
|
+
<div>
|
|
23
|
+
<div className="flex flex-col items-center gap-2 text-center sm:items-center sm:text-center">
|
|
24
|
+
<h1 className="max-w-xl text-base font-semibold leading-tight tracking-tight text-foreground dark:text-foreground">
|
|
25
|
+
应用开发中
|
|
26
|
+
</h1>
|
|
27
|
+
<p className="max-w-2xl text-sm-14 leading-8 text-muted-foreground dark:text-muted-foreground">
|
|
28
|
+
请稍后,页面即将呈现
|
|
29
|
+
</p>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
74
32
|
</div>
|
|
75
33
|
</main>
|
|
76
34
|
</div>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { resolve } from 'path';
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
import { resolve, join, basename } from 'path';
|
|
5
|
+
import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
@@ -52,32 +53,66 @@ const config = {
|
|
|
52
53
|
return context;
|
|
53
54
|
},
|
|
54
55
|
|
|
55
|
-
onAfterRender: async (
|
|
56
|
+
onAfterRender: async (_context, outputPath) => {
|
|
56
57
|
console.log(`\nProject created at: ${outputPath}`);
|
|
57
58
|
console.log('\nConfiguration:');
|
|
58
59
|
console.log(' - Framework: Next.js');
|
|
59
60
|
console.log(' - TypeScript: enabled');
|
|
60
61
|
console.log(' - App Router: enabled');
|
|
61
|
-
console.log(` - Port: ${
|
|
62
|
+
console.log(` - Port: ${_context.port}`);
|
|
63
|
+
},
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
onComplete: async (_context, outputPath) => {
|
|
66
|
+
// Skip pnpm update in test environment to avoid monorepo workspace issues
|
|
64
67
|
if (process.env.NODE_ENV === 'test') {
|
|
65
68
|
console.log('⊘ Skipping dependency update in test environment');
|
|
66
69
|
return;
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
const cmd =
|
|
70
|
-
|
|
72
|
+
const cmd = 'pnpm';
|
|
73
|
+
const args = ['update', 'coze-coding-dev-sdk@^0.7.0'];
|
|
74
|
+
console.log(
|
|
75
|
+
`\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
|
|
76
|
+
);
|
|
77
|
+
|
|
71
78
|
try {
|
|
72
79
|
const projectRoot = resolve(outputPath);
|
|
73
|
-
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
|
|
81
|
+
// Determine log directory
|
|
82
|
+
const logDir = process.env.COZE_LOG_DIR || resolve(__dirname, '../.log');
|
|
83
|
+
mkdirSync(logDir, { recursive: true });
|
|
84
|
+
|
|
85
|
+
// Use project name in log file to avoid conflicts
|
|
86
|
+
const projectName = basename(projectRoot);
|
|
87
|
+
const logFile = join(logDir, `${projectName}-init.log`);
|
|
88
|
+
|
|
89
|
+
// Write log header
|
|
90
|
+
const timestamp = new Date().toISOString();
|
|
91
|
+
appendFileSync(
|
|
92
|
+
logFile,
|
|
93
|
+
`\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// Open log file for appending
|
|
97
|
+
const logFd = openSync(logFile, 'a');
|
|
98
|
+
|
|
99
|
+
// Spawn in detached mode
|
|
100
|
+
const child = spawn(cmd, args, {
|
|
101
|
+
cwd: projectRoot,
|
|
102
|
+
detached: true,
|
|
103
|
+
stdio: ['ignore', logFd, logFd],
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
child.unref();
|
|
107
|
+
closeSync(logFd);
|
|
108
|
+
|
|
109
|
+
console.log(
|
|
110
|
+
'✓ coze-coding-dev-sdk update triggered (running in background)',
|
|
111
|
+
);
|
|
112
|
+
console.log(` Log file: ${logFile}`);
|
|
78
113
|
} catch (error) {
|
|
79
|
-
console.error('✗ Failed to
|
|
80
|
-
|
|
114
|
+
console.error('✗ Failed to trigger coze-coding-dev-sdk update:', error);
|
|
115
|
+
console.log(' You can manually run: pnpm update coze-coding-dev-sdk');
|
|
81
116
|
}
|
|
82
117
|
},
|
|
83
118
|
};
|
|
@@ -6,7 +6,7 @@ requires = ["nodejs-24"]
|
|
|
6
6
|
build = ["bash", ".cozeproj/scripts/dev_build.sh"]
|
|
7
7
|
run = ["bash", ".cozeproj/scripts/dev_run.sh"]
|
|
8
8
|
deps = ["git"] # -> apt install git
|
|
9
|
-
pack = ["bash", "/
|
|
9
|
+
pack = ["bash", ".cozeproj/scripts/pack.sh"]
|
|
10
10
|
|
|
11
11
|
[deploy]
|
|
12
12
|
build = ["bash", ".cozeproj/scripts/deploy_build.sh"]
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
set -Eeuo pipefail
|
|
3
3
|
|
|
4
4
|
cd "${COZE_WORKSPACE_PATH}"
|
|
5
|
-
if [ -f "./.cozeproj/init_env.sh" ]; then
|
|
5
|
+
if [ -f "./.cozeproj/scripts/init_env.sh" ]; then
|
|
6
6
|
echo "⚙️ Initializing environment..."
|
|
7
7
|
# 使用 bash 执行,确保即使没有 x 权限也能跑
|
|
8
|
-
bash ./.cozeproj/init_env.sh
|
|
8
|
+
bash ./.cozeproj/scripts/init_env.sh
|
|
9
9
|
else
|
|
10
10
|
echo "⚠️ Warning: init_env.sh not found, skipping environment init."
|
|
11
11
|
fi
|
|
@@ -13,8 +13,7 @@ echo "Installing dependencies..."
|
|
|
13
13
|
# 安装所有依赖(包含 Taro 核心和 React)
|
|
14
14
|
pnpm install
|
|
15
15
|
|
|
16
|
-
echo "Building the Taro
|
|
17
|
-
|
|
18
|
-
pnpm run build:h5
|
|
16
|
+
echo "Building the Taro project..."
|
|
17
|
+
pnpm build
|
|
19
18
|
|
|
20
|
-
echo "Build completed successfully! Assets are in /dist"
|
|
19
|
+
echo "Build completed successfully! Assets are in /dist"
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
set -Eeuo pipefail
|
|
3
3
|
|
|
4
4
|
start_service() {
|
|
5
|
-
|
|
6
|
-
cd "${COZE_WORKSPACE_PATH}/dist"
|
|
5
|
+
cd "${COZE_WORKSPACE_PATH}/server/dist"
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
local port="${DEPLOY_RUN_PORT:-3000}"
|
|
8
|
+
echo "Starting Static File Server on port ${port} for deploy..."
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
# 这样平台访问这个端口时,就能看到你的 H5 页面了
|
|
12
|
-
python3 -m http.server "${DEPLOY_RUN_PORT}"
|
|
10
|
+
node ./main.js -p "${port}"
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
echo "Starting HTTP service
|
|
16
|
-
start_service
|
|
13
|
+
echo "Starting HTTP service for deploy..."
|
|
14
|
+
start_service
|
|
@@ -1,17 +1,2 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
set -Eeuo pipefail
|
|
3
|
-
|
|
4
|
-
cd "${COZE_WORKSPACE_PATH}"
|
|
5
|
-
if [ -f "./.cozeproj/init_env.sh" ]; then
|
|
6
|
-
echo "⚙️ Initializing environment..."
|
|
7
|
-
# 使用 bash 执行,确保即使没有 x 权限也能跑
|
|
8
|
-
bash ./.cozeproj/init_env.sh
|
|
9
|
-
else
|
|
10
|
-
echo "⚠️ Warning: init_env.sh not found, skipping environment init."
|
|
11
|
-
fi
|
|
12
|
-
|
|
13
|
-
echo "Installing dependencies..."
|
|
14
|
-
pnpm install --offline --frozen-lockfile --reporter=silent || \
|
|
15
|
-
pnpm install --reporter=silent
|
|
16
|
-
|
|
17
|
-
echo "Dependencies installed successfully!"
|
|
@@ -5,6 +5,10 @@ set -Eeuo pipefail
|
|
|
5
5
|
|
|
6
6
|
cd "${COZE_WORKSPACE_PATH}"
|
|
7
7
|
|
|
8
|
+
echo "📦 Installing dependencies..."
|
|
9
|
+
pnpm install
|
|
10
|
+
echo "✅ Dependencies installed successfully!"
|
|
11
|
+
|
|
8
12
|
kill_port_if_listening() {
|
|
9
13
|
local port=$1
|
|
10
14
|
local pids
|
|
@@ -13,17 +17,33 @@ kill_port_if_listening() {
|
|
|
13
17
|
echo "Port ${port} is free."
|
|
14
18
|
return
|
|
15
19
|
fi
|
|
16
|
-
echo "Port ${port} in use by PIDs: ${pids}
|
|
17
|
-
|
|
20
|
+
echo "Port ${port} in use by PIDs: ${pids}"
|
|
21
|
+
for pid in ${pids}; do
|
|
22
|
+
kill_process_group "${pid}"
|
|
23
|
+
done
|
|
18
24
|
sleep 1
|
|
19
25
|
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${port}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
20
26
|
if [[ -n "${pids}" ]]; then
|
|
21
|
-
echo "Warning: port ${port} still busy after
|
|
27
|
+
echo "Warning: port ${port} still busy after cleanup, PIDs: ${pids}"
|
|
22
28
|
else
|
|
23
29
|
echo "Port ${port} cleared."
|
|
24
30
|
fi
|
|
25
31
|
}
|
|
26
32
|
|
|
33
|
+
kill_process_group() {
|
|
34
|
+
local pid=$1
|
|
35
|
+
local pgid
|
|
36
|
+
pgid=$(ps -o pgid= -p "${pid}" 2>/dev/null | tr -d ' ' || true)
|
|
37
|
+
if [[ -n "${pgid}" && "${pgid}" != "0" ]]; then
|
|
38
|
+
echo "Killing process group ${pgid} (from PID ${pid})"
|
|
39
|
+
kill -9 -"${pgid}" 2>/dev/null || true
|
|
40
|
+
fi
|
|
41
|
+
if kill -0 "${pid}" 2>/dev/null; then
|
|
42
|
+
echo "Killing PID ${pid} directly"
|
|
43
|
+
kill -9 "${pid}" 2>/dev/null || true
|
|
44
|
+
fi
|
|
45
|
+
}
|
|
46
|
+
|
|
27
47
|
start_service() {
|
|
28
48
|
cd "${COZE_WORKSPACE_PATH}"
|
|
29
49
|
|
|
@@ -45,7 +65,10 @@ start_service() {
|
|
|
45
65
|
# ⚠️ 重要:为了让 Taro 使用平台动态分配的端口
|
|
46
66
|
export PORT=${DEPLOY_RUN_PORT}
|
|
47
67
|
|
|
48
|
-
|
|
68
|
+
rm -f /tmp/coze-logs/dev.log
|
|
69
|
+
mkdir -p /tmp/coze-logs
|
|
70
|
+
|
|
71
|
+
exec pnpm dev 2>&1 | tee /tmp/coze-logs/dev.log
|
|
49
72
|
}
|
|
50
73
|
|
|
51
74
|
SERVER_PORT=<%= serverPort %>
|
|
@@ -55,4 +78,4 @@ kill_port_if_listening "${DEPLOY_RUN_PORT}"
|
|
|
55
78
|
echo "Clearing port ${SERVER_PORT} (server) before start."
|
|
56
79
|
kill_port_if_listening "${SERVER_PORT}"
|
|
57
80
|
echo "Starting HTTP services on port ${DEPLOY_RUN_PORT} (web) and ${SERVER_PORT} (server)..."
|
|
58
|
-
start_service
|
|
81
|
+
start_service
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
.pnpm-store/
|
|
4
|
+
|
|
5
|
+
# Production
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
dist-*/
|
|
9
|
+
|
|
10
|
+
# Misc
|
|
11
|
+
.DS_Store
|
|
12
|
+
.env
|
|
13
|
+
# .env.local
|
|
14
|
+
.env.development.local
|
|
15
|
+
.env.test.local
|
|
16
|
+
.env.production.local
|
|
17
|
+
|
|
18
|
+
# Logs
|
|
19
|
+
npm-debug.log*
|
|
20
|
+
yarn-debug.log*
|
|
21
|
+
yarn-error.log*
|
|
22
|
+
pnpm-debug.log*
|
|
23
|
+
|
|
24
|
+
# Editor directories and files
|
|
25
|
+
.idea/
|
|
26
|
+
.vscode/
|
|
27
|
+
*.suo
|
|
28
|
+
*.ntvs*
|
|
29
|
+
*.njsproj
|
|
30
|
+
*.sln
|
|
31
|
+
*.sw?
|
|
32
|
+
|
|
33
|
+
# Taro specific
|
|
34
|
+
.taro/
|
|
35
|
+
|
|
36
|
+
# OS X
|
|
37
|
+
.DS_Store
|
|
38
|
+
|
|
39
|
+
# Key
|
|
40
|
+
# key/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
loglevel=error
|
|
2
|
+
registry=https://registry.npmmirror.com
|
|
3
|
+
|
|
4
|
+
strictStorePkgContentCheck=false
|
|
5
|
+
verifyStoreIntegrity=false
|
|
6
|
+
|
|
7
|
+
network-concurrency=16
|
|
8
|
+
fetch-retries=3
|
|
9
|
+
fetch-timeout=60000
|
|
10
|
+
|
|
11
|
+
strict-peer-dependencies=false
|
|
12
|
+
|
|
13
|
+
auto-install-peers=true
|
|
14
|
+
|
|
15
|
+
lockfile=true
|
|
16
|
+
prefer-frozen-lockfile=true
|
|
17
|
+
|
|
18
|
+
resolution-mode=highest
|
|
@@ -4,6 +4,7 @@ import dotenv from 'dotenv';
|
|
|
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
|
+
import type { PluginItem } from '@tarojs/taro/types/compile/config/project';
|
|
7
8
|
|
|
8
9
|
// 加载环境变量
|
|
9
10
|
dotenv.config({ path: path.resolve(__dirname, '../.env.local') });
|
|
@@ -35,7 +36,7 @@ export default defineConfig<'vite'>(async (merge, _env) => {
|
|
|
35
36
|
plugins: [
|
|
36
37
|
'@tarojs/plugin-generator',
|
|
37
38
|
...(process.env.TARO_APP_WEAPP_APPID
|
|
38
|
-
? [
|
|
39
|
+
? ([
|
|
39
40
|
[
|
|
40
41
|
'@tarojs/plugin-mini-ci',
|
|
41
42
|
{
|
|
@@ -47,7 +48,7 @@ export default defineConfig<'vite'>(async (merge, _env) => {
|
|
|
47
48
|
},
|
|
48
49
|
},
|
|
49
50
|
],
|
|
50
|
-
]
|
|
51
|
+
] as PluginItem[])
|
|
51
52
|
: []),
|
|
52
53
|
],
|
|
53
54
|
defineConstants: {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { FlatCompat } from '@eslint/eslintrc';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
|
|
8
|
+
const compat = new FlatCompat({
|
|
9
|
+
baseDirectory: __dirname,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export default [
|
|
13
|
+
...compat.extends('taro/react'),
|
|
14
|
+
{
|
|
15
|
+
rules: {
|
|
16
|
+
'react/jsx-uses-react': 'off',
|
|
17
|
+
'react/react-in-jsx-scope': 'off',
|
|
18
|
+
'jsx-quotes': ['error', 'prefer-double'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
files: ['src/**/*.{js,jsx,ts,tsx}'],
|
|
23
|
+
ignores: ['src/network.ts'],
|
|
24
|
+
rules: {
|
|
25
|
+
'no-restricted-syntax': [
|
|
26
|
+
'error',
|
|
27
|
+
{
|
|
28
|
+
selector:
|
|
29
|
+
"MemberExpression[object.name='process'][property.name='env']",
|
|
30
|
+
message:
|
|
31
|
+
'请勿在 src 目录下直接使用 process.env\n如需获取 URL 请求前缀,请使用已经注入全局的 PROJECT_DOMAIN()',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
'no-restricted-properties': [
|
|
35
|
+
'error',
|
|
36
|
+
{
|
|
37
|
+
object: 'Taro',
|
|
38
|
+
property: 'request',
|
|
39
|
+
message: '请使用 Network.request 替代 Taro.request',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
object: 'Taro',
|
|
43
|
+
property: 'uploadFile',
|
|
44
|
+
message: '请使用 Network.uploadFile 替代 Taro.uploadFile',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
object: 'Taro',
|
|
48
|
+
property: 'downloadFile',
|
|
49
|
+
message: '请使用 Network.downloadFile 替代 Taro.downloadFile',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
ignores: ['dist/**', 'dist-*/**', 'node_modules/**'],
|
|
56
|
+
},
|
|
57
|
+
];
|
|
@@ -3,29 +3,28 @@
|
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Coze Mini Program Application",
|
|
6
|
-
"templateInfo": {
|
|
7
|
-
"name": "default",
|
|
8
|
-
"typescript": true,
|
|
9
|
-
"css": "Less",
|
|
10
|
-
"framework": "React"
|
|
11
|
-
},
|
|
12
6
|
"scripts": {
|
|
13
|
-
"dev": "pnpm exec concurrently -n web,server -c blue,green \"pnpm dev:web\" \"pnpm dev:server\"",
|
|
14
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\"",
|
|
15
|
-
"
|
|
8
|
+
"build:server": "pnpm --filter server build",
|
|
9
|
+
"build:weapp": "taro build --type weapp",
|
|
10
|
+
"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:server": "pnpm --filter server dev",
|
|
13
|
+
"dev:weapp": "taro build --type weapp --watch",
|
|
14
|
+
"dev:web": "taro build --type h5 --watch",
|
|
15
|
+
"preinstall": "npx only-allow pnpm",
|
|
16
16
|
"postinstall": "weapp-tw patch",
|
|
17
|
-
"new": "taro new",
|
|
18
|
-
"prepare": "husky",
|
|
19
17
|
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
20
18
|
"lint:build": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --max-warnings=0",
|
|
21
19
|
"lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --fix",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
20
|
+
"new": "taro new",
|
|
21
|
+
"preview:weapp": "taro build --type weapp --preview",
|
|
22
|
+
"tsc": "npx tsc --noEmit --skipLibCheck"
|
|
23
|
+
},
|
|
24
|
+
"lint-staged": {
|
|
25
|
+
"src/**/*.{js,jsx,ts,tsx}": [
|
|
26
|
+
"eslint"
|
|
27
|
+
]
|
|
29
28
|
},
|
|
30
29
|
"browserslist": [
|
|
31
30
|
"last 3 versions",
|
|
@@ -37,30 +36,24 @@
|
|
|
37
36
|
"@tarojs/components": "4.1.9",
|
|
38
37
|
"@tarojs/helper": "4.1.9",
|
|
39
38
|
"@tarojs/plugin-framework-react": "4.1.9",
|
|
40
|
-
"@tarojs/plugin-platform-alipay": "4.1.9",
|
|
41
39
|
"@tarojs/plugin-platform-h5": "4.1.9",
|
|
42
|
-
"@tarojs/plugin-platform-harmony-hybrid": "4.1.9",
|
|
43
|
-
"@tarojs/plugin-platform-jd": "4.1.9",
|
|
44
|
-
"@tarojs/plugin-platform-qq": "4.1.9",
|
|
45
|
-
"@tarojs/plugin-platform-swan": "4.1.9",
|
|
46
|
-
"@tarojs/plugin-platform-tt": "4.1.9",
|
|
47
40
|
"@tarojs/plugin-platform-weapp": "4.1.9",
|
|
48
41
|
"@tarojs/react": "4.1.9",
|
|
49
42
|
"@tarojs/runtime": "4.1.9",
|
|
50
43
|
"@tarojs/shared": "4.1.9",
|
|
51
44
|
"@tarojs/taro": "4.1.9",
|
|
45
|
+
"drizzle-kit": "^0.31.8",
|
|
52
46
|
"lucide-react": "^0.511.0",
|
|
53
47
|
"react": "^18.0.0",
|
|
54
48
|
"react-dom": "^18.0.0",
|
|
55
|
-
"drizzle-kit": "^0.31.8",
|
|
56
49
|
"zustand": "^5.0.9"
|
|
57
50
|
},
|
|
58
51
|
"devDependencies": {
|
|
59
52
|
"@babel/core": "^7.24.4",
|
|
60
53
|
"@babel/plugin-transform-class-properties": "7.25.9",
|
|
61
54
|
"@babel/preset-react": "^7.24.1",
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
55
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
56
|
+
"@supabase/supabase-js": "2.95.3",
|
|
64
57
|
"@tailwindcss/postcss": "^4.1.18",
|
|
65
58
|
"@tarojs/cli": "4.1.9",
|
|
66
59
|
"@tarojs/plugin-generator": "4.1.9",
|
|
@@ -76,10 +69,10 @@
|
|
|
76
69
|
"eslint-config-taro": "4.1.9",
|
|
77
70
|
"eslint-plugin-react": "^7.34.1",
|
|
78
71
|
"eslint-plugin-react-hooks": "^4.4.0",
|
|
79
|
-
"husky": "^9.1.7",
|
|
80
72
|
"less": "^4.2.0",
|
|
81
73
|
"lint-staged": "^16.1.2",
|
|
82
74
|
"miniprogram-ci": "^2.1.26",
|
|
75
|
+
"only-allow": "^1.2.2",
|
|
83
76
|
"postcss": "^8.5.6",
|
|
84
77
|
"react-refresh": "^0.14.0",
|
|
85
78
|
"stylelint": "^16.4.0",
|
|
@@ -90,9 +83,14 @@
|
|
|
90
83
|
"vite": "^4.2.0",
|
|
91
84
|
"weapp-tailwindcss": "^4.9.2"
|
|
92
85
|
},
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
"packageManager": "pnpm@9.0.0",
|
|
87
|
+
"engines": {
|
|
88
|
+
"pnpm": ">=9.0.0"
|
|
89
|
+
},
|
|
90
|
+
"templateInfo": {
|
|
91
|
+
"name": "default",
|
|
92
|
+
"typescript": true,
|
|
93
|
+
"css": "Less",
|
|
94
|
+
"framework": "React"
|
|
97
95
|
}
|
|
98
|
-
}
|
|
96
|
+
}
|