mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 12:03:46 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			631 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			631 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",
 | |
|             "--prefer-offline",
 | |
|             *(["--prod"] if production else []),
 | |
|         ]
 | |
|     )
 |