You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					13 lines
				
				368 B
			
		
		
			
		
	
	
					13 lines
				
				368 B
			| 
											3 years ago
										 | import metadata from '../metadata.min.json' assert { type: 'json' } | ||
|  | import fs from 'fs' | ||
|  | 
 | ||
|  | const countryCodes = Object.keys(metadata.countries) | ||
|  | 
 | ||
|  | fs.writeFileSync( | ||
|  | 	'./types.d.ts', | ||
|  | 	fs.readFileSync('./types.d.ts', 'utf-8').replace( | ||
|  | 		/export type CountryCode = .*;/, | ||
|  | 		`export type CountryCode = ${countryCodes.map(_ => `'${_}'`).join(' | ')};` | ||
|  | 	), | ||
|  | 	'utf-8' | ||
|  | ) |