| 
									
										
										
										
											2023-10-26 19:41:00 +02:00
										 |  |  | // @ts-check
 | 
					
						
							| 
									
										
										
										
											2022-02-08 11:35:00 -07:00
										 |  |  | const { workspace } = require('../workspace'); | 
					
						
							| 
									
										
										
										
											2022-04-18 10:31:58 -08:00
										 |  |  | const fs = require('fs'); | 
					
						
							| 
									
										
										
										
											2021-10-11 10:52:17 -04:00
										 |  |  | const path = require('path'); | 
					
						
							| 
									
										
										
										
											2023-10-26 19:41:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | const rmSync = (dir) => fs.rmSync(dir, { recursive: true, force: true, maxRetries: 10 }); | 
					
						
							| 
									
										
										
										
											2022-04-18 10:31:58 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-08 11:35:00 -07:00
										 |  |  | for (const pkg of workspace.packages()) { | 
					
						
							| 
									
										
										
										
											2023-10-26 19:41:00 +02:00
										 |  |  |   rmSync(path.join(pkg.path, 'node_modules')); | 
					
						
							|  |  |  |   rmSync(path.join(pkg.path, 'lib')); | 
					
						
							|  |  |  |   rmSync(path.join(pkg.path, 'src', 'generated')); | 
					
						
							| 
									
										
										
										
											2022-04-18 10:31:58 -08:00
										 |  |  |   const bundles = path.join(pkg.path, 'bundles'); | 
					
						
							|  |  |  |   if (fs.existsSync(bundles) && fs.statSync(bundles).isDirectory()) { | 
					
						
							|  |  |  |     for (const bundle of fs.readdirSync(bundles)) | 
					
						
							| 
									
										
										
										
											2023-10-26 19:41:00 +02:00
										 |  |  |       rmSync(path.join(bundles, bundle, 'node_modules')); | 
					
						
							| 
									
										
										
										
											2022-04-18 10:31:58 -08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-02-08 11:35:00 -07:00
										 |  |  | } |