2015-12-09 03:30:48 +02:00
|
|
|
import {gruntCustomizer, gruntOptionsMaker} from './options-customizer.js';
|
2016-08-17 23:16:41 +02:00
|
|
|
import chg from 'chg';
|
2016-10-18 20:42:10 +02:00
|
|
|
import npmRun from 'npm-run';
|
2016-08-17 23:16:41 +02:00
|
|
|
|
2015-05-01 21:53:51 +02:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
require('time-grunt')(grunt);
|
|
|
|
|
2015-08-10 21:22:15 +02:00
|
|
|
let _ = require('lodash-compat');
|
2015-05-01 21:53:51 +02:00
|
|
|
let pkg = grunt.file.readJSON('package.json');
|
|
|
|
let license = grunt.file.read('build/license-header.txt');
|
2015-08-10 21:22:15 +02:00
|
|
|
let bannerCommonData = _.pick(pkg, ['version', 'copyright']);
|
2015-05-01 21:53:51 +02:00
|
|
|
let verParts = pkg.version.split('.');
|
|
|
|
let version = {
|
|
|
|
full: pkg.version,
|
|
|
|
major: verParts[0],
|
|
|
|
minor: verParts[1],
|
|
|
|
patch: verParts[2]
|
|
|
|
};
|
|
|
|
|
2015-10-28 23:47:18 +02:00
|
|
|
const browserifyGruntDefaults = {
|
|
|
|
browserifyOptions: {
|
|
|
|
standalone: 'videojs'
|
|
|
|
},
|
|
|
|
plugin: [
|
2016-09-29 17:58:37 +02:00
|
|
|
['bundle-collapser/plugin'],
|
2015-10-28 23:47:18 +02:00
|
|
|
['browserify-derequire']
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
2015-12-09 03:30:48 +02:00
|
|
|
const githubReleaseDefaults = {
|
|
|
|
options: {
|
|
|
|
release: {
|
|
|
|
tag_name: 'v'+ version.full,
|
|
|
|
name: version.full,
|
2016-10-18 20:42:10 +02:00
|
|
|
body: npmRun.execSync('conventional-changelog -p videojs', {
|
|
|
|
silent: true,
|
|
|
|
encoding: 'utf8'
|
|
|
|
})
|
2015-12-09 03:30:48 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
src: [`dist/video-js-${version.full}.zip`] // Files that you want to attach to Release
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-10-28 23:47:18 +02:00
|
|
|
/**
|
|
|
|
* Customizes _.merge behavior in `browserifyGruntOptions` to concatenate
|
|
|
|
* arrays. This can be overridden on a per-call basis to
|
|
|
|
*
|
|
|
|
* @see https://lodash.com/docs#merge
|
|
|
|
* @function browserifyGruntCustomizer
|
|
|
|
* @private
|
|
|
|
* @param {Mixed} objectValue
|
|
|
|
* @param {Mixed} sourceValue
|
|
|
|
* @return {Object}
|
|
|
|
*/
|
2015-12-09 03:30:48 +02:00
|
|
|
const browserifyGruntCustomizer = gruntCustomizer;
|
2015-10-28 23:47:18 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a unique object of Browserify Grunt task options.
|
|
|
|
*
|
|
|
|
* @function browserifyGruntOptions
|
|
|
|
* @private
|
|
|
|
* @param {Object} [options]
|
|
|
|
* @param {Function} [customizer=browserifyGruntCustomizer]
|
|
|
|
* If the default array-concatenation behavior is not desireable,
|
|
|
|
* pass _.noop or a unique customizer (https://lodash.com/docs#merge).
|
|
|
|
*
|
|
|
|
* @return {Object}
|
|
|
|
*/
|
2015-12-09 03:30:48 +02:00
|
|
|
const browserifyGruntOptions = gruntOptionsMaker(browserifyGruntDefaults, browserifyGruntCustomizer);
|
|
|
|
|
|
|
|
const githubReleaseCustomizer = gruntCustomizer;
|
|
|
|
const githubReleaseOptions = gruntOptionsMaker(githubReleaseDefaults, githubReleaseCustomizer);
|
2015-10-28 23:47:18 +02:00
|
|
|
|
2015-08-10 21:22:15 +02:00
|
|
|
/**
|
|
|
|
* Creates processor functions for license banners.
|
|
|
|
*
|
2015-10-28 23:47:18 +02:00
|
|
|
* @function createLicenseProcessor
|
2015-08-10 21:22:15 +02:00
|
|
|
* @private
|
|
|
|
* @param {Object} data Custom data overriding `bannerCommonData`. Will
|
|
|
|
* not be mutated.
|
|
|
|
* @return {Function} A function which returns a processed grunt template
|
|
|
|
* using an object constructed from `bannerCommonData`
|
|
|
|
* and the `data` argument.
|
|
|
|
*/
|
2015-10-28 23:47:18 +02:00
|
|
|
function createLicenseProcessor(data) {
|
|
|
|
return () => {
|
|
|
|
return grunt.template.process(license, {
|
|
|
|
data: _.merge({}, bannerCommonData, data)
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
2015-08-10 21:22:15 +02:00
|
|
|
|
2015-05-01 21:53:51 +02:00
|
|
|
version.majorMinor = `${version.major}.${version.minor}`;
|
|
|
|
grunt.vjsVersion = version;
|
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg,
|
|
|
|
clean: {
|
2016-08-17 23:16:41 +02:00
|
|
|
build: ['build/temp/*', 'es5'],
|
2015-05-01 21:53:51 +02:00
|
|
|
dist: ['dist/*']
|
|
|
|
},
|
|
|
|
uglify: {
|
|
|
|
options: {
|
|
|
|
preserveComments: 'some',
|
2016-10-25 00:25:46 +02:00
|
|
|
screwIE8: false,
|
2015-05-01 21:53:51 +02:00
|
|
|
mangle: true,
|
|
|
|
compress: {
|
|
|
|
sequences: true,
|
|
|
|
dead_code: true,
|
|
|
|
conditionals: true,
|
|
|
|
booleans: true,
|
|
|
|
unused: true,
|
|
|
|
if_return: true,
|
|
|
|
join_vars: true,
|
|
|
|
drop_console: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
build: {
|
|
|
|
files: {
|
2015-08-10 21:22:15 +02:00
|
|
|
'build/temp/alt/video.novtt.min.js': 'build/temp/alt/video.novtt.js',
|
2015-05-01 21:53:51 +02:00
|
|
|
'build/temp/video.min.js': 'build/temp/video.js'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
dist: {},
|
|
|
|
watch: {
|
2016-03-17 20:53:00 +02:00
|
|
|
novtt: {
|
|
|
|
files: ['build/temp/video.js'],
|
|
|
|
tasks: ['concat:novtt']
|
|
|
|
},
|
2016-02-12 00:04:30 +02:00
|
|
|
minify: {
|
|
|
|
files: ['build/temp/video.js'],
|
|
|
|
tasks: ['uglify']
|
|
|
|
},
|
2015-05-01 21:53:51 +02:00
|
|
|
skin: {
|
|
|
|
files: ['src/css/**/*'],
|
2016-07-18 22:27:43 +02:00
|
|
|
tasks: ['skin']
|
|
|
|
},
|
2016-08-17 23:16:41 +02:00
|
|
|
babel: {
|
|
|
|
files: ['src/js/**/*.js'],
|
|
|
|
tasks: ['babel:es5']
|
|
|
|
},
|
2016-07-18 22:27:43 +02:00
|
|
|
jshint: {
|
|
|
|
files: ['src/**/*', 'test/unit/**/*.js', 'Gruntfile.js'],
|
|
|
|
tasks: 'jshint'
|
2015-05-01 21:53:51 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
connect: {
|
|
|
|
dev: {
|
|
|
|
options: {
|
2015-08-06 16:55:29 +02:00
|
|
|
port: Number(process.env.VJS_CONNECT_PORT) || 9999,
|
|
|
|
livereload: true,
|
|
|
|
useAvailablePort: true
|
2015-05-01 21:53:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
copy: {
|
|
|
|
minor: {
|
|
|
|
files: [
|
|
|
|
{expand: true, cwd: 'build/temp/', src: ['*'], dest: 'dist/'+version.majorMinor+'/', filter: 'isFile'} // includes files in path
|
|
|
|
]
|
|
|
|
},
|
|
|
|
patch: {
|
|
|
|
files: [
|
|
|
|
{expand: true, cwd: 'build/temp/', src: ['*'], dest: 'dist/'+version.full+'/', filter: 'isFile'} // includes files in path
|
|
|
|
]
|
|
|
|
},
|
2015-06-03 03:17:28 +02:00
|
|
|
fonts: { cwd: 'node_modules/videojs-font/fonts/', src: ['*'], dest: 'build/temp/font/', expand: true, filter: 'isFile' },
|
|
|
|
swf: { cwd: 'node_modules/videojs-swf/dist/', src: 'video-js.swf', dest: 'build/temp/', expand: true, filter: 'isFile' },
|
|
|
|
ie8: { cwd: 'node_modules/videojs-ie8/dist/', src: ['**/**'], dest: 'build/temp/ie8/', expand: true, filter: 'isFile' },
|
|
|
|
dist: { cwd: 'build/temp/', src: ['**/**', '!test*'], dest: 'dist/', expand: true, filter: 'isFile' },
|
2016-09-30 21:18:57 +02:00
|
|
|
a11y: { src: 'sandbox/descriptions.html.example', dest: 'sandbox/descriptions.test-a11y.html' }, // Can only test a file with a .html or .htm extension
|
2015-06-03 03:17:28 +02:00
|
|
|
examples: { cwd: 'docs/examples/', src: ['**/**'], dest: 'dist/examples/', expand: true, filter: 'isFile' }
|
2015-05-01 21:53:51 +02:00
|
|
|
},
|
|
|
|
cssmin: {
|
|
|
|
minify: {
|
2016-07-18 22:27:43 +02:00
|
|
|
expand: true,
|
|
|
|
cwd: 'build/temp/',
|
|
|
|
src: ['video-js.css', 'alt/video-js-cdn.css'],
|
|
|
|
dest: 'build/temp/',
|
|
|
|
ext: '.min.css'
|
2015-05-01 21:53:51 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
sass: {
|
2015-06-10 03:57:20 +02:00
|
|
|
build: {
|
2015-05-01 21:53:51 +02:00
|
|
|
files: {
|
2016-02-19 21:17:47 +02:00
|
|
|
'build/temp/video-js.css': 'src/css/vjs.scss',
|
|
|
|
'build/temp/alt/video-js-cdn.css': 'src/css/vjs-cdn.scss'
|
2015-05-01 21:53:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
karma: {
|
|
|
|
// this config file applies to all following configs except if overwritten
|
|
|
|
options: {
|
|
|
|
configFile: 'test/karma.conf.js'
|
|
|
|
},
|
|
|
|
|
2015-10-26 23:06:16 +02:00
|
|
|
defaults: {
|
|
|
|
detectBrowsers: {
|
|
|
|
enabled: !process.env.TRAVIS,
|
|
|
|
usePhantomJS: false
|
|
|
|
}
|
|
|
|
},
|
2015-06-10 03:57:20 +02:00
|
|
|
|
|
|
|
watch: {
|
|
|
|
autoWatch: true,
|
|
|
|
singleRun: false
|
2015-05-01 21:53:51 +02:00
|
|
|
},
|
2015-06-10 03:57:20 +02:00
|
|
|
|
|
|
|
// these are run locally on local browsers
|
|
|
|
dev: { browsers: ['Chrome', 'Firefox', 'Safari'] },
|
2015-05-01 21:53:51 +02:00
|
|
|
chromecanary: { browsers: ['ChromeCanary'] },
|
|
|
|
chrome: { browsers: ['Chrome'] },
|
|
|
|
firefox: { browsers: ['Firefox'] },
|
|
|
|
safari: { browsers: ['Safari'] },
|
|
|
|
ie: { browsers: ['IE'] },
|
|
|
|
|
2015-08-20 23:57:59 +02:00
|
|
|
// this only runs on PRs from the mainrepo on BrowserStack
|
|
|
|
browserstack: { browsers: ['chrome_bs'] },
|
|
|
|
chrome_bs: { browsers: ['chrome_bs'] },
|
|
|
|
firefox_bs: { browsers: ['firefox_bs'] },
|
|
|
|
safari_bs: { browsers: ['safari_bs'] },
|
|
|
|
ie11_bs: { browsers: ['ie11_bs'] },
|
|
|
|
ie10_bs: { browsers: ['ie10_bs'] },
|
|
|
|
ie9_bs: { browsers: ['ie9_bs'] },
|
2015-10-26 23:13:57 +02:00
|
|
|
ie8_bs: { browsers: ['ie8_bs'] }
|
2015-05-01 21:53:51 +02:00
|
|
|
},
|
|
|
|
vjsdocs: {
|
|
|
|
all: {
|
|
|
|
// TODO: Update vjsdocs to support new build, or switch to jsdoc
|
|
|
|
src: '',
|
|
|
|
dest: 'docs/api',
|
|
|
|
options: {
|
|
|
|
baseURL: 'https://github.com/videojs/video.js/blob/master/'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
vjslanguages: {
|
|
|
|
defaults: {
|
|
|
|
files: {
|
|
|
|
'build/temp/lang': ['lang/*.json']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
zip: {
|
|
|
|
dist: {
|
|
|
|
router: function (filepath) {
|
|
|
|
var path = require('path');
|
|
|
|
return path.relative('dist', filepath);
|
|
|
|
},
|
|
|
|
// compression: 'DEFLATE',
|
|
|
|
src: ['dist/**/*'],
|
|
|
|
dest: 'dist/video-js-' + version.full + '.zip'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
version: {
|
|
|
|
options: {
|
|
|
|
pkg: 'package.json'
|
|
|
|
},
|
|
|
|
major: {
|
|
|
|
options: {
|
|
|
|
release: 'major'
|
|
|
|
},
|
2015-05-13 04:29:06 +02:00
|
|
|
src: ['package.json', 'component.json']
|
2015-05-01 21:53:51 +02:00
|
|
|
},
|
|
|
|
minor: {
|
|
|
|
options: {
|
|
|
|
release: 'minor'
|
|
|
|
},
|
2015-05-13 04:29:06 +02:00
|
|
|
src: ['package.json', 'component.json']
|
2015-05-01 21:53:51 +02:00
|
|
|
},
|
|
|
|
patch: {
|
|
|
|
options: {
|
|
|
|
release: 'patch'
|
|
|
|
},
|
2015-05-13 04:29:06 +02:00
|
|
|
src: ['package.json', 'component.json']
|
2015-05-01 21:53:51 +02:00
|
|
|
},
|
|
|
|
prerelease: {
|
|
|
|
options: {
|
|
|
|
release: 'prerelease'
|
|
|
|
},
|
2015-05-13 04:29:06 +02:00
|
|
|
src: ['package.json', 'component.json']
|
2015-05-01 21:53:51 +02:00
|
|
|
},
|
|
|
|
css: {
|
|
|
|
options: {
|
|
|
|
prefix: '@version\\s*'
|
|
|
|
},
|
|
|
|
src: 'build/temp/video-js.css'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'github-release': {
|
|
|
|
options: {
|
|
|
|
repository: 'videojs/video.js',
|
|
|
|
auth: {
|
|
|
|
user: process.env.VJS_GITHUB_USER,
|
|
|
|
password: process.env.VJS_GITHUB_TOKEN
|
2015-12-09 01:59:02 +02:00
|
|
|
}
|
|
|
|
},
|
2015-12-09 03:30:48 +02:00
|
|
|
release: githubReleaseOptions(),
|
|
|
|
prerelease: githubReleaseOptions({
|
2015-12-09 01:59:02 +02:00
|
|
|
options: {
|
|
|
|
release: {
|
|
|
|
prerelease: true
|
|
|
|
}
|
2015-05-01 21:53:51 +02:00
|
|
|
}
|
2015-12-09 03:30:48 +02:00
|
|
|
})
|
2015-05-01 21:53:51 +02:00
|
|
|
},
|
2016-08-17 23:16:41 +02:00
|
|
|
babel: {
|
|
|
|
es5: {
|
|
|
|
files: [{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'src/js/',
|
|
|
|
src: ['**/*.js', '!base-styles.js'],
|
|
|
|
dest: 'es5/'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
2015-05-01 21:53:51 +02:00
|
|
|
browserify: {
|
2015-10-28 23:47:18 +02:00
|
|
|
options: browserifyGruntOptions(),
|
2015-05-01 21:53:51 +02:00
|
|
|
build: {
|
|
|
|
files: {
|
2016-08-17 23:16:41 +02:00
|
|
|
'build/temp/video.js': ['es5/video.js']
|
2015-05-01 21:53:51 +02:00
|
|
|
}
|
|
|
|
},
|
2015-10-28 23:47:18 +02:00
|
|
|
dist: {
|
|
|
|
options: browserifyGruntOptions({
|
|
|
|
transform: [
|
|
|
|
['browserify-versionify', {
|
2015-12-10 01:12:46 +02:00
|
|
|
placeholder: '../node_modules/videojs-vtt.js/dist/vtt.js',
|
2015-10-28 23:47:18 +02:00
|
|
|
version: 'https://cdn.rawgit.com/gkatsev/vtt.js/vjs-v0.12.1/dist/vtt.min.js'
|
|
|
|
}],
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
files: {
|
2016-08-17 23:16:41 +02:00
|
|
|
'build/temp/video.js': ['es5/video.js']
|
2015-10-28 23:47:18 +02:00
|
|
|
}
|
|
|
|
},
|
2015-06-10 03:57:20 +02:00
|
|
|
watch: {
|
|
|
|
options: {
|
|
|
|
watch: true,
|
|
|
|
keepAlive: true
|
2015-05-01 21:53:51 +02:00
|
|
|
},
|
2015-06-10 03:57:20 +02:00
|
|
|
files: {
|
2016-08-17 23:16:41 +02:00
|
|
|
'build/temp/video.js': ['es5/video.js']
|
2015-06-10 03:57:20 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
tests: {
|
2015-05-01 21:53:51 +02:00
|
|
|
options: {
|
|
|
|
browserifyOptions: {
|
2016-08-17 23:16:41 +02:00
|
|
|
verbose: true,
|
|
|
|
standalone: false,
|
|
|
|
transform: ['babelify']
|
2015-05-01 21:53:51 +02:00
|
|
|
},
|
2015-09-25 01:58:25 +02:00
|
|
|
plugin: [
|
2016-09-29 17:58:37 +02:00
|
|
|
['proxyquireify/plugin', 'bundle-collapser/plugin']
|
2015-09-25 01:58:25 +02:00
|
|
|
],
|
2015-06-10 03:57:20 +02:00
|
|
|
banner: false,
|
|
|
|
watch: true,
|
|
|
|
keepAlive: true
|
|
|
|
},
|
2015-05-01 21:53:51 +02:00
|
|
|
files: {
|
2015-05-01 23:16:19 +02:00
|
|
|
'build/temp/tests.js': [
|
|
|
|
'test/globals-shim.js',
|
|
|
|
'test/unit/**/*.js'
|
|
|
|
]
|
2015-05-01 21:53:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
coveralls: {
|
|
|
|
options: {
|
|
|
|
// warn instead of failing when coveralls errors
|
|
|
|
// we've seen coveralls 503 relatively frequently
|
|
|
|
force: true
|
|
|
|
},
|
|
|
|
all: {
|
|
|
|
src: 'test/coverage/lcov.info'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
concat: {
|
2016-06-18 05:50:54 +02:00
|
|
|
options: {
|
|
|
|
separator: '\n'
|
|
|
|
},
|
2015-08-10 21:22:15 +02:00
|
|
|
novtt: {
|
|
|
|
src: ['build/temp/video.js'],
|
2015-09-23 18:29:22 +02:00
|
|
|
dest: 'build/temp/alt/video.novtt.js'
|
2015-08-10 21:22:15 +02:00
|
|
|
},
|
2015-05-01 21:53:51 +02:00
|
|
|
vtt: {
|
2016-02-11 23:59:38 +02:00
|
|
|
src: ['build/temp/video.js', 'node_modules/videojs-vtt.js/dist/vtt.js'],
|
2016-06-18 05:50:54 +02:00
|
|
|
dest: 'build/temp/video.js'
|
2016-07-18 22:27:43 +02:00
|
|
|
},
|
|
|
|
ie8_addition: {
|
|
|
|
src: ['build/temp/video-js.css', 'src/css/ie8.css'],
|
|
|
|
dest: 'build/temp/video-js.css'
|
2016-06-18 05:50:54 +02:00
|
|
|
}
|
2015-06-10 03:57:20 +02:00
|
|
|
},
|
|
|
|
concurrent: {
|
|
|
|
options: {
|
|
|
|
logConcurrentOutput: true
|
|
|
|
},
|
2016-08-17 23:16:41 +02:00
|
|
|
tests: [
|
|
|
|
'watch:babel',
|
|
|
|
'browserify:tests'
|
|
|
|
],
|
2015-06-10 03:57:20 +02:00
|
|
|
// Run multiple watch tasks in parallel
|
|
|
|
// Needed so watchify can cache intelligently
|
|
|
|
watchAll: [
|
|
|
|
'watch',
|
|
|
|
'browserify:watch',
|
|
|
|
'browserify:tests',
|
|
|
|
'karma:watch'
|
|
|
|
],
|
|
|
|
watchSandbox: [
|
|
|
|
'watch',
|
|
|
|
'browserify:watch'
|
|
|
|
]
|
2015-08-10 21:22:15 +02:00
|
|
|
},
|
|
|
|
usebanner: {
|
|
|
|
novtt: {
|
|
|
|
options: {
|
|
|
|
process: createLicenseProcessor({includesVtt: false})
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
src: ['build/temp/alt/video.novtt.js']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
vtt: {
|
|
|
|
options: {
|
|
|
|
process: createLicenseProcessor({includesVtt: true})
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
src: ['build/temp/video.js']
|
|
|
|
}
|
|
|
|
}
|
2016-07-25 15:49:38 +02:00
|
|
|
},
|
|
|
|
shell: {
|
|
|
|
lint: {
|
2016-08-17 23:16:41 +02:00
|
|
|
command: 'npm run lint',
|
2016-07-25 15:49:38 +02:00
|
|
|
options: {
|
|
|
|
preferLocal: true
|
|
|
|
}
|
2016-08-24 22:31:19 +02:00
|
|
|
},
|
|
|
|
noderequire: {
|
|
|
|
command: 'node test/require/node.js',
|
|
|
|
options: {
|
|
|
|
failOnError: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
browserify: {
|
|
|
|
command: 'browserify test/require/browserify.js -o build/temp/browserify.js',
|
|
|
|
options: {
|
|
|
|
preferLocal: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
webpack: {
|
|
|
|
command: 'webpack test/require/webpack.js build/temp/webpack.js',
|
|
|
|
options: {
|
|
|
|
preferLocal: true
|
|
|
|
}
|
2016-07-25 15:49:38 +02:00
|
|
|
}
|
2016-09-30 21:18:57 +02:00
|
|
|
},
|
|
|
|
accessibility: {
|
|
|
|
options: {
|
|
|
|
accessibilityLevel: 'WCAG2AA',
|
|
|
|
reportLevels: {
|
|
|
|
notice: false,
|
|
|
|
warning: true,
|
|
|
|
error: true
|
|
|
|
},
|
|
|
|
ignore: [
|
|
|
|
// Ignore the warning about needing <optgroup> elements
|
|
|
|
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H85.2'
|
|
|
|
]
|
|
|
|
|
|
|
|
},
|
|
|
|
test: {
|
|
|
|
src: ['sandbox/descriptions.test-a11y.html']
|
|
|
|
}
|
2015-05-01 21:53:51 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// load all the npm grunt tasks
|
|
|
|
require('load-grunt-tasks')(grunt);
|
|
|
|
grunt.loadNpmTasks('videojs-doc-generator');
|
|
|
|
grunt.loadNpmTasks('chg');
|
2016-06-28 00:26:37 +02:00
|
|
|
grunt.loadNpmTasks('gkatsev-grunt-sass');
|
2016-09-30 21:18:57 +02:00
|
|
|
grunt.loadNpmTasks('grunt-accessibility');
|
2015-05-01 21:53:51 +02:00
|
|
|
|
2015-10-28 23:47:18 +02:00
|
|
|
const buildDependents = [
|
2016-08-12 00:33:34 +02:00
|
|
|
'shell:lint',
|
2015-05-01 21:53:51 +02:00
|
|
|
'clean:build',
|
2015-06-10 03:57:20 +02:00
|
|
|
|
2016-08-17 23:16:41 +02:00
|
|
|
'babel:es5',
|
2015-05-01 21:53:51 +02:00
|
|
|
'browserify:build',
|
2015-08-10 21:22:15 +02:00
|
|
|
'concat:novtt',
|
2015-05-01 21:53:51 +02:00
|
|
|
'concat:vtt',
|
2015-08-10 21:22:15 +02:00
|
|
|
'usebanner:novtt',
|
|
|
|
'usebanner:vtt',
|
2015-05-01 21:53:51 +02:00
|
|
|
'uglify',
|
2015-06-10 03:57:20 +02:00
|
|
|
|
2016-07-18 22:27:43 +02:00
|
|
|
'skin',
|
2015-05-01 21:53:51 +02:00
|
|
|
'version:css',
|
|
|
|
'cssmin',
|
2015-06-10 03:57:20 +02:00
|
|
|
|
2015-05-01 21:53:51 +02:00
|
|
|
'copy:fonts',
|
|
|
|
'copy:swf',
|
2015-06-03 03:17:28 +02:00
|
|
|
'copy:ie8',
|
2015-05-01 21:53:51 +02:00
|
|
|
'vjslanguages'
|
2015-10-28 23:47:18 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
grunt.registerTask('build', buildDependents);
|
|
|
|
|
|
|
|
grunt.registerTask(
|
|
|
|
'build:dist',
|
|
|
|
buildDependents.map(task => task === 'browserify:build' ? 'browserify:dist' : task)
|
|
|
|
);
|
2015-05-01 21:53:51 +02:00
|
|
|
|
|
|
|
grunt.registerTask('dist', [
|
|
|
|
'clean:dist',
|
2015-10-28 23:47:18 +02:00
|
|
|
'build:dist',
|
2015-05-01 21:53:51 +02:00
|
|
|
'copy:dist',
|
|
|
|
'copy:examples',
|
|
|
|
'zip:dist'
|
|
|
|
]);
|
|
|
|
|
2016-07-18 22:27:43 +02:00
|
|
|
grunt.registerTask('skin', ['sass', 'concat:ie8_addition']);
|
2016-03-25 20:34:06 +02:00
|
|
|
|
2015-06-10 03:57:20 +02:00
|
|
|
// Default task - build and test
|
|
|
|
grunt.registerTask('default', ['test']);
|
2015-05-01 21:53:51 +02:00
|
|
|
|
2016-07-21 19:26:46 +02:00
|
|
|
// The test script includes coveralls only when the TRAVIS env var is set.
|
2016-08-24 22:31:19 +02:00
|
|
|
grunt.registerTask('test', [
|
|
|
|
'build',
|
|
|
|
'shell:noderequire',
|
|
|
|
'shell:browserify',
|
2016-08-25 22:24:31 +02:00
|
|
|
'shell:webpack',
|
2016-09-30 21:18:57 +02:00
|
|
|
'karma:defaults',
|
|
|
|
'test-a11y'].concat(process.env.TRAVIS && 'coveralls').filter(Boolean));
|
2015-05-01 21:53:51 +02:00
|
|
|
|
2015-06-10 03:57:20 +02:00
|
|
|
// Run while developing
|
|
|
|
grunt.registerTask('dev', ['build', 'connect:dev', 'concurrent:watchSandbox']);
|
2015-05-01 21:53:51 +02:00
|
|
|
|
2015-06-10 03:57:20 +02:00
|
|
|
grunt.registerTask('watchAll', ['build', 'connect:dev', 'concurrent:watchAll']);
|
2015-05-01 21:53:51 +02:00
|
|
|
|
2016-09-30 21:18:57 +02:00
|
|
|
grunt.registerTask('test-a11y', ['copy:a11y', 'accessibility']);
|
|
|
|
|
2015-06-10 03:57:20 +02:00
|
|
|
// Pick your testing, or run both in different terminals
|
|
|
|
grunt.registerTask('test-ui', ['browserify:tests']);
|
|
|
|
grunt.registerTask('test-cli', ['karma:watch']);
|
2015-05-01 21:53:51 +02:00
|
|
|
|
|
|
|
// Load all the tasks in the tasks directory
|
|
|
|
grunt.loadTasks('build/tasks');
|
|
|
|
};
|