add script to support update nodejs binding version (#4164)

This commit is contained in:
Yulong Wang 2020-06-09 13:12:55 -07:00 committed by GitHub
parent 4377ff4a1a
commit 2b3ce1b090
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
import os
import json
def update_version():
@ -87,6 +88,19 @@ def update_version():
continue
f.write(line)
# update version for node.js binding
current_version = ''
file_names = ['package.json', 'package-lock.json']
file_paths = [os.path.join(cwd, '..', '..', 'nodejs', file_name) for file_name in file_names]
for file_path in file_paths:
with open(file_path) as f:
content = json.load(f)
current_version = content['version']
if version != current_version:
content['version'] = version
with open(file_path, 'w') as f:
json.dump(content, f, indent=2)
if __name__ == "__main__":
update_version()