Skip to content

Commit

Permalink
fix package generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Cannizzaro committed Jul 6, 2017
1 parent 1bcf540 commit 3bdc3f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions npm-install.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ def exec(args, pn):
return subprocess.Popen(args, cwd=pn, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

def node_modules_ls(file, pn):
if not os.path.isfile('%s/package.json' % pn):
exec(['npm', 'init', '-f'], pn).wait()
if file not in root:
out, err = exec(['npm', 'root'], pn).communicate()
out = out.decode().strip()
root[file] = out
try:
project = out.split('node_modules')[0]
if not os.path.isfile('%spackage.json' % project):
exec(['npm', 'init', '-f'], project).wait()
return listdir(root[file])
except Exception:
return []
Expand Down

0 comments on commit 3bdc3f9

Please sign in to comment.