mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-30 20:41:33 +08:00 
			
		
		
		
	chore(forge): fail build if locale is missing
This commit is contained in:
		
							parent
							
								
									1848d5dc96
								
							
						
					
					
						commit
						77497dbc28
					
				| @ -147,6 +147,7 @@ module.exports = { | |||||||
|             const localesToKeep = LOCALES |             const localesToKeep = LOCALES | ||||||
|                 .filter(locale => !locale.contentOnly) |                 .filter(locale => !locale.contentOnly) | ||||||
|                 .map(locale => locale.electronLocale.replace("_", "-")); |                 .map(locale => locale.electronLocale.replace("_", "-")); | ||||||
|  |             const keptLocales = new Set(); | ||||||
| 
 | 
 | ||||||
|             for (const outputPath of packageResult.outputPaths) { |             for (const outputPath of packageResult.outputPaths) { | ||||||
|                 const localesDir = path.join(outputPath, 'locales'); |                 const localesDir = path.join(outputPath, 'locales'); | ||||||
| @ -161,6 +162,7 @@ module.exports = { | |||||||
|                 for (const file of files) { |                 for (const file of files) { | ||||||
|                     const localeName = path.basename(file, ".pak"); |                     const localeName = path.basename(file, ".pak"); | ||||||
|                     if (localesToKeep.includes(localeName)) { |                     if (localesToKeep.includes(localeName)) { | ||||||
|  |                         keptLocales.add(localeName); | ||||||
|                         continue; |                         continue; | ||||||
|                     } |                     } | ||||||
| 
 | 
 | ||||||
| @ -169,6 +171,14 @@ module.exports = { | |||||||
|                     fs.unlinkSync(filePath); |                     fs.unlinkSync(filePath); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  | 
 | ||||||
|  |             // Ensure all locales that should be kept are actually present.
 | ||||||
|  |             for (const locale of localesToKeep) { | ||||||
|  |                 if (!keptLocales.has(locale)) { | ||||||
|  |                     console.error(`Locale ${locale} was not found in the packaged app.`); | ||||||
|  |                     process.exit(1); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|         }, |         }, | ||||||
|         // Gather all the artifacts produced by the makers and copy them to a common upload directory.
 |         // Gather all the artifacts produced by the makers and copy them to a common upload directory.
 | ||||||
|         postMake(_, makeResults) { |         postMake(_, makeResults) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran