Skip to content

Commit

Permalink
chore: Move a11y, lang, browserify, and webpack out of grunt
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey committed Nov 14, 2018
1 parent 287b267 commit 4d9c5eb
Show file tree
Hide file tree
Showing 4 changed files with 1,870 additions and 1,898 deletions.
63 changes: 14 additions & 49 deletions build/grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,6 @@ module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg,
watch: {
lang: {
files: ['lang/**/*.json'],
tasks: ['vjslanguages']
}
},
vjslanguages: {
defaults: {
files: {
'build/temp/lang': ['lang/*.json']
}
}
},
concurrent: {
options: {
logConcurrentOutput: true
Expand All @@ -41,7 +28,6 @@ module.exports = function(grunt) {
dev: [
'shell:sass',
'shell:babel',
'watch:lang',
'shell:copy-dist',
'shell:karma-server'
],
Expand All @@ -68,14 +54,8 @@ module.exports = function(grunt) {
preferLocal: true
}
},
'copy-lang': {
command: 'npm run copy-lang',
options: {
preferLocal: true
}
},
'copy-a11y': {
command: 'npm run copy-a11y',
'lang': {
command: 'npm run build:lang',
options: {
preferLocal: true
}
Expand Down Expand Up @@ -146,48 +126,35 @@ module.exports = function(grunt) {
preferLocal: true
}
},
a11y: {
command: 'npm run test:a11y',
options: {
preferLocal: true
}
},
noderequire: {
command: 'node test/require/node.js',
command: 'npm run test:node-require',
options: {
failOnError: true
preferLocal: true
}
},
browserify: {
command: 'browserify test/require/browserify.js -o build/temp/browserify.js',
command: 'npm run build:browserify-test',
options: {
preferLocal: true
}
},
webpack: {
command: 'webpack --hide-modules test/require/webpack.js build/temp/webpack.js',
command: 'npm run build:webpack-test',
options: {
preferLocal: true
}
}
},
accessibility: {
options: {
accessibilityLevel: 'WCAG2AA',
reportLevels: {
notice: false,
warning: true,
error: true
},
ignore: [
// Ignore warning about contrast of the "vjs-no-js" fallback link
'WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.BgImage'
]

},
test: {
src: ['sandbox/descriptions.test-a11y.html']
}
}
});

// load all the npm grunt tasks
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-accessibility');

grunt.registerTask('build', [
'shell:lint',
Expand All @@ -199,8 +166,7 @@ module.exports = function(grunt) {
'shell:cssmin',

'shell:copy-fonts',
'shell:copy-lang',
'vjslanguages'
'shell:lang'
]);

grunt.registerTask('dist', [
Expand All @@ -222,7 +188,7 @@ module.exports = function(grunt) {
'shell:browserify',
'shell:webpack',
'shell:karma-run',
'test-a11y'
'shell:a11y'
];

if (process.env.TRAVIS) {
Expand All @@ -238,7 +204,6 @@ module.exports = function(grunt) {
// Run while developing
grunt.registerTask('dev', ['sandbox', 'concurrent:dev']);
grunt.registerTask('watchAll', ['build', 'concurrent:watchAll']);
grunt.registerTask('test-a11y', ['shell:copy-a11y', 'accessibility']);

// Pick your testing, or run both in different terminals
grunt.registerTask('test-ui', ['shell:karma-server']);
Expand Down
26 changes: 26 additions & 0 deletions build/test-a11y.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const AccessSniff = require('access-sniff');
const path = require('path');

const testFiles = [
path.join(__dirname, '..', 'sandbox', 'descriptions.test-a11y.html')
];

const options = {
accessibilityLevel: 'WCAG2AA',
reportLevels: {
notice: false,
warning: true,
error: true
},
ignore: [
// Ignore warning about contrast of the "vjs-no-js" fallback link
'WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.BgImage'
]
};

AccessSniff.default(testFiles, options).then(function(report) {
AccessSniff.report(report);
}).catch(function(error) {
// there were errors, which are already reported, exit with an error
process.exit(1);
});
Loading

0 comments on commit 4d9c5eb

Please sign in to comment.