feat: added base directory's
This commit is contained in:
parent
e888965b83
commit
23cd699db0
6
.gitignore
vendored
6
.gitignore
vendored
@ -189,6 +189,6 @@ $RECYCLE.BIN/
|
||||
|
||||
.idea/*
|
||||
/.run/*
|
||||
|
||||
|
||||
*.env
|
||||
*.env
|
||||
api/gRPC/*
|
||||
!**/.gitkeep
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -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
0
api/gRPC/.gitkeep
Normal file
0
cmd/.gitkeep
Normal file
0
cmd/.gitkeep
Normal file
0
config/.gitkeep
Normal file
0
config/.gitkeep
Normal file
1
deployment/.gitkeep
Normal file
1
deployment/.gitkeep
Normal file
@ -0,0 +1 @@
|
||||
|
0
internal/.gitkeep
Normal file
0
internal/.gitkeep
Normal file
0
pkg/.gitkeep
Normal file
0
pkg/.gitkeep
Normal file
9
scripts/README.md
Normal file
9
scripts/README.md
Normal 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
|
||||
```
|
28
scripts/generate_grpc_files.ps1
Normal file
28
scripts/generate_grpc_files.ps1
Normal 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"
|
19
scripts/generate_grpc_files.sh
Normal file
19
scripts/generate_grpc_files.sh
Normal 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"
|
Reference in New Issue
Block a user