@@ -11,6 +11,18 @@ if [ ! -d "$PACKAGES_DIR" ]; then
11
11
exit 1
12
12
fi
13
13
14
+ # Function to check if an item is in an array
15
+ is_in_array () {
16
+ local item=" $1 "
17
+ shift
18
+ for element; do
19
+ if [[ " $element " == " $item " ]]; then
20
+ return 0
21
+ fi
22
+ done
23
+ return 1
24
+ }
25
+
14
26
# Initialize an array to hold package-specific commands
15
27
COMMANDS=()
16
28
@@ -28,18 +40,34 @@ EXCLUDED_FOLDERS=("create-eliza-app" "debug_audio" "content_cache")
28
40
for PACKAGE in " $PACKAGES_DIR " /* ; do
29
41
PACKAGE_NAME=$( basename " $PACKAGE " )
30
42
31
- # Skip excluded folders
32
- if [ -d " $PACKAGE " ] && [[ ! " ${EXCLUDED_FOLDERS[@]} " =~ " ${PACKAGE_NAME} " ]] && [ " $PACKAGE_NAME " != " core" ]; then
43
+ # Skip excluded folders and "core"
44
+ if [ -d " $PACKAGE " ] && ! is_in_array " $PACKAGE_NAME " " ${EXCLUDED_FOLDERS[@]} " && [ " $PACKAGE_NAME " != " core" ]; then
33
45
COMMANDS+=(" pnpm --dir $PACKAGE dev -- $* " )
34
46
fi
35
47
done
36
48
37
49
# Add specific commands for other directories or cases
38
- COMMANDS+=(" pnpm --dir client dev -- $* " )
39
- COMMANDS+=(" node -e \" setTimeout(() => process.exit(0), 5000)\" && pnpm --dir agent dev -- $* " )
50
+ if [ -d " ./client" ]; then
51
+ COMMANDS+=(" pnpm --dir client dev -- $* " )
52
+ else
53
+ echo " Warning: 'client' directory not found."
54
+ fi
55
+
56
+ if [ -d " ./agent" ]; then
57
+ COMMANDS+=(" node -e \" setTimeout(() => process.exit(0), 5000)\" && pnpm --dir agent dev -- $* " )
58
+ else
59
+ echo " Warning: 'agent' directory not found."
60
+ fi
40
61
41
62
# Run build command first
42
- pnpm dev:build
63
+ if ! pnpm dev:build; then
64
+ echo " Build failed. Exiting."
65
+ exit 1
66
+ fi
43
67
44
68
# Run all commands concurrently
45
- npx concurrently --raw " ${COMMANDS[@]} "
69
+ if [ ${# COMMANDS[@]} -gt 0 ]; then
70
+ npx concurrently --raw " ${COMMANDS[@]} "
71
+ else
72
+ echo " No valid packages to run."
73
+ fi
0 commit comments