2022-04-12 14:21:55 +03:00
|
|
|
#!/usr/bin/env python3
|
2023-11-01 17:20:32 +03:00
|
|
|
|
2018-05-04 01:44:29 +03:00
|
|
|
import os
|
2019-02-13 08:32:47 +03:00
|
|
|
import subprocess
|
2018-05-04 01:44:29 +03:00
|
|
|
import sys
|
|
|
|
|
|
|
|
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
2019-02-13 08:32:47 +03:00
|
|
|
cmd = "npm"
|
|
|
|
if sys.platform == "win32":
|
|
|
|
cmd += ".cmd"
|
|
|
|
args = [cmd, "run",
|
2018-05-04 01:44:29 +03:00
|
|
|
"--prefix",
|
|
|
|
SOURCE_ROOT
|
|
|
|
] + sys.argv[1:]
|
2019-02-13 08:32:47 +03:00
|
|
|
try:
|
|
|
|
subprocess.check_output(args, stderr=subprocess.STDOUT)
|
2019-06-15 20:26:09 +03:00
|
|
|
except subprocess.CalledProcessError as e:
|
2021-04-29 20:20:36 +03:00
|
|
|
error_msg = "NPM script '{}' failed with code '{}':\n".format(sys.argv[2], e.returncode)
|
2021-07-13 01:22:26 +03:00
|
|
|
print(error_msg + e.output.decode('utf8'))
|
2019-02-13 08:32:47 +03:00
|
|
|
sys.exit(e.returncode)
|