-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create a script to sort
.local.dic
Resolves #226 .
- Loading branch information
1 parent
2fe8c40
commit 1d08654
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,8 +321,8 @@ npm | |
NVDA | ||
ok | ||
onboarding | ||
one-to-one | ||
one-to-many | ||
one-to-one | ||
Orca | ||
outputPaths | ||
owner/nombrable | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env node | ||
|
||
import fs from 'fs'; | ||
|
||
/** | ||
* Relative to the root of the project | ||
*/ | ||
const DICTIONARY_FILE = '.local.dic'; | ||
|
||
// Retrieve content of the file | ||
const fileContent = fs.readFileSync(DICTIONARY_FILE, 'utf8'); | ||
const fileContentLines = fileContent.split('\n'); | ||
|
||
// Remove duplicate and empty lines | ||
const uniquesLines = [...new Set(fileContentLines)].filter(Boolean); | ||
|
||
// Sort lines | ||
const sortedLines = [...uniquesLines].sort((a, b) => a.localeCompare(b)); | ||
|
||
// Make sure to have a blank last line | ||
sortedLines.push(''); | ||
|
||
// Rewrite existing file | ||
fs.writeFileSync(DICTIONARY_FILE, sortedLines.join('\n')); |