Skip to content

Commit

Permalink
Update translation hashing (home-assistant#5025)
Browse files Browse the repository at this point in the history
* Update translation hashing

* Move gulp-rename
  • Loading branch information
balloob authored Mar 2, 2020
1 parent 319a3b4 commit d74fe6e
Show file tree
Hide file tree
Showing 10 changed files with 272 additions and 394 deletions.
2 changes: 1 addition & 1 deletion build-scripts/gulp/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ gulp.task(
gulp.parallel("gen-icons-app", "gen-icons-mdi"),
"gen-pages-dev",
"gen-index-app-dev",
gulp.series("create-test-translation", "build-translations")
"build-translations"
),
"copy-static",
"webpack-watch-app"
Expand Down
15 changes: 1 addition & 14 deletions build-scripts/gulp/gen-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const gulp = require("gulp");
const path = require("path");
const fs = require("fs");
const paths = require("../paths");
const { mapFiles } = require("../util");

const ICON_PACKAGE_PATH = path.resolve(
__dirname,
Expand Down Expand Up @@ -57,20 +58,6 @@ function generateIconset(iconsetName, iconNames) {
return `<ha-iconset-svg name="${iconsetName}" size="24"><svg><defs>${iconDefs}</defs></svg></ha-iconset-svg>`;
}

// Helper function to map recursively over files in a folder and it's subfolders
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);
}
}
}

// Find all icons used by the project.
function findIcons(searchPath, iconsetName) {
const iconRegex = new RegExp(`${iconsetName}:[\\w-]+`, "g");
Expand Down
Loading

0 comments on commit d74fe6e

Please sign in to comment.