Skip to content

Commit

Permalink
Revert "infra: unique and sort person script"
Browse files Browse the repository at this point in the history
This reverts commit 10f3ff7.
  • Loading branch information
ST-DDT committed Nov 17, 2024
1 parent c376934 commit 4847a6b
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions scripts/generate-locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { constants } from 'node:fs';
import { access, readFile, readdir, stat, writeFile } from 'node:fs/promises';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import type { PersonEntryDefinition } from '../dist';
import type { LocaleDefinition, MetadataDefinition } from '../src/definitions';
import { keys } from '../src/internal/keys';
import { formatMarkdown, formatTypescript } from './apidocs/utils/format';
Expand Down Expand Up @@ -327,25 +326,6 @@ async function updateLocaleFileHook(
console.log(`${filePath} <-> ${locale} @ ${definitionKey} -> ${entryName}`);
}

if (definitionKey === 'person' && entryName != null) {
const { default: data } = (await import(`file:${filePath}`)) as {
default: PersonEntryDefinition<string>;
};
const { female = [], generic = [], male = [] } = data ?? {};

const newData = {
generic: generic.length > 0 ? [...new Set(generic)].sort() : undefined,
female: female.length > 0 ? [...new Set(female)].sort() : undefined,
male: male.length > 0 ? [...new Set(male)].sort() : undefined,
};

const newContent = `export default ${JSON.stringify(newData)};`;

if (female.length > 0 || generic.length > 0 || male.length > 0) {
await writeFile(filePath, await formatTypescript(newContent));
}
}

return normalizeLocaleFile(filePath, definitionKey);
}

Expand Down

0 comments on commit 4847a6b

Please sign in to comment.