feat(dashboard,ui): Streamline spacing and sizing (#6061)
This commit is contained in:
committed by
GitHub
parent
5dacd4ac9f
commit
a2c149e7e5
44
packages/admin-next/dashboard/scripts/generate-countries.js
Normal file
44
packages/admin-next/dashboard/scripts/generate-countries.js
Normal file
@@ -0,0 +1,44 @@
|
||||
async function generateCountries() {
|
||||
const { countries } = await import("@medusajs/medusa/dist/utils/countries.js")
|
||||
const fs = await import("fs")
|
||||
const path = await import("path")
|
||||
|
||||
const arr = countries.map((c) => {
|
||||
const iso_2 = c.alpha2.toLowerCase()
|
||||
const iso_3 = c.alpha3.toLowerCase()
|
||||
const num_code = parseInt(c.numeric, 10)
|
||||
const name = c.name.toUpperCase()
|
||||
const display_name = c.name
|
||||
|
||||
return {
|
||||
iso_2,
|
||||
iso_3,
|
||||
num_code,
|
||||
name,
|
||||
display_name,
|
||||
}
|
||||
})
|
||||
|
||||
const json = JSON.stringify(arr, null, 2)
|
||||
|
||||
const dest = path.join(__dirname, "../src/lib/countries.ts")
|
||||
const destDir = path.dirname(dest)
|
||||
|
||||
const fileContent = `/** This file is auto-generated. Do not modify it manually. */\nimport type { Country } from "@medusajs/medusa"\n\nexport const countries: Omit<Country, "region" | "region_id" | "id">[] = ${json}`
|
||||
|
||||
if (!fs.existsSync(destDir)) {
|
||||
fs.mkdirSync(destDir, { recursive: true })
|
||||
}
|
||||
|
||||
fs.writeFileSync(dest, fileContent)
|
||||
}
|
||||
|
||||
;(async () => {
|
||||
console.log("Generating countries")
|
||||
try {
|
||||
await generateCountries()
|
||||
console.log("Countries generated")
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
})()
|
||||
Reference in New Issue
Block a user