@coze-arch/cli 0.0.1-beta.5
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 +142 -0
- package/bin/main +2 -0
- package/lib/__templates__/expo/.coze +7 -0
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_build.sh +109 -0
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +257 -0
- package/lib/__templates__/expo/README.md +13 -0
- package/lib/__templates__/expo/_gitignore +11 -0
- package/lib/__templates__/expo/app.json +63 -0
- package/lib/__templates__/expo/babel.config.js +9 -0
- package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +43 -0
- package/lib/__templates__/expo/client/app/(tabs)/home.tsx +1 -0
- package/lib/__templates__/expo/client/app/(tabs)/index.tsx +7 -0
- package/lib/__templates__/expo/client/app/+not-found.tsx +79 -0
- package/lib/__templates__/expo/client/app/_layout.tsx +33 -0
- package/lib/__templates__/expo/client/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/lib/__templates__/expo/client/assets/images/adaptive-icon.png +0 -0
- package/lib/__templates__/expo/client/assets/images/default-avatar.png +0 -0
- package/lib/__templates__/expo/client/assets/images/favicon.png +0 -0
- package/lib/__templates__/expo/client/assets/images/icon.png +0 -0
- package/lib/__templates__/expo/client/assets/images/partial-react-logo.png +0 -0
- package/lib/__templates__/expo/client/assets/images/react-logo.png +0 -0
- package/lib/__templates__/expo/client/assets/images/react-logo@2x.png +0 -0
- package/lib/__templates__/expo/client/assets/images/react-logo@3x.png +0 -0
- package/lib/__templates__/expo/client/assets/images/splash-icon.png +0 -0
- package/lib/__templates__/expo/client/components/Screen.tsx +330 -0
- package/lib/__templates__/expo/client/components/SmartDateInput.tsx +238 -0
- package/lib/__templates__/expo/client/constants/theme.ts +118 -0
- package/lib/__templates__/expo/client/contexts/AuthContext.tsx +142 -0
- package/lib/__templates__/expo/client/hooks/useColorScheme.ts +1 -0
- package/lib/__templates__/expo/client/hooks/useTheme.ts +13 -0
- package/lib/__templates__/expo/client/index.js +11 -0
- package/lib/__templates__/expo/client/screens/home/index.tsx +54 -0
- package/lib/__templates__/expo/client/screens/home/styles.ts +332 -0
- package/lib/__templates__/expo/client/scripts/install-missing-deps.js +80 -0
- package/lib/__templates__/expo/client/utils/index.ts +55 -0
- package/lib/__templates__/expo/eslint-formatter-simple.mjs +49 -0
- package/lib/__templates__/expo/eslint.config.mjs +98 -0
- package/lib/__templates__/expo/metro.config.js +53 -0
- package/lib/__templates__/expo/package.json +100 -0
- package/lib/__templates__/expo/pnpm-lock.yaml +13978 -0
- package/lib/__templates__/expo/src/index.ts +12 -0
- package/lib/__templates__/expo/template.config.js +49 -0
- package/lib/__templates__/expo/tsconfig.json +24 -0
- package/lib/__templates__/nextjs/.coze +11 -0
- package/lib/__templates__/nextjs/.vscode/settings.json +121 -0
- package/lib/__templates__/nextjs/README.md +36 -0
- package/lib/__templates__/nextjs/_gitignore +99 -0
- package/lib/__templates__/nextjs/_npmrc +22 -0
- package/lib/__templates__/nextjs/eslint.config.mjs +18 -0
- package/lib/__templates__/nextjs/next-env.d.ts +6 -0
- package/lib/__templates__/nextjs/next.config.ts +7 -0
- package/lib/__templates__/nextjs/package.json +32 -0
- package/lib/__templates__/nextjs/pnpm-lock.yaml +4061 -0
- package/lib/__templates__/nextjs/postcss.config.mjs +7 -0
- package/lib/__templates__/nextjs/public/file.svg +1 -0
- package/lib/__templates__/nextjs/public/globe.svg +1 -0
- package/lib/__templates__/nextjs/public/next.svg +1 -0
- package/lib/__templates__/nextjs/public/vercel.svg +1 -0
- package/lib/__templates__/nextjs/public/window.svg +1 -0
- package/lib/__templates__/nextjs/scripts/build.sh +14 -0
- package/lib/__templates__/nextjs/scripts/dev.sh +51 -0
- package/lib/__templates__/nextjs/scripts/start.sh +15 -0
- package/lib/__templates__/nextjs/src/app/favicon.ico +0 -0
- package/lib/__templates__/nextjs/src/app/globals.css +26 -0
- package/lib/__templates__/nextjs/src/app/layout.tsx +34 -0
- package/lib/__templates__/nextjs/src/app/page.tsx +66 -0
- package/lib/__templates__/nextjs/template.config.js +55 -0
- package/lib/__templates__/nextjs/tsconfig.json +34 -0
- package/lib/__templates__/react-rsbuild/.coze +11 -0
- package/lib/__templates__/react-rsbuild/.vscode/settings.json +121 -0
- package/lib/__templates__/react-rsbuild/README.md +61 -0
- package/lib/__templates__/react-rsbuild/_gitignore +97 -0
- package/lib/__templates__/react-rsbuild/_npmrc +22 -0
- package/lib/__templates__/react-rsbuild/package.json +31 -0
- package/lib/__templates__/react-rsbuild/pnpm-lock.yaml +997 -0
- package/lib/__templates__/react-rsbuild/rsbuild.config.ts +13 -0
- package/lib/__templates__/react-rsbuild/scripts/build.sh +14 -0
- package/lib/__templates__/react-rsbuild/scripts/dev.sh +51 -0
- package/lib/__templates__/react-rsbuild/scripts/start.sh +15 -0
- package/lib/__templates__/react-rsbuild/src/App.tsx +60 -0
- package/lib/__templates__/react-rsbuild/src/index.css +21 -0
- package/lib/__templates__/react-rsbuild/src/index.html +12 -0
- package/lib/__templates__/react-rsbuild/src/index.tsx +16 -0
- package/lib/__templates__/react-rsbuild/tailwind.config.js +9 -0
- package/lib/__templates__/react-rsbuild/template.config.js +54 -0
- package/lib/__templates__/react-rsbuild/tsconfig.json +17 -0
- package/lib/__templates__/rsbuild/.coze +11 -0
- package/lib/__templates__/rsbuild/.vscode/settings.json +7 -0
- package/lib/__templates__/rsbuild/README.md +61 -0
- package/lib/__templates__/rsbuild/_gitignore +97 -0
- package/lib/__templates__/rsbuild/_npmrc +22 -0
- package/lib/__templates__/rsbuild/package.json +24 -0
- package/lib/__templates__/rsbuild/pnpm-lock.yaml +888 -0
- package/lib/__templates__/rsbuild/rsbuild.config.ts +12 -0
- package/lib/__templates__/rsbuild/scripts/build.sh +14 -0
- package/lib/__templates__/rsbuild/scripts/dev.sh +51 -0
- package/lib/__templates__/rsbuild/scripts/start.sh +15 -0
- package/lib/__templates__/rsbuild/src/index.css +21 -0
- package/lib/__templates__/rsbuild/src/index.html +12 -0
- package/lib/__templates__/rsbuild/src/index.ts +5 -0
- package/lib/__templates__/rsbuild/src/main.ts +65 -0
- package/lib/__templates__/rsbuild/tailwind.config.js +9 -0
- package/lib/__templates__/rsbuild/template.config.js +54 -0
- package/lib/__templates__/rsbuild/tsconfig.json +16 -0
- package/lib/__templates__/templates.json +100 -0
- package/lib/__templates__/vite/.coze +11 -0
- package/lib/__templates__/vite/.vscode/settings.json +7 -0
- package/lib/__templates__/vite/README.md +61 -0
- package/lib/__templates__/vite/_gitignore +66 -0
- package/lib/__templates__/vite/_npmrc +22 -0
- package/lib/__templates__/vite/index.html +13 -0
- package/lib/__templates__/vite/package.json +24 -0
- package/lib/__templates__/vite/pnpm-lock.yaml +1249 -0
- package/lib/__templates__/vite/postcss.config.js +6 -0
- package/lib/__templates__/vite/scripts/build.sh +14 -0
- package/lib/__templates__/vite/scripts/dev.sh +51 -0
- package/lib/__templates__/vite/scripts/start.sh +15 -0
- package/lib/__templates__/vite/src/index.css +21 -0
- package/lib/__templates__/vite/src/index.ts +5 -0
- package/lib/__templates__/vite/src/main.ts +65 -0
- package/lib/__templates__/vite/tailwind.config.js +9 -0
- package/lib/__templates__/vite/template.config.js +55 -0
- package/lib/__templates__/vite/tsconfig.json +16 -0
- package/lib/__templates__/vite/vite.config.ts +15 -0
- package/lib/cli.js +1575 -0
- package/package.json +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -Eeuo pipefail
|
|
3
|
+
|
|
4
|
+
COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
|
|
5
|
+
|
|
6
|
+
cd "${COZE_WORKSPACE_PATH}"
|
|
7
|
+
|
|
8
|
+
echo "Installing dependencies..."
|
|
9
|
+
pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
10
|
+
|
|
11
|
+
echo "Building the project..."
|
|
12
|
+
npx next build
|
|
13
|
+
|
|
14
|
+
echo "Build completed successfully!"
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -Eeuo pipefail
|
|
3
|
+
|
|
4
|
+
PORT=<%= port %>
|
|
5
|
+
COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
|
|
6
|
+
|
|
7
|
+
cd "${COZE_WORKSPACE_PATH}"
|
|
8
|
+
|
|
9
|
+
kill_port_if_listening() {
|
|
10
|
+
local pids
|
|
11
|
+
|
|
12
|
+
# Check if lsof is available (macOS/BSD) or ss (Linux)
|
|
13
|
+
if command -v lsof >/dev/null 2>&1; then
|
|
14
|
+
# macOS/BSD using lsof
|
|
15
|
+
pids=$(lsof -ti:${PORT} 2>/dev/null || true)
|
|
16
|
+
elif command -v ss >/dev/null 2>&1; then
|
|
17
|
+
# Linux using ss
|
|
18
|
+
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
19
|
+
else
|
|
20
|
+
echo "Warning: neither lsof nor ss found, cannot check port ${PORT}"
|
|
21
|
+
return
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
if [[ -z "${pids}" ]]; then
|
|
25
|
+
echo "Port ${PORT} is free."
|
|
26
|
+
return
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
echo "Port ${PORT} in use by PIDs: ${pids} (SIGKILL)"
|
|
30
|
+
echo "${pids}" | xargs -I {} kill -9 {}
|
|
31
|
+
sleep 1
|
|
32
|
+
|
|
33
|
+
# Verify port is cleared
|
|
34
|
+
if command -v lsof >/dev/null 2>&1; then
|
|
35
|
+
pids=$(lsof -ti:${PORT} 2>/dev/null || true)
|
|
36
|
+
elif command -v ss >/dev/null 2>&1; then
|
|
37
|
+
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
if [[ -n "${pids}" ]]; then
|
|
41
|
+
echo "Warning: port ${PORT} still busy after SIGKILL, PIDs: ${pids}"
|
|
42
|
+
else
|
|
43
|
+
echo "Port ${PORT} cleared."
|
|
44
|
+
fi
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
echo "Clearing port ${PORT} before start."
|
|
48
|
+
kill_port_if_listening
|
|
49
|
+
echo "Starting HTTP service on port ${PORT} for dev..."
|
|
50
|
+
|
|
51
|
+
npx next dev -p $PORT
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -Eeuo pipefail
|
|
3
|
+
|
|
4
|
+
COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
|
|
5
|
+
PORT=<%= port %>
|
|
6
|
+
DEPLOY_RUN_PORT="${DEPLOY_RUN_PORT:-$PORT}"
|
|
7
|
+
|
|
8
|
+
start_service() {
|
|
9
|
+
cd "${COZE_WORKSPACE_PATH}"
|
|
10
|
+
echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for deploy..."
|
|
11
|
+
npx next start --port ${DEPLOY_RUN_PORT}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for deploy..."
|
|
15
|
+
start_service
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--background: #ffffff;
|
|
5
|
+
--foreground: #171717;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@theme inline {
|
|
9
|
+
--color-background: var(--background);
|
|
10
|
+
--color-foreground: var(--foreground);
|
|
11
|
+
--font-sans: var(--font-geist-sans);
|
|
12
|
+
--font-mono: var(--font-geist-mono);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@media (prefers-color-scheme: dark) {
|
|
16
|
+
:root {
|
|
17
|
+
--background: #0a0a0a;
|
|
18
|
+
--foreground: #ededed;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
body {
|
|
23
|
+
background: var(--background);
|
|
24
|
+
color: var(--foreground);
|
|
25
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Metadata } from 'next';
|
|
2
|
+
import { Geist, Geist_Mono } from 'next/font/google';
|
|
3
|
+
import './globals.css';
|
|
4
|
+
|
|
5
|
+
const geistSans = Geist({
|
|
6
|
+
variable: '--font-geist-sans',
|
|
7
|
+
subsets: ['latin'],
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const geistMono = Geist_Mono({
|
|
11
|
+
variable: '--font-geist-mono',
|
|
12
|
+
subsets: ['latin'],
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const metadata: Metadata = {
|
|
16
|
+
title: 'Create Next App',
|
|
17
|
+
description: 'Generated by create next app',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default function RootLayout({
|
|
21
|
+
children,
|
|
22
|
+
}: Readonly<{
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
}>) {
|
|
25
|
+
return (
|
|
26
|
+
<html lang="en">
|
|
27
|
+
<body
|
|
28
|
+
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Metadata } from 'next';
|
|
2
|
+
|
|
3
|
+
export const metadata: Metadata = {
|
|
4
|
+
title: '扣子编程 - AI 开发伙伴',
|
|
5
|
+
description: '扣子编程,你的 AI 开发伙伴已就位',
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default function Home() {
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex min-h-screen items-center justify-center bg-white text-black transition-colors duration-300 dark:bg-black dark:text-white">
|
|
11
|
+
{/* 主容器 */}
|
|
12
|
+
<main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between px-16 py-32 sm:items-start">
|
|
13
|
+
{/* 头部:Logo 和 产品名称 */}
|
|
14
|
+
<div className="flex items-center gap-3">
|
|
15
|
+
{/* 注意:生产环境建议使用 next/image 并配置 remotePatterns */}
|
|
16
|
+
<img
|
|
17
|
+
className="dark:invert"
|
|
18
|
+
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/hkpzboz/coze_logo.png"
|
|
19
|
+
alt="扣子编程 Logo"
|
|
20
|
+
width={40}
|
|
21
|
+
height={40}
|
|
22
|
+
style={{ width: '40px', height: '40px', objectFit: 'contain' }}
|
|
23
|
+
/>
|
|
24
|
+
<span className="text-xl font-bold tracking-tight text-black dark:text-zinc-50">
|
|
25
|
+
扣子编程
|
|
26
|
+
</span>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
{/* 中间内容区:主标题和副标题 */}
|
|
30
|
+
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
|
31
|
+
<h1 className="max-w-xl text-4xl font-semibold leading-tight tracking-tight text-black dark:text-zinc-50">
|
|
32
|
+
扣子编程,你的 AI 开发伙伴已就位
|
|
33
|
+
</h1>
|
|
34
|
+
<p className="max-w-2xl text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
|
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
|
+
<a
|
|
45
|
+
className="flex h-12 w-full min-w-[160px] items-center justify-center gap-2 rounded-full bg-black px-8 text-white transition-colors hover:bg-zinc-800 dark:bg-white dark:text-black dark:hover:bg-zinc-200 md:w-auto"
|
|
46
|
+
href="https://code.coze.cn/"
|
|
47
|
+
target="_blank"
|
|
48
|
+
rel="noopener noreferrer"
|
|
49
|
+
>
|
|
50
|
+
前往首页
|
|
51
|
+
</a>
|
|
52
|
+
|
|
53
|
+
{/* 按钮 2:查看文档 */}
|
|
54
|
+
<a
|
|
55
|
+
className="flex h-12 w-full min-w-[160px] items-center justify-center rounded-full border border-solid border-black/[.08] px-8 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-auto"
|
|
56
|
+
href="https://docs.coze.cn/"
|
|
57
|
+
target="_blank"
|
|
58
|
+
rel="noopener noreferrer"
|
|
59
|
+
>
|
|
60
|
+
查看文档
|
|
61
|
+
</a>
|
|
62
|
+
</div>
|
|
63
|
+
</main>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export const paramsSchema = {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
appName: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
minLength: 1,
|
|
15
|
+
pattern: '^[a-z0-9-]+$',
|
|
16
|
+
description:
|
|
17
|
+
'Application name (lowercase, alphanumeric and hyphens only)',
|
|
18
|
+
},
|
|
19
|
+
port: {
|
|
20
|
+
type: 'number',
|
|
21
|
+
default: 3000,
|
|
22
|
+
minimum: 1024,
|
|
23
|
+
maximum: 65535,
|
|
24
|
+
description: 'Development server port (for Next.js dev server)',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
required: [],
|
|
28
|
+
additionalProperties: false,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const config = {
|
|
32
|
+
paramsSchema,
|
|
33
|
+
|
|
34
|
+
// 显式定义默认参数,确保在渲染时可用
|
|
35
|
+
defaultParams: {
|
|
36
|
+
port: 3000,
|
|
37
|
+
appName: 'my-nextjs-app',
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
onBeforeRender: async context => {
|
|
41
|
+
console.log(`Creating Next.js project: ${context.appName}`);
|
|
42
|
+
return context;
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
onAfterRender: async (context, outputPath) => {
|
|
46
|
+
console.log(`\nProject created at: ${outputPath}`);
|
|
47
|
+
console.log('\nConfiguration:');
|
|
48
|
+
console.log(' - Framework: Next.js');
|
|
49
|
+
console.log(' - TypeScript: enabled');
|
|
50
|
+
console.log(' - App Router: enabled');
|
|
51
|
+
console.log(` - Port: ${context.port}`);
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default config;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"plugins": [
|
|
17
|
+
{
|
|
18
|
+
"name": "next"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"paths": {
|
|
22
|
+
"@/*": ["./src/*"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"next-env.d.ts",
|
|
27
|
+
"**/*.ts",
|
|
28
|
+
"**/*.tsx",
|
|
29
|
+
".next/types/**/*.ts",
|
|
30
|
+
".next/dev/types/**/*.ts",
|
|
31
|
+
"**/*.mts"
|
|
32
|
+
],
|
|
33
|
+
"exclude": ["node_modules"]
|
|
34
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"[css]": {
|
|
3
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
4
|
+
},
|
|
5
|
+
"[dotenv]": {
|
|
6
|
+
"editor.defaultFormatter": "foxundermoon.shell-format"
|
|
7
|
+
},
|
|
8
|
+
"[html]": {
|
|
9
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
10
|
+
},
|
|
11
|
+
"[ignore]": {
|
|
12
|
+
"editor.defaultFormatter": "foxundermoon.shell-format"
|
|
13
|
+
},
|
|
14
|
+
"[javascript]": {
|
|
15
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
16
|
+
},
|
|
17
|
+
"[javascriptreact]": {
|
|
18
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
19
|
+
},
|
|
20
|
+
"[json]": {
|
|
21
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
22
|
+
},
|
|
23
|
+
"[jsonc]": {
|
|
24
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
25
|
+
},
|
|
26
|
+
"[less]": {
|
|
27
|
+
"editor.defaultFormatter": "stylelint.vscode-stylelint"
|
|
28
|
+
},
|
|
29
|
+
"[scss]": {
|
|
30
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
31
|
+
},
|
|
32
|
+
"[shellscript]": {
|
|
33
|
+
"editor.defaultFormatter": "foxundermoon.shell-format"
|
|
34
|
+
},
|
|
35
|
+
"[sql]": {
|
|
36
|
+
"editor.defaultFormatter": "adpyke.vscode-sql-formatter"
|
|
37
|
+
},
|
|
38
|
+
"[svg]": {
|
|
39
|
+
"editor.defaultFormatter": "jock.svg"
|
|
40
|
+
},
|
|
41
|
+
"[typescript]": {
|
|
42
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
43
|
+
},
|
|
44
|
+
"[typescriptreact]": {
|
|
45
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
46
|
+
},
|
|
47
|
+
"[xml]": {
|
|
48
|
+
"editor.defaultFormatter": "mblode.pretty-formatter"
|
|
49
|
+
},
|
|
50
|
+
"[yaml]": {
|
|
51
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
52
|
+
},
|
|
53
|
+
"cSpell.diagnosticLevel": "Warning",
|
|
54
|
+
"css.validate": false,
|
|
55
|
+
"editor.codeActionsOnSave": {
|
|
56
|
+
"source.fixAll": "never",
|
|
57
|
+
"source.fixAll.eslint": "explicit",
|
|
58
|
+
"source.organizeImports": "never",
|
|
59
|
+
"source.removeUnused": "never",
|
|
60
|
+
"source.removeUnused.ts": "never",
|
|
61
|
+
"source.removeUnusedImports": "never",
|
|
62
|
+
"source.sort.json": "never"
|
|
63
|
+
// "source.sortImports": "always"
|
|
64
|
+
},
|
|
65
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
66
|
+
"editor.formatOnPaste": false,
|
|
67
|
+
"editor.formatOnSave": true,
|
|
68
|
+
"editor.formatOnType": false,
|
|
69
|
+
"editor.insertSpaces": true,
|
|
70
|
+
"editor.minimap.enabled": true,
|
|
71
|
+
//
|
|
72
|
+
"editor.rulers": [80, 120],
|
|
73
|
+
"editor.semanticHighlighting.enabled": false,
|
|
74
|
+
"editor.tabSize": 2,
|
|
75
|
+
"emmet.triggerExpansionOnTab": true,
|
|
76
|
+
"files.associations": {
|
|
77
|
+
".babelrc": "json",
|
|
78
|
+
".code-workspace": "jsonc",
|
|
79
|
+
".eslintrc": "jsonc",
|
|
80
|
+
".eslintrc*.json": "jsonc",
|
|
81
|
+
".htmlhintrc": "jsonc",
|
|
82
|
+
".stylelintrc": "javascript",
|
|
83
|
+
"*.json": "jsonc",
|
|
84
|
+
"*.log": "plaintext",
|
|
85
|
+
"*.map": "plaintext",
|
|
86
|
+
"**/coverage/**/*.*": "plaintext",
|
|
87
|
+
"**/pnpm-lock.yaml": "plaintext",
|
|
88
|
+
"htmlhintrc": "jsonc",
|
|
89
|
+
"package.json": "json",
|
|
90
|
+
"README": "markdown",
|
|
91
|
+
"stylelintrc": "jsonc",
|
|
92
|
+
".coze": "toml"
|
|
93
|
+
},
|
|
94
|
+
"files.defaultLanguage": "plaintext",
|
|
95
|
+
"files.eol": "\n",
|
|
96
|
+
"files.exclude": {
|
|
97
|
+
"**/.DS_Store": true,
|
|
98
|
+
"**/.git": true,
|
|
99
|
+
"**/.hg": true,
|
|
100
|
+
"**/.svn": true,
|
|
101
|
+
// "**/.lintcache": true,
|
|
102
|
+
"**/.swc": true,
|
|
103
|
+
"**/CVS": true,
|
|
104
|
+
"**/Thumbs.db": true
|
|
105
|
+
},
|
|
106
|
+
"files.insertFinalNewline": true,
|
|
107
|
+
"files.trimTrailingWhitespace": true,
|
|
108
|
+
"files.watcherExclude": {
|
|
109
|
+
"**/.git/objects/**": true,
|
|
110
|
+
"**/.git/subtree-cache/**": true,
|
|
111
|
+
"**/node_modules/*/**": true
|
|
112
|
+
},
|
|
113
|
+
"git.openRepositoryInParentFolders": "always",
|
|
114
|
+
"search.exclude": {
|
|
115
|
+
"**/dist": true,
|
|
116
|
+
"**/node_modules": true
|
|
117
|
+
},
|
|
118
|
+
// "editor.formatOnSaveMode": "modificationsIfAvailable",
|
|
119
|
+
"search.followSymlinks": false,
|
|
120
|
+
"search.useIgnoreFiles": true
|
|
121
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# <%= appName %>
|
|
2
|
+
|
|
3
|
+
React + TypeScript application built with Rsbuild.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
Install dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Start development server:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run dev
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or use coze-coding CLI:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
coze-coding dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Build
|
|
26
|
+
|
|
27
|
+
Build for production:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm run build
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
coze-coding build
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Preview
|
|
40
|
+
|
|
41
|
+
Preview production build:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm run preview
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
coze-coding start
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Configuration
|
|
54
|
+
|
|
55
|
+
- Dev Server Port: <%= port %>
|
|
56
|
+
|
|
57
|
+
## Tech Stack
|
|
58
|
+
|
|
59
|
+
- React 18
|
|
60
|
+
- TypeScript
|
|
61
|
+
- Rsbuild
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
|
|
6
|
+
# Production build
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
out/
|
|
10
|
+
.next/
|
|
11
|
+
.rsbuild/
|
|
12
|
+
|
|
13
|
+
# Testing
|
|
14
|
+
coverage/
|
|
15
|
+
*.lcov
|
|
16
|
+
.nyc_output
|
|
17
|
+
|
|
18
|
+
# Environment variables
|
|
19
|
+
.env
|
|
20
|
+
.env.local
|
|
21
|
+
.env.development.local
|
|
22
|
+
.env.test.local
|
|
23
|
+
.env.production.local
|
|
24
|
+
|
|
25
|
+
# Logs
|
|
26
|
+
logs/
|
|
27
|
+
*.log
|
|
28
|
+
npm-debug.log*
|
|
29
|
+
yarn-debug.log*
|
|
30
|
+
yarn-error.log*
|
|
31
|
+
pnpm-debug.log*
|
|
32
|
+
lerna-debug.log*
|
|
33
|
+
|
|
34
|
+
# Runtime data
|
|
35
|
+
pids
|
|
36
|
+
*.pid
|
|
37
|
+
*.seed
|
|
38
|
+
*.pid.lock
|
|
39
|
+
|
|
40
|
+
# Diagnostic reports
|
|
41
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
42
|
+
|
|
43
|
+
# Cache
|
|
44
|
+
.cache/
|
|
45
|
+
.parcel-cache/
|
|
46
|
+
.eslintcache
|
|
47
|
+
.stylelintcache
|
|
48
|
+
.npm
|
|
49
|
+
.yarn/cache
|
|
50
|
+
.yarn/unplugged
|
|
51
|
+
.yarn/build-state.yml
|
|
52
|
+
.yarn/install-state.gz
|
|
53
|
+
|
|
54
|
+
# Editor directories and files
|
|
55
|
+
.vscode/*
|
|
56
|
+
!.vscode/extensions.json
|
|
57
|
+
!.vscode/settings.json
|
|
58
|
+
.idea/
|
|
59
|
+
*.suo
|
|
60
|
+
*.ntvs*
|
|
61
|
+
*.njsproj
|
|
62
|
+
*.sln
|
|
63
|
+
*.sw?
|
|
64
|
+
*.swp
|
|
65
|
+
*.swo
|
|
66
|
+
*~
|
|
67
|
+
|
|
68
|
+
# OS files
|
|
69
|
+
.DS_Store
|
|
70
|
+
.DS_Store?
|
|
71
|
+
._*
|
|
72
|
+
.Spotlight-V100
|
|
73
|
+
.Trashes
|
|
74
|
+
ehthumbs.db
|
|
75
|
+
Thumbs.db
|
|
76
|
+
Desktop.ini
|
|
77
|
+
|
|
78
|
+
# Temporary files
|
|
79
|
+
*.tmp
|
|
80
|
+
*.temp
|
|
81
|
+
.tmp/
|
|
82
|
+
.temp/
|
|
83
|
+
|
|
84
|
+
# Optional files
|
|
85
|
+
*.tgz
|
|
86
|
+
*.gz
|
|
87
|
+
*.zip
|
|
88
|
+
*.tar
|
|
89
|
+
|
|
90
|
+
# TypeScript
|
|
91
|
+
*.tsbuildinfo
|
|
92
|
+
|
|
93
|
+
# Misc
|
|
94
|
+
.vercel
|
|
95
|
+
.turbo
|
|
96
|
+
|
|
97
|
+
.coze-logs
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
registry=https://registry.npmjs.org
|
|
2
|
+
|
|
3
|
+
strictStorePkgContentCheck=false
|
|
4
|
+
verifyStoreIntegrity=false
|
|
5
|
+
|
|
6
|
+
# 网络优化
|
|
7
|
+
network-concurrency=16
|
|
8
|
+
fetch-retries=3
|
|
9
|
+
fetch-timeout=60000
|
|
10
|
+
|
|
11
|
+
# 严格使用 peer dependencies
|
|
12
|
+
strict-peer-dependencies=false
|
|
13
|
+
|
|
14
|
+
# 自动生成 lockfile
|
|
15
|
+
auto-install-peers=true
|
|
16
|
+
|
|
17
|
+
# lockfile 配置
|
|
18
|
+
lockfile=true
|
|
19
|
+
prefer-frozen-lockfile=true
|
|
20
|
+
|
|
21
|
+
# 如果 lockfile 存在但过期,更新而不是失败
|
|
22
|
+
resolution-mode=highest
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= appName %>",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "React application with Rsbuild",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "bash ./scripts/build.sh",
|
|
8
|
+
"dev": "bash ./scripts/dev.sh",
|
|
9
|
+
"preinstall": "npx only-allow pnpm",
|
|
10
|
+
"lint": "eslint",
|
|
11
|
+
"start": "bash ./scripts/start.sh"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"react": "^19",
|
|
15
|
+
"react-dom": "^19"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@rsbuild/core": "^1.1.0",
|
|
19
|
+
"@rsbuild/plugin-react": "^1.0.2",
|
|
20
|
+
"@types/react": "^19",
|
|
21
|
+
"@types/react-dom": "^19",
|
|
22
|
+
"only-allow": "^1.2.2",
|
|
23
|
+
"rsbuild-plugin-tailwindcss": "^0.2.1",
|
|
24
|
+
"tailwindcss": "^3.4.17",
|
|
25
|
+
"typescript": "^5.6.0"
|
|
26
|
+
},
|
|
27
|
+
"packageManager": "pnpm@9.0.0",
|
|
28
|
+
"engines": {
|
|
29
|
+
"pnpm": ">=9.0.0"
|
|
30
|
+
}
|
|
31
|
+
}
|