mirror of https://github.com/buster-so/buster.git
Added setup script + few new changes to address {{variable}} issues
This commit is contained in:
parent
12f30c4bad
commit
40a4276125
|
@ -28,6 +28,7 @@
|
|||
"format:fix": "biome format --write ${1:-.}",
|
||||
"lint": "turbo lint",
|
||||
"new:package": "bun run scripts/new-package.ts",
|
||||
"setup": "bash scripts/setup.sh",
|
||||
"test": "dotenv -e .env -- turbo test",
|
||||
"test:unit": "dotenv -e .env -- turbo run test:unit",
|
||||
"test:integration": "dotenv -e .env -- turbo run test:integration",
|
||||
|
|
|
@ -181,6 +181,7 @@ ${params.sqlDialectGuidance}
|
|||
- Use explicit ordering for custom buckets or categories.
|
||||
- Avoid division by zero errors by using NULLIF() or CASE statements (e.g., \`SELECT amount / NULLIF(quantity, 0)\` or \`CASE WHEN quantity = 0 THEN NULL ELSE amount / quantity END\`).
|
||||
- Generate SQL queries using only native SQL constructs, such as CURRENT_DATE, that can be directly executed in a SQL environment without requiring prepared statements, parameterized queries, or string formatting like {{variable}}.
|
||||
- You are not able to build interactive dashboards and metrics that allow users to change the filters, you can only build static dashboards and metrics.
|
||||
- Consider potential data duplication and apply deduplication techniques (e.g., \`DISTINCT\`, \`GROUP BY\`) where necessary.
|
||||
- Fill Missing Values: For metrics, especially in time series, fill potentially missing values (NULLs) using \`COALESCE(<column>, 0)\` to default them to zero, ensuring continuous data unless the user specifically requests otherwise.
|
||||
- Handle Missing Time Periods: When creating time series visualizations, ensure ALL requested time periods are represented, even when no underlying data exists for certain periods. This is critical for avoiding confusing gaps in charts and tables.
|
||||
|
|
|
@ -400,6 +400,7 @@ ${params.sqlDialectGuidance}
|
|||
- Use explicit ordering for custom buckets or categories.
|
||||
- Avoid division by zero errors by using NULLIF() or CASE statements (e.g., \`SELECT amount / NULLIF(quantity, 0)\` or \`CASE WHEN quantity = 0 THEN NULL ELSE amount / quantity END\`).
|
||||
- Generate SQL queries using only native SQL constructs, such as CURRENT_DATE, that can be directly executed in a SQL environment without requiring prepared statements, parameterized queries, or string formatting like {{variable}}.
|
||||
- You are not able to build interactive dashboards and metrics that allow users to change the filters, you can only build static dashboards and metrics.
|
||||
- Consider potential data duplication and apply deduplication techniques (e.g., \`DISTINCT\`, \`GROUP BY\`) where necessary.
|
||||
- Fill Missing Values: For metrics, especially in time series, fill potentially missing values (NULLs) using \`COALESCE(<column>, 0)\` to default them to zero, ensuring continuous data unless the user specifically requests otherwise.
|
||||
- Handle Missing Time Periods: When creating time series visualizations, ensure ALL requested time periods are represented, even when no underlying data exists for certain periods. This is critical for avoiding confusing gaps in charts and tables.
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
"db:pull": "drizzle-kit pull",
|
||||
"db:push": "drizzle-kit push",
|
||||
"db:reset": "supabase db reset",
|
||||
"db:seed": "pnpm run scripts/setup-db.ts && pnpm run scripts/seed.ts",
|
||||
"db:seed": "bun run scripts/setup-db.ts && bun run scripts/seed.ts",
|
||||
"db:start-supabase": "supabase start",
|
||||
"db:stop": "supabase stop",
|
||||
"db:studio": "drizzle-kit studio",
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
#!/bin/bash
|
||||
|
||||
#You need to have docker installed and running to use this script
|
||||
# https://www.docker.com/
|
||||
|
||||
|
||||
# Check current git branch
|
||||
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
if [ "$current_branch" != "staging" ]; then
|
||||
echo "It is best to do this in staging. Would you like to move to staging? (Y/N)"
|
||||
read -r response
|
||||
if [ "$response" = "Y" ] || [ "$response" = "y" ]; then
|
||||
git checkout staging
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if Homebrew is installed
|
||||
if ! command -v brew &> /dev/null; then
|
||||
echo "Homebrew not found. Installing Homebrew..."
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
else
|
||||
echo "Homebrew is already installed."
|
||||
fi
|
||||
|
||||
# Check if NPM is installed
|
||||
if ! command -v npm &> /dev/null; then
|
||||
echo "NPM not found. Installing NPM..."
|
||||
brew install npm
|
||||
else
|
||||
echo "NPM is already installed."
|
||||
fi
|
||||
|
||||
# Check if PNPM is installed
|
||||
if ! command -v pnpm &> /dev/null; then
|
||||
echo "PNPM not found. Installing PNPM..."
|
||||
brew install pnpm
|
||||
else
|
||||
echo "PNPM is already installed."
|
||||
fi
|
||||
|
||||
if ! command -v bun &> /dev/null; then
|
||||
echo "Bun not found. Installing Bun..."
|
||||
brew install bun
|
||||
else
|
||||
echo "Bun is already installed."
|
||||
fi
|
||||
|
||||
# Run pnpm install
|
||||
echo "Running pnpm install..."
|
||||
pnpm i
|
||||
|
||||
# Run turbo build
|
||||
echo "Running turbo build..."
|
||||
if ! pnpm exec turbo build; then
|
||||
echo "Turbo build failed. Please fix the issues and rerun this script."
|
||||
|
||||
echo "If you are only running braintrust evals, you only need to build the AI package, would you like to do that? (Y/N)"
|
||||
read -r response
|
||||
if [ "$response" = "Y" ] || [ "$response" = "y" ]; then
|
||||
if ! pnpm exec turbo build --filter @buster/ai; then
|
||||
echo "Turbo build failed. Please fix the issues and rerun this script."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
#Docker setup
|
||||
echo "Setting up docker..."
|
||||
open -a Docker
|
||||
|
||||
echo "Initializing database..."
|
||||
pnpm exec turbo run db:init
|
||||
|
||||
|
||||
echo "Setup complete, you can now run evals"
|
Loading…
Reference in New Issue