@coze-arch/cli 0.1.4-alpha.5377b5 → 0.1.4-alpha.7fcfb3

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.
@@ -7,6 +7,7 @@ cd "${COZE_WORKSPACE_PATH}"
7
7
 
8
8
  echo "Installing dependencies..."
9
9
  bash "$COZE_WORKSPACE_PATH/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
10
+ bash "$COZE_WORKSPACE_PATH/scripts/prepare-next-output.sh"
10
11
 
11
12
  echo "Building the Next.js project..."
12
13
  pnpm next build --webpack
@@ -55,6 +55,7 @@ kill_port_if_listening() {
55
55
  <% if (process.env.NODE_ENV === 'test') { %>
56
56
  echo "Clearing port ${DEPLOY_RUN_PORT} before start."
57
57
  kill_port_if_listening
58
+ bash "${COZE_WORKSPACE_PATH}/scripts/prepare-next-output.sh"
58
59
  echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for dev..."
59
60
 
60
61
  # 测试环境保持服务为前台进程,便于 e2e 收集输出并停止进程。
@@ -134,7 +135,7 @@ stop_detached() {
134
135
  kill -KILL -- "-${pid}" 2>/dev/null || true
135
136
  }
136
137
 
137
- READY_RETRIES=10
138
+ READY_RETRIES=30
138
139
  READY_PROBE_HOSTS=("127.0.0.1" "::1")
139
140
  LOG_TAIL_LINES=40
140
141
 
@@ -226,6 +227,7 @@ fi
226
227
 
227
228
  echo "Clearing port ${DEPLOY_RUN_PORT} before start."
228
229
  kill_port_if_listening
230
+ bash "${COZE_WORKSPACE_PATH}/scripts/prepare-next-output.sh"
229
231
  echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for dev..."
230
232
 
231
233
  mkdir -p "${LOG_DIR}"
@@ -249,8 +251,7 @@ fi
249
251
 
250
252
  if [[ "${ready_status}" -ne 0 ]]; then
251
253
  if [[ "${ready_status}" -eq 2 ]]; then
252
- # 进程还活着但迟迟没监听端口:多半是编译/运行时报错后 tsx watch 驻留,日志里有真正原因。
253
- echo "Dev server 在 ${READY_RETRIES} 次探测(每次 1s)内未就绪于端口 ${DEPLOY_RUN_PORT}(进程 ${server_pid} 仍在运行,已回收)。" >&2
254
+ echo "Dev server did not listen on port ${DEPLOY_RUN_PORT} after ${READY_RETRIES} attempts; stopping PID ${server_pid}." >&2
254
255
  else
255
256
  echo "Dev server failed to start. See ${LOG_FILE}." >&2
256
257
  fi
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ # Keep Next.js compiler output off Coze Drive while leaving source files in place.
3
+ set -euo pipefail
4
+
5
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
6
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
7
+
8
+ DRIVE_ROOT="${COZE_DRIVE_ROOT:-/Coze/Drive}"
9
+ if [ -d "$DRIVE_ROOT" ]; then
10
+ DRIVE_ROOT="$(cd "$DRIVE_ROOT" && pwd -P)"
11
+ else
12
+ DRIVE_ROOT="${DRIVE_ROOT%/}"
13
+ fi
14
+ case "$PROJECT_ROOT" in
15
+ "$DRIVE_ROOT"|"$DRIVE_ROOT"/*) ;;
16
+ *) exit 0 ;;
17
+ esac
18
+
19
+ NM_ROOT="/tmp/nm"
20
+ PROJECT_ID="$(basename "$PROJECT_ROOT")-$(printf '%s' "$PROJECT_ROOT" | cksum | awk '{print $1}')"
21
+ NEXT_DIR="$NM_ROOT/next/$PROJECT_ID"
22
+ mkdir -p "$NEXT_DIR"
23
+
24
+ if [ -L "$PROJECT_ROOT/.next" ]; then
25
+ current="$(readlink "$PROJECT_ROOT/.next")"
26
+ if [ "$current" = "$NEXT_DIR" ]; then
27
+ exit 0
28
+ fi
29
+ echo "[next] refusing to replace unmanaged symlink: $PROJECT_ROOT/.next" >&2
30
+ exit 1
31
+ fi
32
+
33
+ if [ -e "$PROJECT_ROOT/.next" ]; then
34
+ rm -rf "$PROJECT_ROOT/.next"
35
+ fi
36
+
37
+ if ! ln -s "$NEXT_DIR" "$PROJECT_ROOT/.next"; then
38
+ if [ ! -L "$PROJECT_ROOT/.next" ] || [ "$(readlink "$PROJECT_ROOT/.next")" != "$NEXT_DIR" ]; then
39
+ echo "[next] failed to link $PROJECT_ROOT/.next to $NEXT_DIR" >&2
40
+ exit 1
41
+ fi
42
+ fi
43
+
44
+ echo "[next] Compiler output ready at $NEXT_DIR"
@@ -1,5 +1,4 @@
1
1
  import type { Metadata } from 'next';
2
- import { Inspector } from 'react-dev-inspector';
3
2
  import './globals.css';
4
3
 
5
4
  export const metadata: Metadata = {
@@ -61,12 +60,9 @@ export default function RootLayout({
61
60
  }: Readonly<{
62
61
  children: React.ReactNode;
63
62
  }>) {
64
- const isDev = process.env.COZE_PROJECT_ENV === 'DEV';
65
-
66
63
  return (
67
64
  <html lang="en">
68
65
  <body className={`antialiased`}>
69
- {isDev && <Inspector />}
70
66
  {children}
71
67
  </body>
72
68
  </html>
package/lib/cli.js CHANGED
@@ -2114,7 +2114,7 @@ const EventBuilder = {
2114
2114
  };
2115
2115
 
2116
2116
  var name = "@coze-arch/cli";
2117
- var version = "0.1.4-alpha.5377b5";
2117
+ var version = "0.1.4-alpha.7fcfb3";
2118
2118
  var description = "coze coding devtools cli";
2119
2119
  var license = "MIT";
2120
2120
  var author = "fanwenjie.fe@bytedance.com";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/cli",
3
- "version": "0.1.4-alpha.5377b5",
3
+ "version": "0.1.4-alpha.7fcfb3",
4
4
  "private": false,
5
5
  "description": "coze coding devtools cli",
6
6
  "license": "MIT",
@@ -1,15 +0,0 @@
1
- {
2
- "presets": [
3
- [
4
- "next/babel",
5
- {
6
- "preset-react": {
7
- "development": true
8
- }
9
- }
10
- ]
11
- ],
12
- "plugins": [
13
- "@react-dev-inspector/babel-plugin"
14
- ]
15
- }