You cannot 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
356 B
JavaScript
13 lines
356 B
JavaScript
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'
|
|
) |