-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.js
37 lines (30 loc) · 1.21 KB
/
build.js
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
37
'use strict';
const child_process = require('node:child_process');
const { join, resolve } = require('node:path');
const version = '3.2.0';
const paths = [
`../spot-sdk-py/spot-sdk-${version}/protos`,
`../spot-sdk-py/spot-sdk-${version}/protos/bosdyn/api/*.proto`,
`../spot-sdk-py/spot-sdk-${version}/protos/bosdyn/api/autowalk/*.proto`,
`../spot-sdk-py/spot-sdk-${version}/protos/bosdyn/api/spot_cam/*.proto`,
`../spot-sdk-py/spot-sdk-${version}/protos/bosdyn/api/spot/*.proto`,
`../spot-sdk-py/spot-sdk-${version}/protos/bosdyn/api/mission/*.proto`,
`../spot-sdk-py/spot-sdk-${version}/protos/bosdyn/api/graph_nav/*.proto`,
`../spot-sdk-py/spot-sdk-${version}/protos/bosdyn/api/docking/*.proto`,
`../spot-sdk-py/spot-sdk-${version}/protos/bosdyn/api/auto_return/*.proto`,
];
const output = './';
const options = [
`--js_out=import_style=commonjs,binary:${output}`,
`--grpc_out=grpc_js:${output}`,
`--proto_path=${paths.map(e => resolve(join(e))).join(' ')}`,
];
const command = `grpc_tools_node_protoc ${options.join(' ')}`;
child_process.exec(command, (err, stdout, stderr) => {
if (err) {
console.error(err);
return;
}
if (stderr) console.log(stderr);
console.log('BUILD COMPLETE!');
});