From 515ac16d591329bec276ac7b16f588c5788f4d93 Mon Sep 17 00:00:00 2001 From: Wilco Fiers Date: Thu, 9 Mar 2017 15:38:00 +0100 Subject: [PATCH] Full implementation of --all-langs --- .gitignore | 4 ++-- Gruntfile.js | 12 ++++++++---- build/configure.js | 7 ++----- build/tasks/configure.js | 4 ++++ 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index b24bda9620..0c3d4d4fce 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,8 @@ node_modules test/*/index.html test/integration/*/index.html axe.js -axe.min.js -axe.es2016.js +axe.*.js *.tgz npm-shrinkwrap.json typings/axe-core/axe-core-tests.js +doc/rule-descriptions.*.md \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 9a569aabc9..bc2cfc2755 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -18,12 +18,16 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-parallel'); var langs; - if (grunt.option('all-lang')) { - langs = ['.nl', '.en', '.de']; - - } else if (grunt.option('lang')) { + if (grunt.option('lang')) { langs = ['.' + grunt.option('lang')]; + } else if (grunt.option('all-lang')) { + var localeFiles = require('fs').readdirSync('./locales'); + langs = localeFiles.map(function (file) { + return '.' + file.replace('.json', ''); + }); + langs.unshift(''); // Add default + } else { langs = ['']; } diff --git a/build/configure.js b/build/configure.js index 07ac3e7ea7..62d24061eb 100644 --- a/build/configure.js +++ b/build/configure.js @@ -13,10 +13,8 @@ dot.templateSettings.strip = false; function getLocale(grunt, options) { var locale, localeFile; - if (grunt.option('lang')) { - localeFile = './locales/' + grunt.option('lang') + '.json'; - } else { - localeFile = options.locale; + if (options.locale) { + localeFile = './locales/' + options.locale + '.json'; } if (localeFile) { @@ -26,7 +24,6 @@ function getLocale(grunt, options) { function buildRules(grunt, options, commons, callback) { var locale = getLocale(grunt, options); - options.getFiles = false; buildManual(grunt, options, commons, function (result) { diff --git a/build/tasks/configure.js b/build/tasks/configure.js index a91edc4268..a15fe8064f 100644 --- a/build/tasks/configure.js +++ b/build/tasks/configure.js @@ -17,6 +17,10 @@ module.exports = function (grunt) { this.files.forEach(function (file) { var commons = file.src[0]; + var match = file.dest.auto.match(/\.([a-z]{2,3})\.js/); + if (match) { + options.locale = match[1]; + } buildRules(grunt, options, commons, function (result) { grunt.file.write(file.dest.auto, 'axe._load(' + result.auto + ');');