99 lines
2.1 KiB
Markdown
99 lines
2.1 KiB
Markdown
# Setting Up Explorer as Git Submodule
|
|
|
|
## Current Status
|
|
|
|
The explorer monorepo has been created and initialized as a git repository. It's currently configured as a local submodule.
|
|
|
|
## Converting to Remote Repository (Recommended)
|
|
|
|
To make the submodule work properly with remote repositories:
|
|
|
|
### Step 1: Create Remote Repository
|
|
|
|
1. Create a new repository on GitHub/GitLab/etc:
|
|
- Name: `chain-138-explorer`
|
|
- Description: "Blockchain explorer for ChainID 138"
|
|
|
|
### Step 2: Push Explorer to Remote
|
|
|
|
```bash
|
|
cd explorer-monorepo
|
|
|
|
# Add remote
|
|
git remote add origin https://github.com/yourusername/chain-138-explorer.git
|
|
|
|
# Push to remote
|
|
git push -u origin main
|
|
```
|
|
|
|
### Step 3: Update Submodule Reference
|
|
|
|
In the parent project:
|
|
|
|
```bash
|
|
cd /home/intlc/projects/proxmox
|
|
|
|
# Update .gitmodules
|
|
cat > .gitmodules <<EOF
|
|
[submodule "explorer-monorepo"]
|
|
path = explorer-monorepo
|
|
url = https://github.com/yourusername/chain-138-explorer.git
|
|
EOF
|
|
|
|
# Update submodule reference
|
|
git submodule sync
|
|
git add .gitmodules
|
|
git commit -m "Update explorer submodule to use remote repository"
|
|
```
|
|
|
|
## Using the Submodule
|
|
|
|
### Clone Parent Project with Submodule
|
|
|
|
```bash
|
|
git clone <parent-repo-url>
|
|
cd proxmox
|
|
git submodule update --init --recursive
|
|
```
|
|
|
|
### Update Submodule
|
|
|
|
```bash
|
|
# Update to latest
|
|
cd explorer-monorepo
|
|
git pull origin main
|
|
cd ..
|
|
git add explorer-monorepo
|
|
git commit -m "Update explorer submodule"
|
|
```
|
|
|
|
### Work on Submodule
|
|
|
|
```bash
|
|
cd explorer-monorepo
|
|
# Make changes
|
|
git add .
|
|
git commit -m "Your changes"
|
|
git push origin main
|
|
cd ..
|
|
git add explorer-monorepo
|
|
git commit -m "Update submodule reference"
|
|
```
|
|
|
|
## Local Development (Current Setup)
|
|
|
|
If keeping it as a local submodule:
|
|
|
|
1. Work directly in `explorer-monorepo/`
|
|
2. Commit changes normally
|
|
3. The parent project will track the submodule state
|
|
|
|
## Benefits of Monorepo Structure
|
|
|
|
1. **Organization**: Clear separation of concerns
|
|
2. **Versioning**: Independent versioning of explorer
|
|
3. **Reusability**: Can be used in other projects
|
|
4. **Deployment**: Standalone deployment scripts
|
|
5. **Documentation**: Self-contained documentation
|
|
|