Skip to content

Commit 745f359

Browse files
author
hex316aa
committed
Prepare the project for its first release on a new code-hosting platform
Adds GitHub migration script, configures Firebase with env vars, and updates auth. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 985aacde-9109-4e26-b972-11f321cb8110 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/748ca40c-adc5-4420-89fe-05eb662dff30/bc825ebd-bb61-4abf-bb81-aab4fa17042f.jpg
1 parent c3e2f9f commit 745f359

6 files changed

Lines changed: 174 additions & 14 deletions

File tree

.env.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# PostgreSQL Database
2+
DATABASE_URL=postgres://username:password@localhost:5432/codepatchwork
3+
4+
# Firebase Configuration
5+
VITE_FIREBASE_API_KEY=your-api-key
6+
VITE_FIREBASE_PROJECT_ID=your-project-id
7+
VITE_FIREBASE_APP_ID=your-app-id
8+
VITE_FIREBASE_MESSAGING_SENDER_ID=your-messaging-sender-id

.replit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ hidden = [".config", ".git", "generated-icon.png", "node_modules", "dist"]
44

55
[nix]
66
channel = "stable-24_05"
7+
packages = ["nano"]
78

89
[deployment]
910
deploymentTarget = "autoscale"

GITHUB_MIGRATION.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# CodePatchwork GitHub Migration Guide
2+
3+
This document provides instructions for migrating the CodePatchwork project to GitHub. Follow these steps to complete the migration process.
4+
5+
## Prerequisites
6+
7+
Before starting the migration process, ensure you have:
8+
9+
1. A GitHub account
10+
2. [Git](https://git-scm.com/) installed on your computer
11+
3. The GitHub repository already created at: https://github.com/hexawolf/CodePatchwork
12+
4. A local copy of the CodePatchwork project
13+
14+
## Step 1: Prepare Your Environment Variables
15+
16+
Before migrating to GitHub, create a `.env.example` file that shows the required environment variables without actual values. This helps other contributors set up their environment correctly.
17+
18+
```
19+
# PostgreSQL Database
20+
DATABASE_URL=postgres://username:password@localhost:5432/codepatchwork
21+
22+
# Firebase Configuration
23+
VITE_FIREBASE_API_KEY=your-api-key
24+
VITE_FIREBASE_PROJECT_ID=your-project-id
25+
VITE_FIREBASE_APP_ID=your-app-id
26+
VITE_FIREBASE_MESSAGING_SENDER_ID=your-messaging-sender-id
27+
```
28+
29+
## Step 2: Run the Migration Script
30+
31+
We've provided a migration script to simplify the process. This script will:
32+
33+
- Initialize a Git repository (if one doesn't exist)
34+
- Add all files to Git
35+
- Create an initial commit
36+
- Set up the GitHub remote
37+
38+
Run the script with:
39+
40+
```bash
41+
./scripts/github-migration.sh
42+
```
43+
44+
## Step 3: Push to GitHub
45+
46+
After running the migration script, push the code to GitHub:
47+
48+
```bash
49+
# Push to the main branch
50+
git push -u origin main
51+
```
52+
53+
## Step 4: Create a Version Tag
54+
55+
To tag this as version 1.0.0:
56+
57+
```bash
58+
# Create an annotated tag
59+
git tag -a v1.0.0 -m "First stable release"
60+
61+
# Push the tag to GitHub
62+
git push origin v1.0.0
63+
```
64+
65+
## Step 5: Configure GitHub Repository Settings
66+
67+
After pushing your code, configure your GitHub repository settings:
68+
69+
1. **Branch Protection:** Go to Settings > Branches and add protection rules for the main branch
70+
2. **GitHub Pages:** If you want to set up a project website, configure GitHub Pages in Settings > Pages
71+
3. **GitHub Actions:** Check that the CI workflow is properly set up in the Actions tab
72+
73+
## Step 6: Set Up GitHub Secrets
74+
75+
To enable CI/CD with Firebase, add the following secrets to your GitHub repository:
76+
77+
1. Go to Settings > Secrets and variables > Actions
78+
2. Add the following repository secrets:
79+
- `VITE_FIREBASE_API_KEY`
80+
- `VITE_FIREBASE_PROJECT_ID`
81+
- `VITE_FIREBASE_APP_ID`
82+
83+
## Database Schema Issues
84+
85+
If you encounter database schema issues when deploying to a new environment, run the database migration script:
86+
87+
```bash
88+
node scripts/fix-database-schema.js
89+
```
90+
91+
## Next Steps
92+
93+
After migration, consider:
94+
95+
- Setting up project boards for task management
96+
- Creating issue templates
97+
- Adding more detailed documentation in the Wiki
98+
- Setting up automated releases
99+
- Creating a development branch for ongoing work
100+
101+
---
102+
103+
Congratulations! Your project is now on GitHub and ready for collaboration.

client/src/contexts/AuthContext.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ export function AuthProvider({ children }: AuthProviderProps) {
156156

157157
async function signInWithGoogle(): Promise<User> {
158158
try {
159-
console.log("Starting Google sign-in process...");
160-
161159
// Ensure Firebase auth is available
162160
if (!auth) {
163161
throw new Error("Firebase authentication is not available");
@@ -179,15 +177,10 @@ export function AuthProvider({ children }: AuthProviderProps) {
179177
// Use popup for mobile compatibility
180178
const result = await signInWithPopup(auth, provider);
181179

182-
// Log success info (for debugging)
183-
console.log("Google sign in successful");
184-
185180
// Register with our backend
186181
await registerUserWithBackend(result.user);
187182
return result.user;
188183
} catch (error: any) {
189-
console.error("Google sign in error:", error);
190-
191184
// Provide a more user-friendly error message
192185
let errorMessage = 'An error occurred during Google sign in';
193186

client/src/lib/firebase.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import { initializeApp } from "firebase/app";
22
import { getAuth, GoogleAuthProvider } from "firebase/auth";
33

4-
// Set up Firebase config with hardcoded values to match production
4+
/**
5+
* Firebase configuration using environment variables.
6+
* Required environment variables:
7+
* - VITE_FIREBASE_API_KEY: Your Firebase API key
8+
* - VITE_FIREBASE_PROJECT_ID: Your Firebase project ID
9+
* - VITE_FIREBASE_APP_ID: Your Firebase app ID
10+
*/
511
const firebaseConfig = {
612
apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
713
authDomain: `${import.meta.env.VITE_FIREBASE_PROJECT_ID}.firebaseapp.com`,
814
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
915
storageBucket: `${import.meta.env.VITE_FIREBASE_PROJECT_ID}.appspot.com`,
10-
messagingSenderId: "240481486822", // Adding this required field
16+
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID || "000000000000",
1117
appId: import.meta.env.VITE_FIREBASE_APP_ID,
1218
};
1319

14-
// Log config for debugging (excluding sensitive data)
15-
console.log("Firebase initialization with project:", firebaseConfig.projectId);
16-
1720
// Initialize Firebase
1821
const app = initializeApp(firebaseConfig);
1922

@@ -28,7 +31,5 @@ googleProvider.setCustomParameters({
2831
prompt: 'select_account'
2932
});
3033

31-
console.log("Firebase initialized successfully");
32-
3334
export { auth, googleProvider };
3435
export default app;

scripts/github-migration.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
# CodePatchwork GitHub Migration Script
4+
# This script helps prepare the CodePatchwork project for GitHub migration
5+
# It will initialize Git, add all files, create an initial commit, and set the remote
6+
7+
set -e # Exit immediately if a command exits with a non-zero status
8+
9+
echo "🚀 Preparing CodePatchwork for GitHub migration..."
10+
11+
# Make sure we're in the root directory
12+
ROOT_DIR=$(pwd)
13+
14+
# Check if .git directory already exists
15+
if [ -d ".git" ]; then
16+
echo "ℹ️ Git repository already initialized."
17+
else
18+
# Initialize git repository
19+
echo "📁 Initializing Git repository..."
20+
git init
21+
fi
22+
23+
# Add all files (excluding those in .gitignore)
24+
echo "📝 Adding files to Git repository..."
25+
git add .
26+
27+
# Create initial commit
28+
echo "💾 Creating initial commit..."
29+
git commit -m "Initial commit: CodePatchwork v1.0"
30+
31+
# Check if remote already exists
32+
if git remote | grep -q "origin"; then
33+
# Update remote if it exists
34+
echo "🔄 Updating remote origin..."
35+
git remote set-url origin https://github.com/hexawolf/CodePatchwork.git
36+
else
37+
# Add remote if it doesn't exist
38+
echo "🔗 Adding remote origin..."
39+
git remote add origin https://github.com/hexawolf/CodePatchwork.git
40+
fi
41+
42+
# Display next steps
43+
echo ""
44+
echo "✅ Git repository preparation complete!"
45+
echo ""
46+
echo "Next steps:"
47+
echo "1. Push to GitHub with:"
48+
echo " git push -u origin main"
49+
echo ""
50+
echo "2. To tag this version with v1.0.0:"
51+
echo " git tag -a v1.0.0 -m \"First stable release\""
52+
echo " git push origin v1.0.0"
53+
echo ""
54+
echo "Your project is now ready for GitHub migration! 🎉"

0 commit comments

Comments
 (0)