Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dev command #793

Merged
merged 8 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions agent/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"node"
]
},
"ts-node": {
"experimentalSpecifierResolution": "node",
"transpileOnly": true,
"esm": true,
},
"include": [
"src"
]
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"start": "pnpm --filter \"@ai16z/agent\" start --isRoot",
"start:client": "pnpm --dir client start --isRoot",
"start:debug": "cross-env NODE_ENV=development VERBOSE=true DEBUG=eliza:* pnpm --filter \"@ai16z/agent\" start --isRoot",
"dev": "turbo check-types dev --concurrency 25",
"dev": "bash ./scripts/dev.sh",
"dev:build": "turbo run build --filter=!eliza-docs",
"lint": "bash ./scripts/lint.sh",
"prettier-check": "npx prettier --check .",
"prettier": "npx prettier --write .",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-sqljs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-supabase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/client-auto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/client-direct/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/client-discord/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
},
"trustedDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/client-farcaster/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch"
"dev": "tsup --format esm --dts --watch"
},
"peerDependencies": {}
}
2 changes: 1 addition & 1 deletion packages/client-github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
}
}
2 changes: 1 addition & 1 deletion packages/client-telegram/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
}
}
2 changes: 1 addition & 1 deletion packages/client-twitter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-0g/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"test": "vitest"
}
}
2 changes: 1 addition & 1 deletion packages/plugin-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"devDependencies": {},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
},
"peerDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-buttplug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"test-via-bun": "bun test/simulate.ts"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-coinbase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
}
}
2 changes: 1 addition & 1 deletion packages/plugin-conflux/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch"
"dev": "tsup --format esm --dts --watch"
}
}
3 changes: 2 additions & 1 deletion packages/plugin-evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"viem": "2.21.53"
},
"scripts": {
"build": "tsup --format esm --dts"
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch"
},
"peerDependencies": {
"whatwg-url": "7.1.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-goat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"viem": "^2.21.45"
},
"scripts": {
"build": "tsup --format esm --dts"
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch"
},
"peerDependencies": {
"whatwg-url": "7.1.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-icp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"@dfinity/principal": "2.1.3"
},
"scripts": {
"build": "tsup --format esm --dts"
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch"
},
"devDependencies": {
"@types/jest": "29.5.14",
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-image-generation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"devDependencies": {},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix",
"postinstall": "node scripts/postinstall.js"
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-solana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"devDependencies": {},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix",
"test": "vitest run"
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-starknet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"devDependencies": {},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"test": "vitest run",
"test:watch": "vitest",
"lint": "eslint . --fix"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-tee/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch"
"dev": "tsup --format esm --dts --watch"
},
"peerDependencies": {
"whatwg-url": "7.1.0"
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-trustdb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"test": "vitest run",
"test:watch": "vitest",
"lint": "eslint . --fix"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-video-generation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"devDependencies": {},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --watch",
"dev": "tsup --format esm --dts --watch",
"lint": "eslint . --fix"
},
"peerDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-web-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"tsup": "8.3.5"
},
"scripts": {
"build": "tsup --format esm --dts"
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch"
},
"peerDependencies": {
"whatwg-url": "7.1.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-whatsapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"test": "jest",
"lint": "eslint . --fix"
},
Expand Down
13 changes: 3 additions & 10 deletions packages/plugin-whatsapp/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
{
"extends": "../core/tsconfig.json",
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"declaration": true,
"outDir": "./dist",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"rootDir": "src",
"baseUrl": ".",
"types": [
"node",
"jest"
]
},
"include": [
"src/**/*"
"src/**/*.ts"
],
"exclude": [
"node_modules",
Expand Down
85 changes: 72 additions & 13 deletions scripts/dev.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,73 @@
#!/bin/bash

echo "Passing arguments: $*"
npx concurrently --raw \
"pnpm --dir packages/core dev -- $*" \
"pnpm --dir client dev -- $*" \
"pnpm --dir packages/client-telegram dev -- $*" \
"pnpm --dir packages/client-discord dev -- $*" \
"pnpm --dir packages/client-twitter dev -- $*" \
"pnpm --dir packages/client-direct dev -- $*" \
"pnpm --dir packages/plugin-bootstrap dev -- $*" \
"pnpm --dir packages/plugin-node dev -- $*" \
"pnpm --dir packages/adapter-sqlite dev -- $*" \
"pnpm --dir packages/adapter-postgres dev -- $*" \
"pnpm --dir packages/plugin-buttplug dev -- $*" \
"node -e \"setTimeout(() => process.exit(0), 5000)\" && pnpm --dir agent dev -- $*"

# Base packages directory
PACKAGES_DIR="./packages"

# Check if the packages directory exists
if [ ! -d "$PACKAGES_DIR" ]; then
echo "Error: Directory $PACKAGES_DIR does not exist."
exit 1
fi

# Function to check if an item is in an array
is_in_array() {
local item="$1"
shift
for element; do
if [[ "$element" == "$item" ]]; then
return 0
fi
done
return 1
}

# Initialize an array to hold package-specific commands
COMMANDS=()

# Ensure "core" package runs first
if [ -d "$PACKAGES_DIR/core" ]; then
COMMANDS+=("pnpm --dir $PACKAGES_DIR/core dev -- $*")
else
echo "Warning: 'core' package not found in $PACKAGES_DIR."
fi

# List of folders to exclude
EXCLUDED_FOLDERS=("create-eliza-app" "debug_audio" "content_cache")

# Iterate over all other subdirectories in the packages folder
for PACKAGE in "$PACKAGES_DIR"/*; do
PACKAGE_NAME=$(basename "$PACKAGE")

# Skip excluded folders and "core"
if [ -d "$PACKAGE" ] && ! is_in_array "$PACKAGE_NAME" "${EXCLUDED_FOLDERS[@]}" && [ "$PACKAGE_NAME" != "core" ]; then
COMMANDS+=("pnpm --dir $PACKAGE dev -- $*")
fi
done

# Add specific commands for other directories or cases
if [ -d "./client" ]; then
COMMANDS+=("pnpm --dir client dev -- $*")
else
echo "Warning: 'client' directory not found."
fi

if [ -d "./agent" ]; then
COMMANDS+=("node -e \"setTimeout(() => process.exit(0), 5000)\" && pnpm --dir agent dev -- $*")
else
echo "Warning: 'agent' directory not found."
fi

# Run build command first
if ! pnpm dev:build; then
echo "Build failed. Exiting."
exit 1
fi

# Run all commands concurrently
if [ ${#COMMANDS[@]} -gt 0 ]; then
npx concurrently --raw "${COMMANDS[@]}"
else
echo "No valid packages to run."
fi
Loading