Skip to content

Commit 9a00ce1

Browse files
authored
Do not overwrite onnx_pb.js (#994)
1 parent cca6447 commit 9a00ce1

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

onnx.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,18 @@ function createProtocolBuffer () {
6464
exit 1
6565
fi
6666

67-
"$ROLLUP" \
68-
--input "${WORK_DIR}/onnx_pb.js" \
69-
--file "${LIB_ONNX_DIR}/onnx_pb.js" \
70-
--format "esm" \
71-
--plugin "@rollup/plugin-commonjs" \
72-
--plugin "@rollup/plugin-node-resolve"
73-
if [ $? -ne 0 ]; then
74-
exit 1
67+
if [ ! -f "${LIB_ONNX_DIR}/onnx_pb.js" ]; then
68+
"$ROLLUP" \
69+
--input "${WORK_DIR}/onnx_pb.js" \
70+
--file "${LIB_ONNX_DIR}/onnx_pb.js" \
71+
--format "esm" \
72+
--plugin "@rollup/plugin-commonjs" \
73+
--plugin "@rollup/plugin-node-resolve"
74+
if [ $? -ne 0 ]; then
75+
exit 1
76+
fi
77+
sed -i "1ivar window = typeof window !== 'undefined' ? window : null; var self = typeof self !== 'undefined' ? self : null;" "${LIB_ONNX_DIR}/onnx_pb.js"
7578
fi
76-
sed -i "1ivar window = typeof window !== 'undefined' ? window : null; var self = typeof self !== 'undefined' ? self : null;" "${LIB_ONNX_DIR}/onnx_pb.js"
7779

7880
cp "${WORK_DIR}/onnx_pb.d.ts" "${LIB_ONNX_DIR}"
7981
sed -i -e 's/"google-protobuf"/".\/google-protobuf.js"/' "${LIB_ONNX_DIR}/onnx_pb.d.ts"

0 commit comments

Comments
 (0)