mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #33663 from overleaf/td-en-json-sort-hook
Sort staged locale files in the pre-commit hook GitOrigin-RevId: fb3a155be52495305372c5c5cc54c2f50e88c417
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import fs from 'fs'
|
||||
|
||||
const file = process.argv[2]
|
||||
if (!file) {
|
||||
console.error('Usage: node sort-locale-file.js <path>')
|
||||
process.exit(1)
|
||||
}
|
||||
const obj = JSON.parse(fs.readFileSync(file, 'utf8'))
|
||||
fs.writeFileSync(file, JSON.stringify(obj, Object.keys(obj).sort(), 2) + '\n')
|
||||
Reference in New Issue
Block a user