Files
electron/script/gen-hunspell-filenames.js
Sam Attard b84ffddc3a chore: apply oxfmt formatting to JS and TS sources
Runs `yarn format` across lib/, spec/, script/, build/, default_app/,
and npm/ to bring the codebase in line with the .oxfmtrc.json settings
added in the previous commit. This is a pure formatting pass: import
statements are sorted into the groups defined by the config, method
chains longer than printWidth are broken, single-quoted strings
containing apostrophes are switched to double quotes, and a handful of
single-statement `if` bodies are re-wrapped and get braces added by
`oxlint --fix` to satisfy the `curly: multi-line` rule.

No behavior changes.
2026-04-06 16:17:00 +00:00

36 lines
1.1 KiB
JavaScript

const fs = require('node:fs');
const path = require('node:path');
const check = process.argv.includes('--check');
const dictsPath = path.resolve(__dirname, '..', '..', 'third_party', 'hunspell_dictionaries');
const gclientPath = 'third_party/hunspell_dictionaries';
const allFiles = fs.readdirSync(dictsPath);
const dictionaries = allFiles.filter((file) => path.extname(file) === '.bdic');
const licenses = allFiles.filter((file) => file.startsWith('LICENSE') || file.startsWith('COPYING'));
const content = `hunspell_dictionaries = [
${dictionaries.map((f) => `"//${path.posix.join(gclientPath, f)}"`).join(',\n ')},
]
hunspell_licenses = [
${licenses.map((f) => `"//${path.posix.join(gclientPath, f)}"`).join(',\n ')},
]
`;
const filenamesPath = path.resolve(__dirname, '..', 'filenames.hunspell.gni');
if (check) {
const currentContent = fs.readFileSync(filenamesPath, 'utf8');
if (currentContent !== content) {
throw new Error(
'hunspell filenames need to be regenerated, latest generation does not match current file. Please run node gen-hunspell-filenames.js'
);
}
} else {
fs.writeFileSync(filenamesPath, content);
}