mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
node_cache: Move npm_args inside the interface.
This commit is contained in:
@@ -27,8 +27,12 @@ def generate_sha1sum_node_modules(npm_args=None):
|
|||||||
|
|
||||||
return sha1sum.hexdigest()
|
return sha1sum.hexdigest()
|
||||||
|
|
||||||
def setup_node_modules(npm_args=None, stdout=None, stderr=None, copy_modules=False):
|
def setup_node_modules(production=False, stdout=None, stderr=None, copy_modules=False):
|
||||||
# type: (Optional[List[str]], Optional[IO], Optional[IO], bool) -> None
|
# type: (bool, Optional[IO], Optional[IO], bool) -> None
|
||||||
|
if production:
|
||||||
|
npm_args = ["--production"]
|
||||||
|
else:
|
||||||
|
npm_args = []
|
||||||
sha1sum = generate_sha1sum_node_modules(npm_args)
|
sha1sum = generate_sha1sum_node_modules(npm_args)
|
||||||
npm_cache = os.path.join(NODE_MODULES_CACHE_PATH, sha1sum)
|
npm_cache = os.path.join(NODE_MODULES_CACHE_PATH, sha1sum)
|
||||||
cached_node_modules = os.path.join(npm_cache, 'node_modules')
|
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
|
# Check if a cached version already exists
|
||||||
if not os.path.exists(success_stamp):
|
if not os.path.exists(success_stamp):
|
||||||
do_npm_install(npm_cache,
|
do_npm_install(npm_cache,
|
||||||
npm_args or [],
|
npm_args,
|
||||||
success_stamp,
|
success_stamp,
|
||||||
stdout=stdout,
|
stdout=stdout,
|
||||||
stderr=stderr,
|
stderr=stderr,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ subprocess.check_call(["mkdir", "-p", "var/log"])
|
|||||||
fp = open('var/log/update-prod-static.log', 'w')
|
fp = open('var/log/update-prod-static.log', 'w')
|
||||||
|
|
||||||
# Install node packages
|
# Install node packages
|
||||||
setup_node_modules(npm_args=['--production'], stdout=fp, stderr=fp)
|
setup_node_modules(production=True, stdout=fp, stderr=fp)
|
||||||
|
|
||||||
# Build emoji
|
# Build emoji
|
||||||
subprocess.check_call(['./tools/setup/emoji/build_emoji'],
|
subprocess.check_call(['./tools/setup/emoji/build_emoji'],
|
||||||
|
|||||||
Reference in New Issue
Block a user