2020-11-24 05:26:54 +00:00
|
|
|
import os
|
2019-04-30 20:59:47 +00:00
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
def npx(*npx_args):
|
2020-11-24 05:26:54 +00:00
|
|
|
npx_env = os.environ.copy()
|
|
|
|
npx_env['npm_config_yes'] = 'true'
|
2019-04-30 20:59:47 +00:00
|
|
|
call_args = [__get_executable_name()] + list(npx_args)
|
2020-11-24 05:26:54 +00:00
|
|
|
subprocess.check_call(call_args, env=npx_env)
|
2019-04-30 20:59:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
def __get_executable_name():
|
|
|
|
executable = 'npx'
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
executable += '.cmd'
|
|
|
|
return executable
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
npx(*sys.argv[1:])
|