1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 10:48:44 +00:00

Update translation hashing (#5025)

* Update translation hashing

* Move gulp-rename
This commit is contained in:
Paulus Schoutsen
2020-03-02 02:36:00 -08:00
committed by GitHub
parent 319a3b4943
commit d74fe6ed52
10 changed files with 274 additions and 396 deletions

16
build-scripts/util.js Normal file
View File

@@ -0,0 +1,16 @@
const path = require("path");
const fs = require("fs");
// Helper function to map recursively over files in a folder and it's subfolders
module.exports.mapFiles = function mapFiles(startPath, filter, mapFunc) {
const files = fs.readdirSync(startPath);
for (let i = 0; i < files.length; i++) {
const filename = path.join(startPath, files[i]);
const stat = fs.lstatSync(filename);
if (stat.isDirectory()) {
mapFiles(filename, filter, mapFunc);
} else if (filename.indexOf(filter) >= 0) {
mapFunc(filename);
}
}
};