@coze-arch/cli 0.0.1-alpha.a3fb1a → 0.0.1-alpha.d5effa
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/deploy_build.sh +4 -3
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +8 -40
- package/lib/__templates__/expo/_npmrc +1 -1
- package/lib/__templates__/expo/client/contexts/AuthContext.tsx +14 -107
- package/lib/__templates__/expo/client/screens/home/index.tsx +1 -4
- package/lib/__templates__/expo/client/screens/home/styles.ts +1 -273
- package/lib/__templates__/expo/client/utils/index.ts +1 -2
- package/lib/__templates__/expo/package.json +1 -1
- package/lib/__templates__/expo/pnpm-lock.yaml +5 -5
- package/lib/__templates__/expo/src/index.ts +2 -2
- package/lib/__templates__/expo/template.config.js +1 -1
- package/lib/__templates__/nextjs/_npmrc +1 -1
- package/lib/__templates__/nextjs/package.json +1 -4
- package/lib/__templates__/nextjs/pnpm-lock.yaml +5 -1025
- package/lib/__templates__/nextjs/scripts/dev.sh +8 -27
- package/lib/__templates__/nextjs/src/app/layout.tsx +18 -22
- package/lib/__templates__/nextjs/template.config.js +1 -1
- package/lib/__templates__/templates.json +7 -0
- package/lib/__templates__/vite/_npmrc +1 -1
- package/lib/__templates__/vite/scripts/dev.sh +7 -26
- package/lib/__templates__/vite/template.config.js +11 -2
- package/lib/__templates__/vite/vite.config.ts +4 -3
- package/lib/cli.js +385 -242
- package/package.json +1 -2
- package/lib/__templates__/nextjs/.babelrc +0 -15
- package/lib/__templates__/nextjs/server.mjs +0 -50
|
@@ -4,44 +4,25 @@ set -Eeuo pipefail
|
|
|
4
4
|
PORT=<%= port %>
|
|
5
5
|
COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
|
|
6
6
|
NODE_ENV=development
|
|
7
|
+
DEPLOY_RUN_PORT=<%= port %>
|
|
7
8
|
|
|
8
9
|
cd "${COZE_WORKSPACE_PATH}"
|
|
9
10
|
|
|
10
11
|
kill_port_if_listening() {
|
|
11
12
|
local pids
|
|
12
|
-
|
|
13
|
-
# Check if lsof is available (macOS/BSD) or ss (Linux)
|
|
14
|
-
if command -v lsof >/dev/null 2>&1; then
|
|
15
|
-
# macOS/BSD using lsof
|
|
16
|
-
pids=$(lsof -ti:${PORT} 2>/dev/null || true)
|
|
17
|
-
elif command -v ss >/dev/null 2>&1; then
|
|
18
|
-
# Linux using ss
|
|
19
|
-
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
|
-
else
|
|
21
|
-
echo "Warning: neither lsof nor ss found, cannot check port ${PORT}"
|
|
22
|
-
return
|
|
23
|
-
fi
|
|
24
|
-
|
|
13
|
+
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${DEPLOY_RUN_PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
25
14
|
if [[ -z "${pids}" ]]; then
|
|
26
|
-
echo "Port ${
|
|
15
|
+
echo "Port ${DEPLOY_RUN_PORT} is free."
|
|
27
16
|
return
|
|
28
17
|
fi
|
|
29
|
-
|
|
30
|
-
echo "Port ${PORT} in use by PIDs: ${pids} (SIGKILL)"
|
|
18
|
+
echo "Port ${DEPLOY_RUN_PORT} in use by PIDs: ${pids} (SIGKILL)"
|
|
31
19
|
echo "${pids}" | xargs -I {} kill -9 {}
|
|
32
20
|
sleep 1
|
|
33
|
-
|
|
34
|
-
# Verify port is cleared
|
|
35
|
-
if command -v lsof >/dev/null 2>&1; then
|
|
36
|
-
pids=$(lsof -ti:${PORT} 2>/dev/null || true)
|
|
37
|
-
elif command -v ss >/dev/null 2>&1; then
|
|
38
|
-
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
39
|
-
fi
|
|
40
|
-
|
|
21
|
+
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${DEPLOY_RUN_PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
41
22
|
if [[ -n "${pids}" ]]; then
|
|
42
|
-
echo "Warning: port ${
|
|
23
|
+
echo "Warning: port ${DEPLOY_RUN_PORT} still busy after SIGKILL, PIDs: ${pids}"
|
|
43
24
|
else
|
|
44
|
-
echo "Port ${
|
|
25
|
+
echo "Port ${DEPLOY_RUN_PORT} cleared."
|
|
45
26
|
fi
|
|
46
27
|
}
|
|
47
28
|
|
|
@@ -49,4 +30,4 @@ echo "Clearing port ${PORT} before start."
|
|
|
49
30
|
kill_port_if_listening
|
|
50
31
|
echo "Starting HTTP service on port ${PORT} for dev..."
|
|
51
32
|
|
|
52
|
-
|
|
33
|
+
npx next dev --webpack --port $PORT
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Metadata } from 'next';
|
|
2
2
|
import { Geist, Geist_Mono } from 'next/font/google';
|
|
3
|
-
import { Inspector } from 'react-dev-inspector';
|
|
4
3
|
import './globals.css';
|
|
5
4
|
|
|
6
5
|
const geistSans = Geist({
|
|
@@ -34,9 +33,9 @@ export const metadata: Metadata = {
|
|
|
34
33
|
],
|
|
35
34
|
authors: [{ name: 'Coze Code Team', url: 'https://code.coze.cn' }],
|
|
36
35
|
generator: 'Coze Code',
|
|
37
|
-
icons: {
|
|
38
|
-
|
|
39
|
-
},
|
|
36
|
+
// icons: {
|
|
37
|
+
// icon: '',
|
|
38
|
+
// },
|
|
40
39
|
openGraph: {
|
|
41
40
|
title: '扣子编程 | 你的 AI 工程师已就位',
|
|
42
41
|
description:
|
|
@@ -45,22 +44,22 @@ export const metadata: Metadata = {
|
|
|
45
44
|
siteName: '扣子编程',
|
|
46
45
|
locale: 'zh_CN',
|
|
47
46
|
type: 'website',
|
|
48
|
-
images: [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
twitter: {
|
|
58
|
-
card: 'summary_large_image',
|
|
59
|
-
title: 'Coze Code | Your AI Engineer is Here',
|
|
60
|
-
description:
|
|
61
|
-
'Build and deploy full-stack applications through AI conversation. No env setup, just flow.',
|
|
62
|
-
images: [''],
|
|
47
|
+
// images: [
|
|
48
|
+
// {
|
|
49
|
+
// url: '',
|
|
50
|
+
// width: 1200,
|
|
51
|
+
// height: 630,
|
|
52
|
+
// alt: '扣子编程 - 你的 AI 工程师',
|
|
53
|
+
// },
|
|
54
|
+
// ],
|
|
63
55
|
},
|
|
56
|
+
// twitter: {
|
|
57
|
+
// card: 'summary_large_image',
|
|
58
|
+
// title: 'Coze Code | Your AI Engineer is Here',
|
|
59
|
+
// description:
|
|
60
|
+
// 'Build and deploy full-stack applications through AI conversation. No env setup, just flow.',
|
|
61
|
+
// // images: [''],
|
|
62
|
+
// },
|
|
64
63
|
robots: {
|
|
65
64
|
index: true,
|
|
66
65
|
follow: true,
|
|
@@ -72,14 +71,11 @@ export default function RootLayout({
|
|
|
72
71
|
}: Readonly<{
|
|
73
72
|
children: React.ReactNode;
|
|
74
73
|
}>) {
|
|
75
|
-
const isDev = process.env.NODE_ENV === 'development';
|
|
76
|
-
|
|
77
74
|
return (
|
|
78
75
|
<html lang="en">
|
|
79
76
|
<body
|
|
80
77
|
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
81
78
|
>
|
|
82
|
-
{isDev && <Inspector />}
|
|
83
79
|
{children}
|
|
84
80
|
</body>
|
|
85
81
|
</html>
|
|
@@ -52,6 +52,13 @@
|
|
|
52
52
|
"port": {
|
|
53
53
|
"type": "number",
|
|
54
54
|
"description": "Development server port",
|
|
55
|
+
"default": 5000,
|
|
56
|
+
"minimum": 1024,
|
|
57
|
+
"maximum": 65535
|
|
58
|
+
},
|
|
59
|
+
"hmrPort": {
|
|
60
|
+
"type": "number",
|
|
61
|
+
"description": "Development HMR server port",
|
|
55
62
|
"default": 6000,
|
|
56
63
|
"minimum": 1024,
|
|
57
64
|
"maximum": 65535
|
|
@@ -3,44 +3,25 @@ set -Eeuo pipefail
|
|
|
3
3
|
|
|
4
4
|
PORT=<%= port %>
|
|
5
5
|
COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
|
|
6
|
+
DEPLOY_RUN_PORT=<%= port %>
|
|
6
7
|
|
|
7
8
|
cd "${COZE_WORKSPACE_PATH}"
|
|
8
9
|
|
|
9
10
|
kill_port_if_listening() {
|
|
10
11
|
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
|
-
|
|
12
|
+
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${DEPLOY_RUN_PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
24
13
|
if [[ -z "${pids}" ]]; then
|
|
25
|
-
echo "Port ${
|
|
14
|
+
echo "Port ${DEPLOY_RUN_PORT} is free."
|
|
26
15
|
return
|
|
27
16
|
fi
|
|
28
|
-
|
|
29
|
-
echo "Port ${PORT} in use by PIDs: ${pids} (SIGKILL)"
|
|
17
|
+
echo "Port ${DEPLOY_RUN_PORT} in use by PIDs: ${pids} (SIGKILL)"
|
|
30
18
|
echo "${pids}" | xargs -I {} kill -9 {}
|
|
31
19
|
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
|
-
|
|
20
|
+
pids=$(ss -H -lntp 2>/dev/null | awk -v port="${DEPLOY_RUN_PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
|
|
40
21
|
if [[ -n "${pids}" ]]; then
|
|
41
|
-
echo "Warning: port ${
|
|
22
|
+
echo "Warning: port ${DEPLOY_RUN_PORT} still busy after SIGKILL, PIDs: ${pids}"
|
|
42
23
|
else
|
|
43
|
-
echo "Port ${
|
|
24
|
+
echo "Port ${DEPLOY_RUN_PORT} cleared."
|
|
44
25
|
fi
|
|
45
26
|
}
|
|
46
27
|
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
|
|
10
11
|
export const paramsSchema = {
|
|
11
12
|
type: 'object',
|
|
12
13
|
properties: {
|
|
@@ -19,11 +20,18 @@ export const paramsSchema = {
|
|
|
19
20
|
},
|
|
20
21
|
port: {
|
|
21
22
|
type: 'number',
|
|
22
|
-
default:
|
|
23
|
+
default: 5000,
|
|
23
24
|
minimum: 1024,
|
|
24
25
|
maximum: 65535,
|
|
25
26
|
description: 'Development server port',
|
|
26
27
|
},
|
|
28
|
+
hmrPort: {
|
|
29
|
+
type: 'number',
|
|
30
|
+
default: 6000,
|
|
31
|
+
minimum: 1024,
|
|
32
|
+
maximum: 65535,
|
|
33
|
+
description: 'Development HMR server port',
|
|
34
|
+
},
|
|
27
35
|
},
|
|
28
36
|
required: [],
|
|
29
37
|
additionalProperties: false,
|
|
@@ -34,7 +42,8 @@ const config = {
|
|
|
34
42
|
|
|
35
43
|
defaultParams: {
|
|
36
44
|
port: 5000,
|
|
37
|
-
|
|
45
|
+
hmrPort: 6000,
|
|
46
|
+
appName: 'projects',
|
|
38
47
|
},
|
|
39
48
|
|
|
40
49
|
onBeforeRender: async context => {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { defineConfig } from 'vite';
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
|
-
|
|
5
|
-
host: '0.0.0.0',
|
|
4
|
+
define:{},
|
|
6
5
|
server: {
|
|
6
|
+
port: <%= port %>,
|
|
7
|
+
host: '0.0.0.0',
|
|
7
8
|
hmr: {
|
|
8
9
|
overlay: true,
|
|
9
10
|
path: '/hot/vite-hmr',
|
|
10
|
-
port:
|
|
11
|
+
port: <%= hmrPort %>,
|
|
11
12
|
clientPort: 443,
|
|
12
13
|
timeout: 30000,
|
|
13
14
|
},
|