@coze-arch/cli 0.1.4-alpha.8c3e03 → 0.1.4-alpha.b8ffd5
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__/nextjs/eslint.config.mjs +11 -5
- package/lib/__templates__/nextjs/package.json +1 -1
- package/lib/__templates__/nextjs/scripts/build.sh +1 -0
- package/lib/__templates__/nextjs/scripts/dev.sh +2 -0
- package/lib/__templates__/nextjs/scripts/prepare-next-output.sh +44 -0
- package/lib/cli.js +1 -1
- package/package.json +1 -1
|
@@ -23,6 +23,11 @@ const eslintConfig = defineConfig([
|
|
|
23
23
|
...nextVitals,
|
|
24
24
|
...nextTs,
|
|
25
25
|
{
|
|
26
|
+
settings: {
|
|
27
|
+
// node_modules 里的 barrel 包(lucide-react 等)不参与 ExportMap 构建,
|
|
28
|
+
// import/no-cycle 只需要项目源码的依赖图。
|
|
29
|
+
'import/ignore': ['/node_modules/'],
|
|
30
|
+
},
|
|
26
31
|
rules: {
|
|
27
32
|
'import/no-cycle': ['error', { ignoreExternal: true }],
|
|
28
33
|
'react-hooks/set-state-in-effect': 'off',
|
|
@@ -37,14 +42,15 @@ const eslintConfig = defineConfig([
|
|
|
37
42
|
},
|
|
38
43
|
// Override default ignores of eslint-config-next.
|
|
39
44
|
globalIgnores([
|
|
40
|
-
// Default ignores of eslint-config-next
|
|
41
|
-
|
|
42
|
-
'
|
|
43
|
-
'
|
|
45
|
+
// Default ignores of eslint-config-next (trailing slash prunes the whole
|
|
46
|
+
// directory instead of walking into it):
|
|
47
|
+
'.next/',
|
|
48
|
+
'out/',
|
|
49
|
+
'build/',
|
|
44
50
|
'next-env.d.ts',
|
|
45
51
|
// Build artifacts:
|
|
46
52
|
'server.js',
|
|
47
|
-
'dist
|
|
53
|
+
'dist/',
|
|
48
54
|
// Script files (CommonJS):
|
|
49
55
|
'scripts/**/*.js',
|
|
50
56
|
]),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"build": "bash ./scripts/build.sh",
|
|
7
7
|
"dev": "bash ./scripts/dev.sh",
|
|
8
8
|
"preinstall": "npx only-allow pnpm",
|
|
9
|
-
"lint": "eslint",
|
|
9
|
+
"lint": "eslint --cache --cache-location node_modules/.cache/eslint/",
|
|
10
10
|
"lint:build": "eslint . --quiet",
|
|
11
11
|
"lint:style": "stylelint \"src/**/*.css\"",
|
|
12
12
|
"start": "bash ./scripts/start.sh",
|
|
@@ -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 收集输出并停止进程。
|
|
@@ -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}"
|
|
@@ -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"
|
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.
|
|
2117
|
+
var version = "0.1.4-alpha.b8ffd5";
|
|
2118
2118
|
var description = "coze coding devtools cli";
|
|
2119
2119
|
var license = "MIT";
|
|
2120
2120
|
var author = "fanwenjie.fe@bytedance.com";
|