Skip to content

Commit 77e6d3f

Browse files
mjameswhSushisource
authored andcommitted
Fix protobuf build issue
1 parent dadeec0 commit 77e6d3f

File tree

5 files changed

+57
-66
lines changed

5 files changed

+57
-66
lines changed

package-lock.json

+22-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/proto/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
"license": "MIT",
2222
"dependencies": {
2323
"long": "^5.2.3",
24-
"protobufjs": "^7.2.5"
24+
"protobufjs": "^7.5.1"
2525
},
2626
"devDependencies": {
2727
"glob": "^10.3.10",
28-
"protobufjs-cli": "^1.1.2"
28+
"protobufjs-cli": "^1.1.3"
2929
},
3030
"bugs": {
3131
"url": "https://github.com/temporalio/sdk-typescript/issues"

packages/proto/scripts/compile-proto.js

+30-41
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,8 @@ const pbts = require('protobufjs-cli/pbts');
99
const outputDir = resolve(__dirname, '../protos');
1010
const jsOutputFile = resolve(outputDir, 'json-module.js');
1111
const tempFile = resolve(outputDir, 'temp.js');
12-
const protoBaseDir = resolve(__dirname, '../../core-bridge/sdk-core/sdk-core-protos/protos');
1312

14-
const coreProtoPath = resolve(protoBaseDir, 'local/temporal/sdk/core/core_interface.proto');
15-
const workflowServiceProtoPath = resolve(protoBaseDir, 'api_upstream/temporal/api/workflowservice/v1/service.proto');
16-
const operatorServiceProtoPath = resolve(protoBaseDir, 'api_upstream/temporal/api/operatorservice/v1/service.proto');
17-
const cloudServiceProtoPath = resolve(
18-
protoBaseDir,
19-
'api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto'
20-
);
21-
const errorDetailsProtoPath = resolve(protoBaseDir, 'api_upstream/temporal/api/errordetails/v1/message.proto');
22-
const workflowMetadataProtoPath = resolve(protoBaseDir, 'api_upstream/temporal/api/sdk/v1/workflow_metadata.proto');
23-
const testServiceRRProtoPath = resolve(
24-
protoBaseDir,
25-
'testsrv_upstream/temporal/api/testservice/v1/request_response.proto'
26-
);
27-
const testServiceProtoPath = resolve(protoBaseDir, 'testsrv_upstream/temporal/api/testservice/v1/service.proto');
28-
const healthServiceProtoPath = resolve(protoBaseDir, 'grpc/health/v1/health.proto');
29-
const googleRpcStatusProtoPath = resolve(protoBaseDir, 'google/rpc/status.proto');
13+
const protoBaseDir = resolve(__dirname, '../../core-bridge/sdk-core/sdk-core-protos/protos');
3014

3115
function mtime(path) {
3216
try {
@@ -40,28 +24,15 @@ function mtime(path) {
4024
}
4125

4226
async function compileProtos(dtsOutputFile, ...args) {
43-
// Use --root to avoid conflicting with user's root
44-
// and to avoid this error: https://github.com/protobufjs/protobuf.js/issues/1114
4527
const pbjsArgs = [
46-
...args,
47-
'--wrap',
48-
'commonjs',
28+
...['--wrap', 'commonjs'],
4929
'--force-long',
5030
'--no-verify',
5131
'--alt-comment',
52-
'--root',
53-
'__temporal',
54-
resolve(require.resolve('protobufjs'), '../google/protobuf/descriptor.proto'),
55-
coreProtoPath,
56-
workflowServiceProtoPath,
57-
operatorServiceProtoPath,
58-
cloudServiceProtoPath,
59-
errorDetailsProtoPath,
60-
workflowMetadataProtoPath,
61-
testServiceRRProtoPath,
62-
testServiceProtoPath,
63-
healthServiceProtoPath,
64-
googleRpcStatusProtoPath,
32+
// Use --root to avoid conflicting with user's root
33+
// and to avoid this error: https://github.com/protobufjs/protobuf.js/issues/1114
34+
...['--root', '__temporal'],
35+
...args,
6536
];
6637

6738
console.log(`Creating protobuf JS definitions`);
@@ -101,14 +72,32 @@ async function main() {
10172
return;
10273
}
10374

104-
await compileProtos(
105-
resolve(outputDir, 'root.d.ts'),
106-
'--path',
75+
const rootDirs = [
10776
resolve(protoBaseDir, 'api_upstream'),
108-
'--path',
77+
resolve(protoBaseDir, 'testsrv_upstream'),
10978
resolve(protoBaseDir, 'local'),
110-
'--path',
111-
resolve(protoBaseDir, 'api_cloud_upstream')
79+
resolve(protoBaseDir, 'api_cloud_upstream'),
80+
protoBaseDir, // 'grpc' and 'google' are directly under protoBaseDir
81+
];
82+
83+
const entrypoints = [
84+
'temporal/sdk/core/core_interface.proto',
85+
'temporal/api/workflowservice/v1/service.proto',
86+
'temporal/api/operatorservice/v1/service.proto',
87+
'temporal/api/cloud/cloudservice/v1/service.proto',
88+
'temporal/api/errordetails/v1/message.proto',
89+
'temporal/api/sdk/v1/workflow_metadata.proto',
90+
'temporal/api/testservice/v1/request_response.proto',
91+
'temporal/api/testservice/v1/service.proto',
92+
'grpc/health/v1/health.proto',
93+
'google/rpc/status.proto',
94+
];
95+
96+
await compileProtos(
97+
resolve(outputDir, 'root.d.ts'),
98+
// Make sure to include all
99+
...rootDirs.flatMap((dir) => ['--path', dir]),
100+
...entrypoints
112101
);
113102

114103
console.log('Done');

packages/test/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
"istanbul-lib-coverage": "^3.2.2",
5252
"long": "^5.2.3",
5353
"node-fetch": "^2.7.0",
54-
"protobufjs": "^7.2.5",
55-
"protobufjs-cli": "^1.1.2",
54+
"protobufjs": "^7.5.1",
55+
"protobufjs-cli": "^1.1.3",
5656
"rxjs": "7.8.1",
5757
"stack-utils": "^2.0.6",
5858
"uuid": "^9.0.1"

0 commit comments

Comments
 (0)