chore: switch to bun package manager

This commit is contained in:
ARUNAVO RAY
2025-05-20 15:16:51 +05:30
parent 38206e7d3d
commit d5b0102080
17 changed files with 130 additions and 150 deletions

View File

@@ -43,7 +43,7 @@ The script uses environment variables from the `.env` file in the project root:
3. Using with docker-compose:
```bash
# Ensure dependencies are installed and database is initialized
pnpm setup
bun run setup
# First build the image
./scripts/build-docker.sh --load

View File

@@ -19,38 +19,38 @@ This is a consolidated database management tool that handles all database-relate
You can execute the database management tool using your package manager with various commands:
```bash
# Checks database status (default action if no command is specified, equivalent to 'pnpm check-db')
pnpm manage-db
# Checks database status (default action if no command is specified, equivalent to 'bun run check-db')
bun run manage-db
# Check database status
pnpm check-db
bun run check-db
# Initialize the database (only if it doesn't exist)
pnpm init-db
bun run init-db
# Fix database location issues
pnpm fix-db
bun run fix-db
# Automatic check, fix, and initialize if needed
pnpm db-auto
bun run db-auto
# Reset all users (for testing signup flow)
pnpm reset-users
bun run reset-users
# Update the database schema to the latest version
pnpm update-schema
bun run update-schema
# Remove database files completely
pnpm cleanup-db
bun run cleanup-db
# Complete setup (install dependencies and initialize database)
pnpm setup
bun run setup
# Start development server with a fresh database
pnpm dev:clean
bun run dev:clean
# Start production server with a fresh database
pnpm start:fresh
bun run start:fresh
```
## Database File Location

4
scripts/docker-diagnostics.sh Executable file → Normal file
View File

@@ -105,12 +105,12 @@ echo -e "${BLUE} Recommendations ${NC}"
echo -e "${BLUE}=====================================================${NC}"
echo -e "\n${YELLOW}For local development:${NC}"
echo -e "1. ${GREEN}pnpm setup${NC} (initialize database and install dependencies)"
echo -e "1. ${GREEN}bun run setup${NC} (initialize database and install dependencies)"
echo -e "2. ${GREEN}./scripts/build-docker.sh --load${NC} (build and load into Docker)"
echo -e "3. ${GREEN}docker-compose -f docker-compose.dev.yml up -d${NC} (start the development container)"
echo -e "\n${YELLOW}For production deployment (using Docker Compose):${NC}"
echo -e "1. ${GREEN}pnpm setup${NC} (if not already done, to ensure database schema is ready)"
echo -e "1. ${GREEN}bun run setup${NC} (if not already done, to ensure database schema is ready)"
echo -e "2. ${GREEN}docker-compose --profile production up -d${NC} (start the production container)"
echo -e "\n${YELLOW}For CI/CD builds:${NC}"

View File

@@ -168,7 +168,7 @@ async function checkDatabase() {
);
console.warn("This file should be in the data directory.");
console.warn(
'Run "pnpm manage-db fix" to fix this issue or "pnpm cleanup-db" to remove it.'
'Run "bun run manage-db fix" to fix this issue or "bun run cleanup-db" to remove it.'
);
}
@@ -215,12 +215,12 @@ async function checkDatabase() {
} catch (error) {
console.error("❌ Error connecting to the database:", error);
console.warn(
'The database file might be corrupted. Consider running "pnpm manage-db init" to recreate it.'
'The database file might be corrupted. Consider running "bun run manage-db init" to recreate it.'
);
}
} else {
console.warn("⚠️ WARNING: Database file not found in data directory.");
console.warn('Run "pnpm manage-db init" to create it.');
console.warn('Run "bun run manage-db init" to create it.');
}
}
@@ -235,10 +235,10 @@ async function initializeDatabase() {
if (fs.existsSync(dataDbFile)) {
console.log("⚠️ Database already exists at data/gitea-mirror.db");
console.log(
'If you want to recreate the database, run "pnpm cleanup-db" first.'
'If you want to recreate the database, run "bun run cleanup-db" first.'
);
console.log(
'Or use "pnpm manage-db reset-users" to just remove users without recreating tables.'
'Or use "bun run manage-db reset-users" to just remove users without recreating tables.'
);
// Check if we can connect to it
@@ -457,7 +457,7 @@ async function resetUsers() {
if (!doesDbExist) {
console.log(
"❌ Database file doesn't exist. Run 'pnpm manage-db init' first to create it."
"❌ Database file doesn't exist. Run 'bun run manage-db init' first to create it."
);
return;
}
@@ -629,7 +629,7 @@ async function fixDatabaseIssues() {
console.warn(
"⚠️ WARNING: Production database file not found in data directory."
);
console.warn('Run "pnpm manage-db init" to create it.');
console.warn('Run "bun run manage-db init" to create it.');
} else {
console.log("✅ Production database file found in data directory.");
@@ -641,7 +641,7 @@ async function fixDatabaseIssues() {
} catch (error) {
console.error("❌ Error connecting to the database:", error);
console.warn(
'The database file might be corrupted. Consider running "pnpm manage-db init" to recreate it.'
'The database file might be corrupted. Consider running "bun run manage-db init" to recreate it.'
);
}
}
@@ -692,7 +692,7 @@ Available commands:
reset-users - Remove all users and their data
auto - Automatic mode: check, fix, and initialize if needed
Usage: pnpm manage-db [command]
Usage: bun run manage-db [command]
`);
}
}