Add newline at the end of locales files
This commit is contained in:
parent
010f2f0135
commit
116d799497
|
@ -2,21 +2,24 @@
|
||||||
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const locales = "../locales";
|
const locales = "../locales";
|
||||||
|
|
||||||
fs.readdir(locales, function(err, files) {
|
fs.readdir(locales, function(err, files) {
|
||||||
files.forEach(function(file, index) {
|
if (err) return console.error(err);
|
||||||
|
|
||||||
|
files.forEach(function(file) {
|
||||||
const unordered = JSON.parse(fs.readFileSync(path.join(locales, file)));
|
const unordered = JSON.parse(fs.readFileSync(path.join(locales, file)));
|
||||||
const ordered = {};
|
const ordered = {};
|
||||||
|
|
||||||
Object.keys(unordered)
|
Object.keys(unordered)
|
||||||
.sort()
|
.sort()
|
||||||
.forEach(function(key) {
|
.forEach(function(key) {
|
||||||
ordered[key] = unordered[key];
|
ordered[key] = unordered[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
path.join(locales, file),
|
path.join(locales, file),
|
||||||
JSON.stringify(ordered, null, 2)
|
JSON.stringify(ordered, null, 2).concat('\n')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue