Skip to content

Commit

Permalink
chore: deduped code, and updated description
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Mar 20, 2024
1 parent d59c75e commit a9e4c53
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1 align="center">The Emojipedia Technical Information Library</h1>

<p align="center">An unofficial static export of emoji technical information from Emojipedia. 📙</p>
<p align="center">Unofficial static export of emoji technical information from Emojipedia. 📙</p>

<p align="center">
<!-- prettier-ignore-start -->
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "emojipedia",
"version": "0.3.0",
"description": "An unofficial static export of technical information from Emojipedia. 📙",
"description": "Unofficial static export of technical information from Emojipedia. 📙",
"repository": "JoshuaKGoldberg/emojipedia",
"license": "MIT",
"author": {
Expand Down
35 changes: 11 additions & 24 deletions src/rebuildDirectory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,20 @@ export async function rebuildDirectory({ directory }: RebuildSettings) {
throw new Error(`Could not find slug on Emojipedia: ${retrieved.slug}`);
}

const fileContents = JSON.stringify(
Object.fromEntries(
Object.entries(retrieved.info).sort(([a], [b]) => a.localeCompare(b)),
),
null,
4,
);
const filePathStart = path.join(directory, retrieved.slug);

await Promise.all([
fs.appendFile(`${index}.d.mts`, formatExportLine(retrieved.info)),
fs.appendFile(`${index}.mjs`, formatExportLine(retrieved.info)),
fs.writeFile(
path.join(directory, `${retrieved.slug}.json`),
JSON.stringify(
Object.fromEntries(
Object.entries(retrieved.info).sort(([a], [b]) =>
a.localeCompare(b),
),
),
null,
4,
),
),
fs.writeFile(
path.join(directory, `${retrieved.slug}.d.ts`),
JSON.stringify(
Object.fromEntries(
Object.entries(retrieved.info).sort(([a], [b]) =>
a.localeCompare(b),
),
),
null,
4,
),
),
fs.writeFile(`${filePathStart}.json`, fileContents),
fs.writeFile(`${filePathStart}.d.ts`, fileContents),
]);

foundInfo.push(retrieved.info);
Expand Down

0 comments on commit a9e4c53

Please sign in to comment.