forked from googleapis/nodejs-video-intelligence
-
Notifications
You must be signed in to change notification settings - Fork 0
/
synth.py
36 lines (28 loc) · 1.01 KB
/
synth.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import synthtool as s
import synthtool.gcp as gcp
import logging
import subprocess
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICGenerator()
common_templates = gcp.CommonTemplates()
versions = ["v1", "v1beta1", "v1beta2", "v1p1beta1", "v1p2beta1"]
for version in versions:
library = gapic.node_library(
"video-intelligence",
version,
config_path="/google/cloud/videointelligence/"
f"artman_videointelligence_{version}.yaml",
)
# skip index, protos, package.json, and README.md
s.copy(library, excludes=["package.json", "README.md", "src/index.js"])
#
# Generator emitted unused helper mockSimpleGrpcMethod, add a temporary
# s.replace to remove that function.
# ref: https://github.com/googleapis/gapic-generator/issues/2120
#
s.replace("test/gapic-*.js", "function mockSimpleGrpcMethod.*\n(.*\n)*?}\n", "")
templates = common_templates.node_library()
s.copy(templates)
# Node.js specific cleanup
subprocess.run(["npm", "install"])
subprocess.run(["npm", "run", "fix"])