Sort staged locale files in the pre-commit hook GitOrigin-RevId: fb3a155be52495305372c5c5cc54c2f50e88c417
@@ -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')