Skip to content

Commit

Permalink
Export saltSharpCountries.css and remove countryCode_Sharp entries fr…
Browse files Browse the repository at this point in the history
…om the meta map (#3410)
  • Loading branch information
joshwooding authored and libertymayc committed May 16, 2024
1 parent a9824a7 commit adef0ff
Show file tree
Hide file tree
Showing 8 changed files with 278 additions and 1,304 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-forks-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@salt-ds/countries": patch
---

Remove `<countryCode>_Sharp` entries in countryMetaMap. This was added incorrectly and makes using the map to convert between country codes and country names more difficult.
3 changes: 2 additions & 1 deletion packages/countries/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
},
"sideEffects": false,
"files": [
"saltCountries.css"
"saltCountries.css",
"saltSharpCountries.css"
],
"scripts": {
"build": "yarn clean && node ./scripts/generateCountrySymbol.mjs '*.svg'",
Expand Down
512 changes: 256 additions & 256 deletions packages/countries/saltSharpCountries.css

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions packages/countries/scripts/generateCountrySymbol.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ const generateSharpCssAsBg = ({ basePath, cssOutputPath, fileArg }) => {

const countryCss = fileNames
.map((fileName) => {
const svgString = fs.readFileSync(fileName, "utf-8").trim();
const svgString = fs
.readFileSync(fileName, "utf-8")
.trim()
.replaceAll(/\r?\n|\r/g, "");

const countryCode = path.parse(fileName).name.toUpperCase();

Expand Down Expand Up @@ -419,12 +422,7 @@ const generateCountryMetaMap = ({ countryMetaMap, basePath }) => {
countryName: "${countryMeta.countryName}",
},`;

const sharpEntryText = `"${code}_Sharp": {
countryCode: "${countryMeta.countryCode}",
countryName: "${countryMeta.countryName}",
},`;

metaText = [...metaText, entryText, sharpEntryText];
metaText = [...metaText, entryText];
}

const endText = `
Expand Down
Loading

0 comments on commit adef0ff

Please sign in to comment.