mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
22 lines
498 B
JavaScript
22 lines
498 B
JavaScript
'use strict';
|
|
|
|
const { readFile, writeFile } = require('fs').promises;
|
|
|
|
(async () => {
|
|
const contents = await readFile('./config', { encoding: 'utf-8' });
|
|
const blocks = contents
|
|
.split('\n\n')
|
|
.map((block) => {
|
|
block = block.split('\n').sort((a, b) => {
|
|
if (!a.startsWith('trans') || !b.startsWith('trans')) {
|
|
return 0;
|
|
}
|
|
|
|
return a.localeCompare(b);
|
|
})
|
|
|
|
return block.join('\n');
|
|
});
|
|
|
|
await writeFile('./config', blocks.join('\n\n'), { encoding: 'utf-8' });
|
|
})(); |