Skip to content

Commit db6e376

Browse files
brandonocaseygkatsev
authored andcommitted
chore: Move a11y, lang, browserify, and webpack out of grunt (#5589)
1 parent be9e9a9 commit db6e376

File tree

4 files changed

+1979
-2632
lines changed

4 files changed

+1979
-2632
lines changed

build/grunt.js

Lines changed: 14 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,6 @@ module.exports = function(grunt) {
1818
// Project configuration.
1919
grunt.initConfig({
2020
pkg,
21-
watch: {
22-
lang: {
23-
files: ['lang/**/*.json'],
24-
tasks: ['vjslanguages']
25-
}
26-
},
27-
vjslanguages: {
28-
defaults: {
29-
files: {
30-
'build/temp/lang': ['lang/*.json']
31-
}
32-
}
33-
},
3421
concurrent: {
3522
options: {
3623
logConcurrentOutput: true
@@ -41,7 +28,6 @@ module.exports = function(grunt) {
4128
dev: [
4229
'shell:sass',
4330
'shell:babel',
44-
'watch:lang',
4531
'shell:copy-dist',
4632
'shell:karma-server'
4733
],
@@ -68,14 +54,8 @@ module.exports = function(grunt) {
6854
preferLocal: true
6955
}
7056
},
71-
'copy-lang': {
72-
command: 'npm run copy-lang',
73-
options: {
74-
preferLocal: true
75-
}
76-
},
77-
'copy-a11y': {
78-
command: 'npm run copy-a11y',
57+
'lang': {
58+
command: 'npm run build:lang',
7959
options: {
8060
preferLocal: true
8161
}
@@ -146,48 +126,35 @@ module.exports = function(grunt) {
146126
preferLocal: true
147127
}
148128
},
129+
a11y: {
130+
command: 'npm run test:a11y',
131+
options: {
132+
preferLocal: true
133+
}
134+
},
149135
noderequire: {
150-
command: 'node test/require/node.js',
136+
command: 'npm run test:node-require',
151137
options: {
152-
failOnError: true
138+
preferLocal: true
153139
}
154140
},
155141
browserify: {
156-
command: 'browserify test/require/browserify.js -o build/temp/browserify.js',
142+
command: 'npm run build:browserify-test',
157143
options: {
158144
preferLocal: true
159145
}
160146
},
161147
webpack: {
162-
command: 'webpack --hide-modules test/require/webpack.js build/temp/webpack.js',
148+
command: 'npm run build:webpack-test',
163149
options: {
164150
preferLocal: true
165151
}
166152
}
167153
},
168-
accessibility: {
169-
options: {
170-
accessibilityLevel: 'WCAG2AA',
171-
reportLevels: {
172-
notice: false,
173-
warning: true,
174-
error: true
175-
},
176-
ignore: [
177-
// Ignore warning about contrast of the "vjs-no-js" fallback link
178-
'WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.BgImage'
179-
]
180-
181-
},
182-
test: {
183-
src: ['sandbox/descriptions.test-a11y.html']
184-
}
185-
}
186154
});
187155

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

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

201168
'shell:copy-fonts',
202-
'shell:copy-lang',
203-
'vjslanguages'
169+
'shell:lang'
204170
]);
205171

206172
grunt.registerTask('dist', [
@@ -222,7 +188,7 @@ module.exports = function(grunt) {
222188
'shell:browserify',
223189
'shell:webpack',
224190
'shell:karma-run',
225-
'test-a11y'
191+
'shell:a11y'
226192
];
227193

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

243208
// Pick your testing, or run both in different terminals
244209
grunt.registerTask('test-ui', ['shell:karma-server']);

build/test-a11y.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const AccessSniff = require('access-sniff');
2+
const path = require('path');
3+
4+
const testFiles = [
5+
path.join(__dirname, '..', 'sandbox', 'descriptions.test-a11y.html')
6+
];
7+
8+
const options = {
9+
accessibilityLevel: 'WCAG2AA',
10+
reportLevels: {
11+
notice: false,
12+
warning: true,
13+
error: true
14+
},
15+
ignore: [
16+
// Ignore warning about contrast of the "vjs-no-js" fallback link
17+
'WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.BgImage'
18+
]
19+
};
20+
21+
AccessSniff.default(testFiles, options).then(function(report) {
22+
AccessSniff.report(report);
23+
}).catch(function(error) {
24+
// there were errors, which are already reported, exit with an error
25+
process.exit(1);
26+
});

0 commit comments

Comments
 (0)