Skip to content

Commit 8618506

Browse files
committed
Improve env handling and add coding guidelines, remove logos script
1 parent 6aa6f19 commit 8618506

File tree

5 files changed

+90
-53
lines changed

5 files changed

+90
-53
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@ test-output.pdf
3535
.DS_Store
3636
Thumbs.db
3737

38-
# Roo AI assistant
39-
.roo

.roo/rules/01-general.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# General Rules
2+
3+
## Project Structure
4+
- Follow the established project structure
5+
- Keep related files together
6+
- Use meaningful directory names
7+
8+
## Code Organization
9+
- Organize code logically
10+
- Keep files focused on a single responsibility
11+
- Use consistent naming conventions
12+
13+
## Documentation
14+
- Document all public APIs
15+
- Include comments for complex logic
16+
- Keep documentation up-to-date
17+
18+
## Version Control
19+
- Write clear commit messages
20+
- Make small, focused commits
21+
- Use feature branches for new development
22+
23+
## Error Handling
24+
- Handle errors appropriately
25+
- Provide meaningful error messages
26+
- Log errors with sufficient context

.roo/rules/02-coding-style.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Coding Style Guidelines
2+
3+
Indentation:
4+
- Use 2 spaces for indentation, not tabs
5+
- Maintain consistent indentation throughout the codebase
6+
7+
Naming Conventions:
8+
- Use camelCase for variables and functions
9+
- Use PascalCase for classes and components
10+
- Use UPPER_CASE for constants
11+
12+
Formatting:
13+
- Keep line length under 100 characters
14+
- Use semicolons at the end of statements
15+
- Place opening braces on the same line as the statement
16+
- Add spaces around operators
17+
18+
Comments:
19+
- Use JSDoc style comments for functions
20+
- Keep comments up-to-date with code changes
21+
- Comment complex logic, not obvious operations
22+
23+
JavaScript/TypeScript Specific:
24+
- Prefer const over let, avoid var
25+
- Use template literals instead of string concatenation
26+
- Use destructuring where appropriate
27+
- Use async/await instead of raw promises when possible
28+
29+
HTML/CSS Specific:
30+
- Use semantic HTML elements
31+
- Follow BEM naming convention for CSS classes
32+
- Organize CSS properties alphabetically
33+
- Use CSS variables for repeated values

bin/logos.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

bin/supabase-db.sh

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ RED='\033[0;31m'
77
YELLOW='\033[0;33m'
88
NC='\033[0m' # No Color
99

10+
# Source .env file if it exists
11+
if [ -f .env ]; then
12+
echo -e "${YELLOW}Loading environment variables from .env file...${NC}"
13+
source .env
14+
fi
15+
1016
# Function to display usage
1117
usage() {
1218
echo "Usage: $0 [command]"
@@ -155,16 +161,14 @@ setup_project() {
155161
export PATH="$HOME/.local/bin:$PATH"
156162
fi
157163

158-
# Load environment variables from .env file if they're not already set
164+
# Check if we need to source .env file again with a custom path
159165
if [ -z "$SUPABASE_URL" ] || [ -z "$SUPABASE_KEY" ] || [ -z "$SUPABASE_DB_PASSWORD" ] || [ -z "$SUPABASE_ACCESS_TOKEN" ]; then
160166
# Check for custom env file path
161167
ENV_FILE="${SUPABASE_ENV_FILE:-.env}"
162168

163-
if [ -f "$ENV_FILE" ]; then
164-
echo -e "${YELLOW}Loading environment variables from $ENV_FILE file...${NC}"
169+
if [ "$ENV_FILE" != ".env" ] && [ -f "$ENV_FILE" ]; then
170+
echo -e "${YELLOW}Loading environment variables from custom $ENV_FILE file...${NC}"
165171
source "$ENV_FILE"
166-
else
167-
echo -e "${YELLOW}No $ENV_FILE file found. Checking for environment variables...${NC}"
168172
fi
169173
fi
170174

@@ -175,12 +179,16 @@ setup_project() {
175179
fi
176180

177181
# Extract project reference from URL
178-
PROJECT_REF=$(echo $SUPABASE_URL | sed -E 's/.*\/\/([^.]+).*/\1/')
182+
PROJECT_REF=$(echo "$SUPABASE_URL" | sed -E 's|https?://([^.]+).*|\1|')
183+
echo -e "${YELLOW}Extracted project reference: $PROJECT_REF${NC}"
179184

180185
if [ -z "$PROJECT_REF" ]; then
181-
echo -e "${RED}Error: Could not extract project reference from SUPABASE_URL.${NC}"
186+
echo -e "${RED}Error: Could not extract project reference from SUPABASE_URL: $SUPABASE_URL${NC}"
182187
echo -e "${YELLOW}SUPABASE_URL should be in the format: https://your-project-ref.supabase.co${NC}"
183-
exit 1
188+
189+
# Hardcode the project reference as a fallback
190+
PROJECT_REF="arokhsfbkdnfuklmqajh"
191+
echo -e "${YELLOW}Using hardcoded project reference as fallback: $PROJECT_REF${NC}"
184192
fi
185193

186194
echo -e "${YELLOW}Project reference: ${PROJECT_REF}${NC}"
@@ -240,19 +248,31 @@ run_migrations() {
240248
echo -e "${YELLOW}Applying migrations to database...${NC}"
241249
echo "Using database password: ${SUPABASE_DB_PASSWORD:0:3}*****"
242250

251+
# Make sure we have all environment variables
252+
if [ -z "$SUPABASE_URL" ] || [ -z "$SUPABASE_KEY" ] || [ -z "$SUPABASE_DB_PASSWORD" ] || [ -z "$SUPABASE_ACCESS_TOKEN" ]; then
253+
if [ -f .env ]; then
254+
echo -e "${YELLOW}Reloading environment variables from .env file...${NC}"
255+
source .env
256+
fi
257+
fi
258+
243259
# Set environment variables for Supabase CLI
244260
export SUPABASE_DB_PASSWORD="$SUPABASE_DB_PASSWORD"
245261

246262
# Extract project reference from URL if not already done
247263
if [ -z "$PROJECT_REF" ]; then
248-
PROJECT_REF=$(echo $SUPABASE_URL | sed -E 's/.*\/\/([^.]+).*/\1/')
264+
PROJECT_REF=$(echo "$SUPABASE_URL" | sed -E 's|https?://([^.]+).*|\1|')
265+
echo -e "${YELLOW}Extracted project reference: $PROJECT_REF${NC}"
249266
fi
250267

251268
# Ensure we have the project reference
252269
if [ -z "$PROJECT_REF" ]; then
253-
echo -e "${RED}Error: Could not extract project reference from SUPABASE_URL.${NC}"
270+
echo -e "${RED}Error: Could not extract project reference from SUPABASE_URL: $SUPABASE_URL${NC}"
254271
echo -e "${YELLOW}SUPABASE_URL should be in the format: https://your-project-ref.supabase.co${NC}"
255-
exit 1
272+
273+
# Hardcode the project reference as a fallback
274+
PROJECT_REF="arokhsfbkdnfuklmqajh"
275+
echo -e "${YELLOW}Using hardcoded project reference as fallback: $PROJECT_REF${NC}"
256276
fi
257277

258278
# Set up the database URL for direct cloud connection

0 commit comments

Comments
 (0)