mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
node_cache: Remove unused copy_modules parameter.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
61be9fb4bd
commit
d761bbc2ed
@@ -46,9 +46,9 @@ def generate_sha1sum_node_modules(setup_dir=None, production=DEFAULT_PRODUCTION)
|
||||
sha1sum.update(''.join(sorted(yarn_args)).encode('utf8'))
|
||||
return sha1sum.hexdigest()
|
||||
|
||||
def setup_node_modules(production=DEFAULT_PRODUCTION, stdout=None, stderr=None, copy_modules=False,
|
||||
def setup_node_modules(production=DEFAULT_PRODUCTION, stdout=None, stderr=None,
|
||||
prefer_offline=False):
|
||||
# type: (bool, Optional[IO[Any]], Optional[IO[Any]], bool, bool) -> None
|
||||
# type: (bool, Optional[IO[Any]], Optional[IO[Any]], bool) -> None
|
||||
yarn_args = get_yarn_args(production=production)
|
||||
if prefer_offline:
|
||||
yarn_args.append("--prefer-offline")
|
||||
@@ -62,8 +62,7 @@ def setup_node_modules(production=DEFAULT_PRODUCTION, stdout=None, stderr=None,
|
||||
yarn_args,
|
||||
success_stamp,
|
||||
stdout=stdout,
|
||||
stderr=stderr,
|
||||
copy_modules=copy_modules)
|
||||
stderr=stderr)
|
||||
|
||||
print("Using cached node modules from %s" % (cached_node_modules,))
|
||||
cmds = [
|
||||
@@ -73,28 +72,23 @@ def setup_node_modules(production=DEFAULT_PRODUCTION, stdout=None, stderr=None,
|
||||
for cmd in cmds:
|
||||
run(cmd, stdout=stdout, stderr=stderr)
|
||||
|
||||
def do_yarn_install(target_path, yarn_args, success_stamp, stdout=None, stderr=None,
|
||||
copy_modules=False):
|
||||
# type: (str, List[str], str, Optional[IO[Any]], Optional[IO[Any]], bool) -> None
|
||||
def do_yarn_install(target_path, yarn_args, success_stamp, stdout=None, stderr=None):
|
||||
# type: (str, List[str], str, Optional[IO[Any]], Optional[IO[Any]]) -> None
|
||||
cmds = [
|
||||
['mkdir', '-p', target_path],
|
||||
['cp', 'package.json', "yarn.lock", 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", cached_node_modules])
|
||||
else:
|
||||
print("Cached version not found! Installing node modules.")
|
||||
print("Cached version not found! Installing node modules.")
|
||||
|
||||
# Copy the existing node_modules to speed up install
|
||||
if os.path.exists("node_modules"):
|
||||
cmds.append(["cp", "-R", "node_modules/", cached_node_modules])
|
||||
cd_exec = os.path.join(ZULIP_PATH, "scripts/lib/cd_exec")
|
||||
if os.environ.get('CUSTOM_CA_CERTIFICATES'):
|
||||
cmds.append([YARN_BIN, "config", "set", "cafile", os.environ['CUSTOM_CA_CERTIFICATES']])
|
||||
cmds.append([cd_exec, target_path, YARN_BIN, "install", "--non-interactive", "--frozen-lockfile"] +
|
||||
yarn_args)
|
||||
# Copy the existing node_modules to speed up install
|
||||
if os.path.exists("node_modules"):
|
||||
cmds.append(["cp", "-R", "node_modules/", cached_node_modules])
|
||||
cd_exec = os.path.join(ZULIP_PATH, "scripts/lib/cd_exec")
|
||||
if os.environ.get('CUSTOM_CA_CERTIFICATES'):
|
||||
cmds.append([YARN_BIN, "config", "set", "cafile", os.environ['CUSTOM_CA_CERTIFICATES']])
|
||||
cmds.append([cd_exec, target_path, YARN_BIN, "install", "--non-interactive", "--frozen-lockfile"] +
|
||||
yarn_args)
|
||||
cmds.append(['touch', success_stamp])
|
||||
|
||||
for cmd in cmds:
|
||||
|
Reference in New Issue
Block a user