Skip to content

Commit d3db593

Browse files
authored
fix(build): limit locales to valid files when using the --all-lang option (#4486)
This change updates the code path that is invoked when the build is run using the `--all-lang` option. When assembling the list of locale files from the `/locales` directory, this change only includes files that satisfy _both_ of the following criteria: - Does not start with `_` - Ends with `.json` This effectively excludes `_template.json` and `README.md`, and may proactively filter out future utility files that do not follow the typical locale-file naming standard. Closes: #4485
1 parent 6699ee4 commit d3db593

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Gruntfile.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ module.exports = function (grunt) {
2222
});
2323
} else if (grunt.option('all-lang')) {
2424
var localeFiles = require('fs').readdirSync('./locales');
25-
langs = localeFiles.map(function (file) {
26-
return '.' + file.replace('.json', '');
27-
});
25+
langs = localeFiles
26+
.filter(function (file) {
27+
return !file.startsWith('_') && file.endsWith('.json');
28+
})
29+
.map(function (file) {
30+
return '.' + file.replace('.json', '');
31+
});
2832
langs.unshift(''); // Add default
2933
} else {
3034
langs = [''];

0 commit comments

Comments
 (0)