Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Integrate and customize shadcn/ui components—discovery, installation, theming, and Radix/Base UI best practices
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/verify-setup.sh
1#!/usr/bin/env bash2# shadcn/ui Setup Verification Script3# Validates that a project is correctly configured for shadcn/ui45set -e67GREEN='\033[0;32m'8RED='\033[0;31m'9YELLOW='\033[1;33m'10NC='\033[0m' # No Color1112echo "🔍 Verifying shadcn/ui setup..."13echo ""1415# Check if components.json exists16if [ -f "components.json" ]; then17echo -e "${GREEN}✓${NC} components.json found"18else19echo -e "${RED}✗${NC} components.json not found"20echo -e " ${YELLOW}Run:${NC} npx shadcn@latest init"21exit 122fi2324# Check if tailwind.config exists25if [ -f "tailwind.config.js" ] || [ -f "tailwind.config.ts" ]; then26echo -e "${GREEN}✓${NC} Tailwind config found"27else28echo -e "${RED}✗${NC} tailwind.config.js not found"29echo -e " ${YELLOW}Install Tailwind:${NC} npm install -D tailwindcss postcss autoprefixer"30exit 131fi3233# Check if tsconfig.json has path aliases34if [ -f "tsconfig.json" ]; then35if grep -q '"@/\*"' tsconfig.json; then36echo -e "${GREEN}✓${NC} Path aliases configured in tsconfig.json"37else38echo -e "${YELLOW}⚠${NC} Path aliases not found in tsconfig.json"39echo " Add to compilerOptions.paths:"40echo ' "@/*": ["./src/*"]'41fi42else43echo -e "${YELLOW}⚠${NC} tsconfig.json not found (TypeScript not configured)"44fi4546# Check if globals.css or equivalent exists47if [ -f "src/index.css" ] || [ -f "src/globals.css" ] || [ -f "app/globals.css" ]; then48echo -e "${GREEN}✓${NC} Global CSS file found"4950# Check for Tailwind directives51CSS_FILE=$(find . -name "globals.css" -o -name "index.css" | head -n 1)52if grep -q "@tailwind base" "$CSS_FILE"; then53echo -e "${GREEN}✓${NC} Tailwind directives present"54else55echo -e "${RED}✗${NC} Tailwind directives missing"56echo " Add to your CSS file:"57echo " @tailwind base;"58echo " @tailwind components;"59echo " @tailwind utilities;"60fi6162# Check for CSS variables63if grep -q "^:root" "$CSS_FILE" || grep -q "@layer base" "$CSS_FILE"; then64echo -e "${GREEN}✓${NC} CSS variables defined"65else66echo -e "${YELLOW}⚠${NC} CSS variables not found"67echo " shadcn/ui requires CSS variables for theming"68fi69else70echo -e "${RED}✗${NC} Global CSS file not found"71fi7273# Check if components/ui directory exists74if [ -d "src/components/ui" ] || [ -d "components/ui" ]; then75echo -e "${GREEN}✓${NC} components/ui directory exists"7677# Count components78COMPONENT_COUNT=$(find . -path "*/components/ui/*.tsx" -o -path "*/components/ui/*.jsx" | wc -l)79echo -e " ${COMPONENT_COUNT} components installed"80else81echo -e "${YELLOW}⚠${NC} components/ui directory not found"82echo " Add your first component: npx shadcn@latest add button"83fi8485# Check if lib/utils exists86if [ -f "src/lib/utils.ts" ] || [ -f "lib/utils.ts" ]; then87echo -e "${GREEN}✓${NC} lib/utils.ts exists"8889# Check for cn function90UTILS_FILE=$(find . -name "utils.ts" | grep "lib" | head -n 1)91if grep -q "export function cn" "$UTILS_FILE"; then92echo -e "${GREEN}✓${NC} cn() utility function present"93else94echo -e "${RED}✗${NC} cn() utility function missing"95fi96else97echo -e "${RED}✗${NC} lib/utils.ts not found"98fi99100# Check package.json dependencies101if [ -f "package.json" ]; then102echo ""103echo "📦 Checking dependencies..."104105# Required dependencies106REQUIRED_DEPS=("react" "tailwindcss")107RECOMMENDED_DEPS=("class-variance-authority" "clsx" "tailwind-merge" "tailwindcss-animate")108109for dep in "${REQUIRED_DEPS[@]}"; do110if grep -q "\"$dep\"" package.json; then111echo -e "${GREEN}✓${NC} $dep installed"112else113echo -e "${RED}✗${NC} $dep not installed"114fi115done116117echo ""118echo "Recommended dependencies:"119for dep in "${RECOMMENDED_DEPS[@]}"; do120if grep -q "\"$dep\"" package.json; then121echo -e "${GREEN}✓${NC} $dep installed"122else123echo -e "${YELLOW}⚠${NC} $dep not installed (recommended)"124fi125done126fi127128echo ""129echo -e "${GREEN}✓${NC} Setup verification complete!"130echo ""131echo "Next steps:"132echo " 1. Add components: npx shadcn@latest add [component]"133echo " 2. View catalog: npx shadcn@latest add --help"134echo " 3. Browse docs: https://ui.shadcn.com"135