list-browserify-deps.py 526 B

1234567891011121314151617181920
  1. #!/usr/bin/env python
  2. import os
  3. import subprocess
  4. import sys
  5. SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
  6. BROWSERIFY = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'browserify')
  7. if sys.platform == 'win32':
  8. BROWSERIFY += '.cmd'
  9. deps = subprocess.check_output([BROWSERIFY, '--list'] + sys.argv[1:])
  10. for dep in deps.split('\n'):
  11. if dep:
  12. dep = os.path.relpath(dep, SOURCE_ROOT)
  13. if sys.platform == 'win32':
  14. print('/'.join(dep.split('\\')))
  15. else:
  16. print(dep)