node_cache: Extract cached_node_modules variable.

This commit is contained in:
Tim Abbott
2017-07-21 15:53:58 -07:00
parent 5d05cc7294
commit 59abefa616

View File

@@ -58,10 +58,10 @@ def do_npm_install(target_path, npm_args, success_stamp, stdout=None, stderr=Non
['mkdir', '-p', target_path],
['cp', 'package.json', target_path],
]
cached_node_modules = os.path.join(target_path, 'node_modules')
if copy_modules:
print("Cached version not found! Copying node modules.")
cmds.append(["cp", "-rT", "prod-static/serve/node_modules",
os.path.join(target_path, "node_modules")])
cmds.append(["cp", "-rT", "prod-static/serve/node_modules", cached_node_modules])
else:
print("Cached version not found! Installing node modules.")
cmds.append(['npm', 'install'] + npm_args + ['--prefix', target_path])