Files
mermaid/scripts/fixCSpell.ts
Sidharth Vinod ef28eb8be1 Merge branch 'next' into sidv/runCodeCov
* next:
  remove duplicate `@types/d3-scale` dev dependency
  chore: Move liveReload code into script.
  Fix minify undefined
  chore: Fix minify
  Fix import
  chore: Fix outfile names
  chore: Add analyzer comment
  chore: Split chunks into folders
  chore: Split chunks into folders
  chore: Add defaultOptions to server
  chore: Split chunks into folders
  chore: IIFE to cSpell
  chore: Minor comments
  chore: Replace Date.now with console.time
  chore: Build at start
  chore: Add build times to live reload
  chore: Add live-reload
  chore: Remove @vitest/coverage-c8
  chore: Add esbuild (Breaking change) mermaid.min.js and mermaid.js will now be IIFE instead of UMD.
2023-08-22 22:49:46 +05:30

29 lines
757 B
TypeScript

/**
* Sorts all the `words` in the cSpell.json file.
*
* Run from the same folder as the `cSpell.json` file
* (i.e. the root of the Mermaid project).
*/
import { readFile, writeFile } from 'node:fs/promises';
import prettier from 'prettier';
const main = async () => {
const filepath = './cSpell.json';
const cSpell: { words: string[] } = JSON.parse(await readFile(filepath, 'utf8'));
cSpell.words = [...new Set(cSpell.words.map((word) => word.toLowerCase()))];
cSpell.words.sort((a, b) => a.localeCompare(b));
const prettierConfig = (await prettier.resolveConfig(filepath)) ?? {};
await writeFile(
filepath,
await prettier.format(JSON.stringify(cSpell), {
...prettierConfig,
filepath,
}),
);
};
void main();