feat: added base directory's

This commit is contained in:
David Janowski 2024-02-20 10:45:07 +01:00
parent e888965b83
commit 23cd699db0
11 changed files with 62 additions and 5 deletions

4
.gitignore vendored
View File

@ -189,6 +189,6 @@ $RECYCLE.BIN/
.idea/*
/.run/*
*.env
api/gRPC/*
!**/.gitkeep

4
.gitmodules vendored
View File

@ -1,4 +1,4 @@
[submodule "thrid_party/grpc-proto"]
path = thrid_party/grpc-proto
[submodule "third_party/grpc-proto"]
path = third_party/grpc-proto
url = https://git.dragse.it/anthrove/grpc-proto.git
branch = release/v1.0.0

0
api/gRPC/.gitkeep Normal file
View File

0
cmd/.gitkeep Normal file
View File

0
config/.gitkeep Normal file
View File

1
deployment/.gitkeep Normal file
View File

@ -0,0 +1 @@

0
internal/.gitkeep Normal file
View File

0
pkg/.gitkeep Normal file
View File

9
scripts/README.md Normal file
View File

@ -0,0 +1,9 @@
# Generate the gRPC files
To generate the gRPC files you need to do the following:
1. Download the Git submodules (if you didn't clone this repo with ``git clone --recurse-submodules``)
```bash
git submodule init
git submodule update
```

View File

@ -0,0 +1,28 @@
New-Item -Path "api" -Name "gRPC" -ItemType Directory -Force
$plugName = ""
protoc `
--proto_path=third_party/grpc-proto `
--go_out=api/gRPC `
--go_opt=paths=source_relative `
--go-grpc_out=api/gRPC `
--go-grpc_opt=paths=source_relative `
third_party/grpc-proto/*.proto `
function Replace-Text {
param (
[string]$Path,
[string]$OldText,
[string]$NewText
)
Get-ChildItem -Path $Path -Recurse -File | ForEach-Object {
$content = Get-Content $_.FullName
$content = $content -replace $OldText, $NewText
Set-Content -Path $_.FullName -Value $content
}
}
Replace-Text -Path "./api/gRPC" -OldText "git.dragse.it/anthrove/plug-[REPLACE_ME]/api/gRPC" -NewText "git.dragse.it/anthrove/plug-$plugName/api/gRPC"

View File

@ -0,0 +1,19 @@
#!/bin/bash
mkdir -p "api/gRPC"
plugName = ""
protoc \
--proto_path=third_party/grpc-proto \
--go_out=api/gRPC \
--go_opt=paths=source_relative \
--go-grpc_out=api/gRPC \
--go-grpc_opt=paths=source_relative \
third_party/grpc-proto/*.proto
dir_path="./api/gRPC"
old_text="git.dragse.it/anthrove/plug-[REPLACE_ME]/api/gRPC"
new_text="git.dragse.it/anthrove/plug-$plugName/api/gRPC""
grep -rlZ "$old_text" "$dir_path" | xargs -0 sed -i "s#$old_text#$new_text#g"