refactor: support invoke tasks.py from other dir
This commit is contained in:
parent
6839c4f573
commit
9d77f65495
@ -1,6 +1,7 @@
|
||||
from invoke import task
|
||||
from pathlib import Path
|
||||
|
||||
from invoke import task
|
||||
|
||||
ROOT = Path(__file__).parent
|
||||
PB_ROOT = ROOT / "pb"
|
||||
|
||||
@ -27,13 +28,14 @@ def gen(c, target="types"):
|
||||
"""
|
||||
Generate gRPC client code.
|
||||
"""
|
||||
outDir = "gen/types"
|
||||
outDir = "gen/" + target
|
||||
paths = Path(PB_ROOT).glob('**/*.proto')
|
||||
for path in paths:
|
||||
# because path is object not string
|
||||
pathStr = str(path)
|
||||
print("Generating f or", pathStr)
|
||||
print("Generating for", pathStr)
|
||||
cmd = Path(c.run("npm bin").stdout.rstrip()).joinpath("proto-loader-gen-types")
|
||||
c.run(
|
||||
"npx proto-loader-gen-types --includeComments --grpcLib @grpc/grpc-js -I pb -O {} {}"
|
||||
.format(outDir, pathStr)
|
||||
"{} --includeComments --grpcLib @grpc/grpc-js -I pb -O {} {}"
|
||||
.format(cmd, outDir, pathStr)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user