From 751329c9225f692379284caad24b0bac7f1a85e1 Mon Sep 17 00:00:00 2001 From: Shakker Nerd Date: Mon, 2 Dec 2024 18:39:55 +0000 Subject: [PATCH 1/8] chore: ts-node config for error detection --- agent/tsconfig.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/agent/tsconfig.json b/agent/tsconfig.json index e61ebc27ce..a959a90103 100644 --- a/agent/tsconfig.json +++ b/agent/tsconfig.json @@ -9,6 +9,11 @@ "node" ] }, + "ts-node": { + "experimentalSpecifierResolution": "node", + "transpileOnly": true, + "esm": true, + }, "include": [ "src" ] From ed7f90119a20d97efd22bf5f3ea878e95e5ef988 Mon Sep 17 00:00:00 2001 From: Shakker Nerd Date: Mon, 2 Dec 2024 18:50:57 +0000 Subject: [PATCH 2/8] fix: dev command with esm build and dts --- packages/adapter-sqljs/package.json | 2 +- packages/adapter-supabase/package.json | 2 +- packages/client-auto/package.json | 2 +- packages/client-direct/package.json | 2 +- packages/client-discord/package.json | 2 +- packages/client-farcaster/package.json | 2 +- packages/client-github/package.json | 2 +- packages/client-telegram/package.json | 2 +- packages/client-twitter/package.json | 2 +- packages/plugin-0g/package.json | 2 +- packages/plugin-bootstrap/package.json | 2 +- packages/plugin-coinbase/package.json | 2 +- packages/plugin-conflux/package.json | 2 +- packages/plugin-node/package.json | 2 +- packages/plugin-tee/package.json | 2 +- packages/plugin-video-generation/package.json | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/adapter-sqljs/package.json b/packages/adapter-sqljs/package.json index 568f56e129..d1785e2e4d 100644 --- a/packages/adapter-sqljs/package.json +++ b/packages/adapter-sqljs/package.json @@ -15,7 +15,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/adapter-supabase/package.json b/packages/adapter-supabase/package.json index 07dcb70df7..5970a01bb2 100644 --- a/packages/adapter-supabase/package.json +++ b/packages/adapter-supabase/package.json @@ -13,7 +13,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/client-auto/package.json b/packages/client-auto/package.json index a1e2b6877d..04794b18ad 100644 --- a/packages/client-auto/package.json +++ b/packages/client-auto/package.json @@ -18,7 +18,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/client-direct/package.json b/packages/client-direct/package.json index b701166386..7efb2e05d8 100644 --- a/packages/client-direct/package.json +++ b/packages/client-direct/package.json @@ -21,7 +21,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/client-discord/package.json b/packages/client-discord/package.json index 5c1ded0275..d8cbd5f69e 100644 --- a/packages/client-discord/package.json +++ b/packages/client-discord/package.json @@ -20,7 +20,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "trustedDependencies": { diff --git a/packages/client-farcaster/package.json b/packages/client-farcaster/package.json index 95e7a3d53d..afb7429890 100644 --- a/packages/client-farcaster/package.json +++ b/packages/client-farcaster/package.json @@ -14,7 +14,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch" + "dev": "tsup --format esm --dts --watch" }, "peerDependencies": {} } diff --git a/packages/client-github/package.json b/packages/client-github/package.json index 6501680e72..107c2c20dd 100644 --- a/packages/client-github/package.json +++ b/packages/client-github/package.json @@ -17,7 +17,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" } } diff --git a/packages/client-telegram/package.json b/packages/client-telegram/package.json index 0e49a4f2f6..d9f9a58a70 100644 --- a/packages/client-telegram/package.json +++ b/packages/client-telegram/package.json @@ -15,7 +15,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" } } diff --git a/packages/client-twitter/package.json b/packages/client-twitter/package.json index 4d71932b12..1f6fcdca33 100644 --- a/packages/client-twitter/package.json +++ b/packages/client-twitter/package.json @@ -15,7 +15,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/plugin-0g/package.json b/packages/plugin-0g/package.json index 607d7aca09..32d76c3cd5 100644 --- a/packages/plugin-0g/package.json +++ b/packages/plugin-0g/package.json @@ -12,7 +12,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "test": "vitest" } } diff --git a/packages/plugin-bootstrap/package.json b/packages/plugin-bootstrap/package.json index fff6728493..56e660a40a 100644 --- a/packages/plugin-bootstrap/package.json +++ b/packages/plugin-bootstrap/package.json @@ -11,7 +11,7 @@ "devDependencies": {}, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/plugin-coinbase/package.json b/packages/plugin-coinbase/package.json index 5d5c8859c5..c69f9f68a9 100644 --- a/packages/plugin-coinbase/package.json +++ b/packages/plugin-coinbase/package.json @@ -13,7 +13,7 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" } } diff --git a/packages/plugin-conflux/package.json b/packages/plugin-conflux/package.json index c1bb22f059..097250b996 100644 --- a/packages/plugin-conflux/package.json +++ b/packages/plugin-conflux/package.json @@ -10,6 +10,6 @@ }, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch" + "dev": "tsup --format esm --dts --watch" } } diff --git a/packages/plugin-node/package.json b/packages/plugin-node/package.json index bc15466153..82c987e2e1 100644 --- a/packages/plugin-node/package.json +++ b/packages/plugin-node/package.json @@ -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" }, diff --git a/packages/plugin-tee/package.json b/packages/plugin-tee/package.json index b94711a69d..bd7193f05f 100644 --- a/packages/plugin-tee/package.json +++ b/packages/plugin-tee/package.json @@ -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" diff --git a/packages/plugin-video-generation/package.json b/packages/plugin-video-generation/package.json index fd0048175e..7a1f75f02b 100644 --- a/packages/plugin-video-generation/package.json +++ b/packages/plugin-video-generation/package.json @@ -11,7 +11,7 @@ "devDependencies": {}, "scripts": { "build": "tsup --format esm --dts", - "dev": "tsup --watch", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { From 75859b0939ab1c5cd2a755aea878e950aabe9713 Mon Sep 17 00:00:00 2001 From: Shakker Nerd Date: Mon, 2 Dec 2024 18:54:18 +0000 Subject: [PATCH 3/8] feat: added dev:build command and changed dev command --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fef7142766..8006b83157 100644 --- a/package.json +++ b/package.json @@ -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 .", From 74ed2c11fed3fe0d7ecc4182d0c89dd917a175a9 Mon Sep 17 00:00:00 2001 From: Shakker Nerd Date: Mon, 2 Dec 2024 18:55:07 +0000 Subject: [PATCH 4/8] feat: dev script to build packages first and run dev command --- scripts/dev.sh | 57 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/scripts/dev.sh b/scripts/dev.sh index c8c83490cc..b5200a2e65 100644 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -1,14 +1,45 @@ +#!/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 -- $*" \ No newline at end of file + +# 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 + +# 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 + if [ -d "$PACKAGE" ] && [[ ! " ${EXCLUDED_FOLDERS[@]} " =~ " ${PACKAGE_NAME} " ]] && [ "$PACKAGE_NAME" != "core" ]; then + COMMANDS+=("pnpm --dir $PACKAGE dev -- $*") + fi +done + +# Add specific commands for other directories or cases +COMMANDS+=("pnpm --dir client dev -- $*") +COMMANDS+=("node -e \"setTimeout(() => process.exit(0), 5000)\" && pnpm --dir agent dev -- $*") + +# Run build command first +pnpm dev:build + +# Run all commands concurrently +npx concurrently --raw "${COMMANDS[@]}" From c89563bc020f0b21a69599b706534f2edfbdf1cd Mon Sep 17 00:00:00 2001 From: Shakker Nerd Date: Mon, 2 Dec 2024 18:57:56 +0000 Subject: [PATCH 5/8] fix: added missing dev commands --- packages/plugin-buttplug/package.json | 1 + packages/plugin-evm/package.json | 3 ++- packages/plugin-goat/package.json | 3 ++- packages/plugin-icp/package.json | 3 ++- packages/plugin-image-generation/package.json | 1 + packages/plugin-solana/package.json | 1 + packages/plugin-starknet/package.json | 1 + packages/plugin-trustdb/package.json | 1 + packages/plugin-web-search/package.json | 3 ++- packages/plugin-whatsapp/package.json | 3 ++- 10 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/plugin-buttplug/package.json b/packages/plugin-buttplug/package.json index 1292740a63..e9f7ed891a 100644 --- a/packages/plugin-buttplug/package.json +++ b/packages/plugin-buttplug/package.json @@ -12,6 +12,7 @@ }, "scripts": { "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch", "test-via-bun": "bun test/simulate.ts" }, "peerDependencies": { diff --git a/packages/plugin-evm/package.json b/packages/plugin-evm/package.json index 3654ad9003..0892ddc126 100644 --- a/packages/plugin-evm/package.json +++ b/packages/plugin-evm/package.json @@ -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" diff --git a/packages/plugin-goat/package.json b/packages/plugin-goat/package.json index 88c73c5104..af731b421a 100644 --- a/packages/plugin-goat/package.json +++ b/packages/plugin-goat/package.json @@ -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" diff --git a/packages/plugin-icp/package.json b/packages/plugin-icp/package.json index 39e3ff9c13..0297ff820b 100644 --- a/packages/plugin-icp/package.json +++ b/packages/plugin-icp/package.json @@ -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", diff --git a/packages/plugin-image-generation/package.json b/packages/plugin-image-generation/package.json index b458d5c7fc..9305c51be9 100644 --- a/packages/plugin-image-generation/package.json +++ b/packages/plugin-image-generation/package.json @@ -11,6 +11,7 @@ "devDependencies": {}, "scripts": { "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix" }, "peerDependencies": { diff --git a/packages/plugin-solana/package.json b/packages/plugin-solana/package.json index ecf43d2816..d2119b8109 100644 --- a/packages/plugin-solana/package.json +++ b/packages/plugin-solana/package.json @@ -21,6 +21,7 @@ "devDependencies": {}, "scripts": { "build": "tsup --format esm --dts", + "dev": "tsup --format esm --dts --watch", "lint": "eslint . --fix", "test": "vitest run" }, diff --git a/packages/plugin-starknet/package.json b/packages/plugin-starknet/package.json index 0ceedafc94..8a1ce10f94 100644 --- a/packages/plugin-starknet/package.json +++ b/packages/plugin-starknet/package.json @@ -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" diff --git a/packages/plugin-trustdb/package.json b/packages/plugin-trustdb/package.json index 7e1870cfb3..d1a1da681b 100644 --- a/packages/plugin-trustdb/package.json +++ b/packages/plugin-trustdb/package.json @@ -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" diff --git a/packages/plugin-web-search/package.json b/packages/plugin-web-search/package.json index c62cb487d0..843583bfe5 100644 --- a/packages/plugin-web-search/package.json +++ b/packages/plugin-web-search/package.json @@ -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" diff --git a/packages/plugin-whatsapp/package.json b/packages/plugin-whatsapp/package.json index 61aef5448e..b0b662ff76 100644 --- a/packages/plugin-whatsapp/package.json +++ b/packages/plugin-whatsapp/package.json @@ -5,7 +5,8 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "build": "tsc", + "build": "tsc --format esm --dts", + "dev": "tsup --format esm --dts --watch", "test": "jest", "lint": "eslint . --fix" }, From e6d0283fd52ab8370d4812944e28ecc85960f4ef Mon Sep 17 00:00:00 2001 From: Shakker Nerd Date: Mon, 2 Dec 2024 19:05:46 +0000 Subject: [PATCH 6/8] fix: build command --- packages/plugin-whatsapp/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-whatsapp/package.json b/packages/plugin-whatsapp/package.json index b0b662ff76..d0322ca857 100644 --- a/packages/plugin-whatsapp/package.json +++ b/packages/plugin-whatsapp/package.json @@ -5,7 +5,7 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "build": "tsc --format esm --dts", + "build": "tsup --format esm --dts", "dev": "tsup --format esm --dts --watch", "test": "jest", "lint": "eslint . --fix" From 069c40e5f7fa44419196f57acca12db414768d2e Mon Sep 17 00:00:00 2001 From: Shakker Nerd Date: Mon, 2 Dec 2024 19:06:04 +0000 Subject: [PATCH 7/8] chore: tsconfig to extend from parent --- packages/plugin-whatsapp/tsconfig.json | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/plugin-whatsapp/tsconfig.json b/packages/plugin-whatsapp/tsconfig.json index 060b2973f0..f21178232b 100644 --- a/packages/plugin-whatsapp/tsconfig.json +++ b/packages/plugin-whatsapp/tsconfig.json @@ -1,15 +1,8 @@ { + "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", @@ -17,7 +10,7 @@ ] }, "include": [ - "src/**/*" + "src/**/*.ts" ], "exclude": [ "node_modules", From 23796683994b2f9e352c0d4449b4d5ac28e929b4 Mon Sep 17 00:00:00 2001 From: Shakker Nerd Date: Mon, 2 Dec 2024 19:23:52 +0000 Subject: [PATCH 8/8] feat: enhanced the dev script --- scripts/dev.sh | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/scripts/dev.sh b/scripts/dev.sh index b5200a2e65..f474900905 100644 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -11,6 +11,18 @@ if [ ! -d "$PACKAGES_DIR" ]; then 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=() @@ -28,18 +40,34 @@ EXCLUDED_FOLDERS=("create-eliza-app" "debug_audio" "content_cache") for PACKAGE in "$PACKAGES_DIR"/*; do PACKAGE_NAME=$(basename "$PACKAGE") - # Skip excluded folders - if [ -d "$PACKAGE" ] && [[ ! " ${EXCLUDED_FOLDERS[@]} " =~ " ${PACKAGE_NAME} " ]] && [ "$PACKAGE_NAME" != "core" ]; then + # 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 -COMMANDS+=("pnpm --dir client dev -- $*") -COMMANDS+=("node -e \"setTimeout(() => process.exit(0), 5000)\" && pnpm --dir agent dev -- $*") +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 -pnpm dev:build +if ! pnpm dev:build; then + echo "Build failed. Exiting." + exit 1 +fi # Run all commands concurrently -npx concurrently --raw "${COMMANDS[@]}" +if [ ${#COMMANDS[@]} -gt 0 ]; then + npx concurrently --raw "${COMMANDS[@]}" +else + echo "No valid packages to run." +fi