diff --git a/scripts/lib/node_cache.py b/scripts/lib/node_cache.py index 354fb1d049..78d0ce9e97 100644 --- a/scripts/lib/node_cache.py +++ b/scripts/lib/node_cache.py @@ -27,8 +27,12 @@ def generate_sha1sum_node_modules(npm_args=None): return sha1sum.hexdigest() -def setup_node_modules(npm_args=None, stdout=None, stderr=None, copy_modules=False): - # type: (Optional[List[str]], Optional[IO], Optional[IO], bool) -> None +def setup_node_modules(production=False, stdout=None, stderr=None, copy_modules=False): + # type: (bool, Optional[IO], Optional[IO], bool) -> None + if production: + npm_args = ["--production"] + else: + npm_args = [] sha1sum = generate_sha1sum_node_modules(npm_args) npm_cache = os.path.join(NODE_MODULES_CACHE_PATH, sha1sum) cached_node_modules = os.path.join(npm_cache, 'node_modules') @@ -36,7 +40,7 @@ def setup_node_modules(npm_args=None, stdout=None, stderr=None, copy_modules=Fal # Check if a cached version already exists if not os.path.exists(success_stamp): do_npm_install(npm_cache, - npm_args or [], + npm_args, success_stamp, stdout=stdout, stderr=stderr, diff --git a/tools/update-prod-static b/tools/update-prod-static index 8f5e75a8f7..5df7c451e7 100755 --- a/tools/update-prod-static +++ b/tools/update-prod-static @@ -35,7 +35,7 @@ subprocess.check_call(["mkdir", "-p", "var/log"]) fp = open('var/log/update-prod-static.log', 'w') # Install node packages -setup_node_modules(npm_args=['--production'], stdout=fp, stderr=fp) +setup_node_modules(production=True, stdout=fp, stderr=fp) # Build emoji subprocess.check_call(['./tools/setup/emoji/build_emoji'],