Files
zulip/scripts/lib/node_cache.py
Anders Kaseorg 99ab700c1b Revert "node_cache: Work around pnpm install issue in Docker for Mac."
This reverts commit 126f3b5f47.

Testing showed that it was ineffective for many users.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-30 16:15:31 -07:00

27 lines
599 B
Python

import os
from scripts.lib.zulip_tools import run
DEFAULT_PRODUCTION = False
def setup_node_modules(production: bool = DEFAULT_PRODUCTION) -> None:
if os.path.islink("node_modules"):
os.unlink("node_modules")
try:
with open("node_modules/.pnpm/lock.yaml") as a, open("pnpm-lock.yaml") as b:
if a.read() == b.read():
return
except FileNotFoundError:
pass
run(
[
"/usr/local/bin/pnpm",
"install",
"--frozen-lockfile",
*(["--prod"] if production else []),
]
)