mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	feat(forge): remove unused locales on macOS
This commit is contained in:
		
							parent
							
								
									7427507aca
								
							
						
					
					
						commit
						3435f20baa
					
				| @ -157,16 +157,20 @@ module.exports = { | ||||
|             const extension = (isMac ? ".lproj" : ".pak"); | ||||
| 
 | ||||
|             for (const outputPath of packageResult.outputPaths) { | ||||
|                 const localesDir = isMac | ||||
|                     ? path.join(outputPath, "TriliumNext Notes.app/Contents/Resources") | ||||
|                     : path.join(outputPath, 'locales'); | ||||
|                 const localeDirs = isMac | ||||
|                     ? [ | ||||
|                         path.join(outputPath, "TriliumNext Notes.app/Contents/Resources"), | ||||
|                         path.join(outputPath, "TriliumNext Notes.app/Contents/Frameworks/Electron Framework.framework/Resources") | ||||
|                     ] | ||||
|                     : [ path.join(outputPath, 'locales') ]; | ||||
| 
 | ||||
|                 if (!fs.existsSync(localesDir)) { | ||||
|                     console.log(`No locales directory found in '${localesDir}'.`); | ||||
|                 for (const localeDir of localeDirs) { | ||||
|                     if (!fs.existsSync(localeDir)) { | ||||
|                         console.log(`No locales directory found in '${localeDir}'.`); | ||||
|                         process.exit(2); | ||||
|                     } | ||||
|      | ||||
|                 const files = fs.readdirSync(localesDir); | ||||
|                     const files = fs.readdirSync(localeDir); | ||||
|      | ||||
|                     for (const file of files) { | ||||
|                         if (!file.endsWith(extension)) { | ||||
| @ -185,7 +189,7 @@ module.exports = { | ||||
|                             continue; | ||||
|                         } | ||||
|      | ||||
|                     const filePath = path.join(localesDir, file); | ||||
|                         const filePath = path.join(localeDir, file); | ||||
|                         if (isMac) { | ||||
|                             fs.rm(filePath, { recursive: true }); | ||||
|                         } else { | ||||
| @ -195,6 +199,7 @@ module.exports = { | ||||
|                         removedLocales.push(file); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             console.log(`Removed unused locale files: ${removedLocales.join(", ")}`);                     | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran