mirror of
https://github.com/videojs/video.js.git
synced 2025-11-06 09:19:15 +02:00
build: @gkatsev updated the Gruntfile to use ES6. closes #2106
This commit is contained in:
422
Gruntfile.js
422
Gruntfile.js
@@ -1,421 +1,5 @@
|
||||
require('babel/register');
|
||||
|
||||
module.exports = function(grunt) {
|
||||
require('time-grunt')(grunt);
|
||||
|
||||
var pkg = grunt.file.readJSON('package.json');
|
||||
var license = grunt.file.read('build/license-header.txt');
|
||||
var verParts = pkg.version.split('.');
|
||||
var version = {
|
||||
full: pkg.version,
|
||||
major: verParts[0],
|
||||
minor: verParts[1],
|
||||
patch: verParts[2]
|
||||
};
|
||||
|
||||
version.majorMinor = version.major + '.' + version.minor;
|
||||
grunt.vjsVersion = version;
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
pkg: pkg,
|
||||
clean: {
|
||||
build: ['build/temp/*'],
|
||||
dist: ['dist/*']
|
||||
},
|
||||
jshint: {
|
||||
src: {
|
||||
src: ['src/js/**/*.js', 'Gruntfile.js', 'test/unit/**/*.js'],
|
||||
options: {
|
||||
jshintrc: '.jshintrc'
|
||||
}
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
options: {
|
||||
sourceMap: true,
|
||||
sourceMapIn: 'build/temp/video.js.map',
|
||||
sourceMapRoot: '../../src/js',
|
||||
preserveComments: 'some',
|
||||
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: {
|
||||
'build/temp/video.min.js': 'build/temp/video.js'
|
||||
}
|
||||
}
|
||||
},
|
||||
dist: {},
|
||||
watch: {
|
||||
default: {
|
||||
files: [ 'src/**/*', 'test/unit/**/*.js', 'Gruntfile.js' ],
|
||||
tasks: 'dev'
|
||||
},
|
||||
skin: {
|
||||
files: ['src/css/**/*'],
|
||||
tasks: 'sass'
|
||||
}
|
||||
},
|
||||
connect: {
|
||||
preview: {
|
||||
options: {
|
||||
port: 9999,
|
||||
keepalive: true
|
||||
}
|
||||
},
|
||||
dev: {
|
||||
options: {
|
||||
port: 9999,
|
||||
livereload: true
|
||||
}
|
||||
}
|
||||
},
|
||||
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
|
||||
]
|
||||
},
|
||||
fonts: { expand: true, cwd: 'src/css/font/', src: ['*'], dest: 'build/temp/font/', filter: 'isFile' },
|
||||
swf: { src: './node_modules/videojs-swf/dist/video-js.swf', dest: './build/temp/video-js.swf' },
|
||||
novtt: { src: './build/temp/video.js', dest: './build/temp/alt/video.novtt.js' },
|
||||
dist: { expand: true, cwd: 'build/temp/', src: ['**/**'], dest: 'dist/', filter: 'isFile' },
|
||||
examples: { expand: true, cwd: 'build/examples/', src: ['**/**'], dest: 'dist/examples/', filter: 'isFile' },
|
||||
cdn: { expand: true, cwd: 'dist/', src: ['**/**'], dest: 'dist/cdn/', filter: 'isFile' },
|
||||
},
|
||||
aws_s3: {
|
||||
options: {
|
||||
accessKeyId: process.env.VJS_S3_KEY,
|
||||
secretAccessKey: process.env.VJS_S3_SECRET,
|
||||
bucket: process.env.VJS_S3_BUCKET,
|
||||
access: 'public-read',
|
||||
uploadConcurrency: 5
|
||||
},
|
||||
patch: {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'dist/cdn/',
|
||||
src: ['**'],
|
||||
dest: 'vjs/'+version.full+'/',
|
||||
params: { CacheControl: 'public, max-age=31536000' }
|
||||
}
|
||||
]
|
||||
},
|
||||
minor: {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'dist/cdn/',
|
||||
src: ['**'],
|
||||
dest: 'vjs/'+version.majorMinor+'/',
|
||||
params: { CacheControl: 'public, max-age=2628000' }
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
fastly: {
|
||||
options: {
|
||||
key: process.env.VJS_FASTLY_API_KEY
|
||||
},
|
||||
minor: {
|
||||
options: {
|
||||
host: 'vjs.zencdn.net',
|
||||
urls: [
|
||||
version.majorMinor+'/*'
|
||||
]
|
||||
}
|
||||
},
|
||||
patch: {
|
||||
options: {
|
||||
host: 'vjs.zencdn.net',
|
||||
urls: [
|
||||
version.full+'/*'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
minify: {
|
||||
expand: true,
|
||||
cwd: 'build/temp/',
|
||||
src: ['video-js.css'],
|
||||
dest: 'build/temp/',
|
||||
ext: '.min.css'
|
||||
}
|
||||
},
|
||||
sass: {
|
||||
dist: {
|
||||
files: {
|
||||
'build/temp/video-js.css': 'src/css/video-js.scss'
|
||||
}
|
||||
}
|
||||
},
|
||||
karma: {
|
||||
// this config file applies to all following configs except if overwritten
|
||||
options: {
|
||||
configFile: 'test/karma.conf.js'
|
||||
},
|
||||
|
||||
// these are run locally on local browsers
|
||||
dev: {
|
||||
browsers: ['Chrome', 'Firefox', 'Safari']
|
||||
},
|
||||
chromecanary: { browsers: ['ChromeCanary'] },
|
||||
chrome: { browsers: ['Chrome'] },
|
||||
firefox: { browsers: ['Firefox'] },
|
||||
safari: { browsers: ['Safari'] },
|
||||
ie: { browsers: ['IE'] },
|
||||
phantomjs: { browsers: ['PhantomJS'] },
|
||||
|
||||
// this only runs on PRs from the mainrepo on saucelabs
|
||||
saucelabs: { browsers: ['chrome_sl'] },
|
||||
chrome_sl: { browsers: ['chrome_sl'] },
|
||||
firefox_sl: { browsers: ['firefox_sl'] },
|
||||
safari_sl: { browsers: ['safari_sl'] },
|
||||
ipad_sl: { browsers: ['ipad_sl'] },
|
||||
android_sl: { browsers: ['android_sl'] },
|
||||
ie_sl: { browsers: ['ie_sl'] }
|
||||
},
|
||||
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'
|
||||
},
|
||||
src: ['package.json', 'bower.json', 'component.json']
|
||||
},
|
||||
minor: {
|
||||
options: {
|
||||
release: 'minor'
|
||||
},
|
||||
src: ['package.json', 'bower.json', 'component.json']
|
||||
},
|
||||
patch: {
|
||||
options: {
|
||||
release: 'patch'
|
||||
},
|
||||
src: ['package.json', 'bower.json', 'component.json']
|
||||
},
|
||||
prerelease: {
|
||||
options: {
|
||||
release: 'prerelease'
|
||||
},
|
||||
src: ['package.json', 'bower.json', 'component.json']
|
||||
},
|
||||
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
|
||||
},
|
||||
release: {
|
||||
tag_name: 'v'+ version.full,
|
||||
name: version.full,
|
||||
body: require('chg').find(version.full).changesRaw
|
||||
}
|
||||
},
|
||||
files: {
|
||||
src: ['dist/video-js-'+ version.full +'.zip'] // Files that you want to attach to Release
|
||||
}
|
||||
},
|
||||
browserify: {
|
||||
build: {
|
||||
files: {
|
||||
'build/temp/video.js': ['src/js/video.js']
|
||||
},
|
||||
options: {
|
||||
browserifyOptions: {
|
||||
debug: true,
|
||||
standalone: 'videojs'
|
||||
},
|
||||
banner: license,
|
||||
plugin: [
|
||||
[ 'browserify-derequire' ]
|
||||
],
|
||||
transform: [
|
||||
require('babelify').configure({
|
||||
sourceMapRelative: './src/js'
|
||||
}),
|
||||
['browserify-versionify', {
|
||||
placeholder: '__VERSION__',
|
||||
version: pkg.version
|
||||
}],
|
||||
['browserify-versionify', {
|
||||
placeholder: '__VERSION_NO_PATCH__',
|
||||
version: version.majorMinor
|
||||
}]
|
||||
]
|
||||
}
|
||||
},
|
||||
test: {
|
||||
files: {
|
||||
'build/temp/tests.js': [
|
||||
'test/globals-shim.js',
|
||||
'test/unit/**/*.js'
|
||||
]
|
||||
},
|
||||
options: {
|
||||
transform: [
|
||||
require('babelify').configure(),
|
||||
'browserify-istanbul'
|
||||
]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
files: {
|
||||
'build/temp/video.js': ['src/js/video.js']
|
||||
},
|
||||
options: {
|
||||
watch: true,
|
||||
keepAlive: true,
|
||||
browserifyOptions: {
|
||||
debug: true,
|
||||
standalone: 'videojs'
|
||||
},
|
||||
banner: license,
|
||||
plugin: [
|
||||
[ 'browserify-derequire' ]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
exorcise: {
|
||||
build: {
|
||||
options: {},
|
||||
files: {
|
||||
'build/temp/video.js.map': ['build/temp/video.js'],
|
||||
}
|
||||
}
|
||||
},
|
||||
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: {
|
||||
vtt: {
|
||||
options: {
|
||||
separator: '\n',
|
||||
},
|
||||
src: ['build/temp/video.js', 'node_modules/vtt.js/dist/vtt.js'],
|
||||
dest: 'build/temp/video.js',
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
// load all the npm grunt tasks
|
||||
require('load-grunt-tasks')(grunt);
|
||||
grunt.loadNpmTasks('videojs-doc-generator');
|
||||
grunt.loadNpmTasks('chg');
|
||||
|
||||
grunt.registerTask('build', [
|
||||
'clean:build',
|
||||
'jshint',
|
||||
'browserify:build',
|
||||
'browserify:test',
|
||||
'copy:novtt',
|
||||
'concat:vtt',
|
||||
'exorcise',
|
||||
'uglify',
|
||||
'sass',
|
||||
'version:css',
|
||||
'cssmin',
|
||||
'copy:fonts',
|
||||
'copy:swf',
|
||||
'vjslanguages'
|
||||
]);
|
||||
|
||||
grunt.registerTask('dist', [
|
||||
'clean:dist',
|
||||
'build',
|
||||
'copy:dist',
|
||||
'copy:examples',
|
||||
'zip:dist'
|
||||
]);
|
||||
|
||||
grunt.registerTask('cdn', [
|
||||
'dist',
|
||||
'copy:cdn',
|
||||
'dist-cdn'
|
||||
]);
|
||||
|
||||
// Remove this and add to the test task once mmcc's coverall changes are merged
|
||||
grunt.registerTask('newtest', ['build', 'karma:chrome']);
|
||||
|
||||
// Default task.
|
||||
grunt.registerTask('default', ['build', 'test-local']);
|
||||
|
||||
// Development watch task. Doing the minimum required.
|
||||
grunt.registerTask('dev', ['connect:dev', 'jshint', 'sass', 'browserify:build', 'karma:chrome']);
|
||||
|
||||
// Skin development watch task.
|
||||
grunt.registerTask('skin-dev', ['connect:dev', 'watch:skin']);
|
||||
|
||||
// Tests.
|
||||
// We want to run things a little differently if it's coming from Travis vs local
|
||||
if (process.env.TRAVIS) {
|
||||
grunt.registerTask('test', ['build', 'test-travis', 'coveralls']);
|
||||
} else {
|
||||
grunt.registerTask('test', ['build', 'test-local']);
|
||||
}
|
||||
|
||||
// Load all the tasks in the tasks directory
|
||||
grunt.loadTasks('build/tasks');
|
||||
require('./grunt.js')(grunt);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('cdn-links', 'Update the version of CDN links in docs', function(){
|
||||
var doc = grunt.file.read('docs/guides/setup.md');
|
||||
var version = require('../package.json').version;
|
||||
let doc = grunt.file.read('docs/guides/setup.md');
|
||||
let version = require('../package.json').version;
|
||||
|
||||
// remove the patch version to point to the latest patch
|
||||
version = version.replace(/(\d+\.\d+)\.\d+/, '$1');
|
||||
|
||||
@@ -2,7 +2,10 @@ var uglify = require('uglify-js');
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('dist-cdn', 'Assembling distribution', function(){
|
||||
var css, jsmin, jsdev, cdnjs;
|
||||
let css;
|
||||
let jsmin;
|
||||
let jsdev;
|
||||
let cdnjs;
|
||||
|
||||
// Replace font urls with CDN versions
|
||||
css = grunt.file.read('dist/cdn/video-js.css');
|
||||
@@ -10,7 +13,7 @@ module.exports = function(grunt) {
|
||||
grunt.file.write('dist/cdn/video-js.css', css);
|
||||
|
||||
// GA Tracking Pixel (manually building the pixel URL)
|
||||
cdnjs = '\n' + uglify.minify('build/cdn.js').code.replace('v0.0.0', 'v'+ grunt.vjsVersion.full);
|
||||
cdnjs = '\n' + uglify.minify('build/cdn.js').code.replace('v0.0.0', 'v' + grunt.vjsVersion.full);
|
||||
|
||||
// Add CDN-specfic JS
|
||||
js = grunt.file.read('dist/cdn/video.js');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('saucelabs', function() {
|
||||
var exec = require('child_process').exec;
|
||||
var done = this.async();
|
||||
const exec = require('child_process').exec;
|
||||
const done = this.async();
|
||||
|
||||
if (this.args[0] == 'connect') {
|
||||
exec('curl https://gist.githubusercontent.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash',
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('addStyleInjection', 'Adding base style injection', function() {
|
||||
var minifiedCss = grunt.file.read('build/files/video-js.min.css');
|
||||
let minifiedCss = grunt.file.read('build/files/video-js.min.css');
|
||||
// We need to escape any strings
|
||||
minifiedCss = minifiedCss.replace(/'/g, '\\\'');
|
||||
|
||||
var combinedJs = grunt.file.read('build/files/combined.video.js');
|
||||
let combinedJs = grunt.file.read('build/files/combined.video.js');
|
||||
combinedJs = combinedJs.replace(/\{{GENERATED_STYLES}}/g, minifiedCss);
|
||||
grunt.file.write('build/files/combined.video.js', combinedJs);
|
||||
});
|
||||
|
||||
@@ -4,8 +4,8 @@ module.exports = function(grunt) {
|
||||
// grunt test:chrome:firefox # grunt-style
|
||||
// grunt test:chrome,firefox # comma-separated
|
||||
grunt.registerTask('test-local', function() {
|
||||
var tasks = this.args;
|
||||
var tasksMinified;
|
||||
let tasks = this.args;
|
||||
let tasksMinified;
|
||||
|
||||
// if we aren't running this in a CI, but running it manually, we can
|
||||
// supply arguments to this task. These arguments are either colon (`:`)
|
||||
@@ -19,9 +19,7 @@ module.exports = function(grunt) {
|
||||
tasks = tasks[0].split(',');
|
||||
}
|
||||
|
||||
tasks = tasks.map(function(task) {
|
||||
return 'karma:' + task;
|
||||
});
|
||||
tasks = tasks.map((task) => `karma:${task}`);
|
||||
|
||||
grunt.task.run(tasks);
|
||||
});
|
||||
|
||||
@@ -7,8 +7,8 @@ module.exports = function(grunt) {
|
||||
// grunt test:chrome:firefox # grunt-style
|
||||
// grunt test:chrome,firefox # comma-separated
|
||||
grunt.registerTask('test-travis', function() {
|
||||
var tasks = this.args;
|
||||
var tasksMinified;
|
||||
let tasks = this.args;
|
||||
let tasksMinified;
|
||||
|
||||
// I believe this was done originally because of security implications around running
|
||||
// Saucelabs automatically on PRs.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('vjs-version', function() {
|
||||
var version = grunt.vjsVersion.full;
|
||||
let version = grunt.vjsVersion.full;
|
||||
grunt.log.writeln(version);
|
||||
return version;
|
||||
});
|
||||
|
||||
425
grunt.js
Normal file
425
grunt.js
Normal file
@@ -0,0 +1,425 @@
|
||||
module.exports = function(grunt) {
|
||||
require('time-grunt')(grunt);
|
||||
|
||||
let pkg = grunt.file.readJSON('package.json');
|
||||
let license = grunt.file.read('build/license-header.txt');
|
||||
let verParts = pkg.version.split('.');
|
||||
let version = {
|
||||
full: pkg.version,
|
||||
major: verParts[0],
|
||||
minor: verParts[1],
|
||||
patch: verParts[2]
|
||||
};
|
||||
|
||||
version.majorMinor = `${version.major}.${version.minor}`;
|
||||
grunt.vjsVersion = version;
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
pkg,
|
||||
clean: {
|
||||
build: ['build/temp/*'],
|
||||
dist: ['dist/*']
|
||||
},
|
||||
jshint: {
|
||||
src: {
|
||||
src: ['src/js/**/*.js', 'Gruntfile.js', 'test/unit/**/*.js'],
|
||||
options: {
|
||||
jshintrc: '.jshintrc'
|
||||
}
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
options: {
|
||||
sourceMap: true,
|
||||
sourceMapIn: 'build/temp/video.js.map',
|
||||
sourceMapRoot: '../../src/js',
|
||||
preserveComments: 'some',
|
||||
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: {
|
||||
'build/temp/video.min.js': 'build/temp/video.js'
|
||||
}
|
||||
}
|
||||
},
|
||||
dist: {},
|
||||
watch: {
|
||||
default: {
|
||||
files: [ 'src/**/*', 'test/unit/**/*.js', 'Gruntfile.js' ],
|
||||
tasks: 'dev'
|
||||
},
|
||||
skin: {
|
||||
files: ['src/css/**/*'],
|
||||
tasks: 'sass'
|
||||
}
|
||||
},
|
||||
connect: {
|
||||
preview: {
|
||||
options: {
|
||||
port: 9999,
|
||||
keepalive: true
|
||||
}
|
||||
},
|
||||
dev: {
|
||||
options: {
|
||||
port: 9999,
|
||||
livereload: true
|
||||
}
|
||||
}
|
||||
},
|
||||
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
|
||||
]
|
||||
},
|
||||
fonts: { expand: true, cwd: 'src/css/font/', src: ['*'], dest: 'build/temp/font/', filter: 'isFile' },
|
||||
swf: { src: './node_modules/videojs-swf/dist/video-js.swf', dest: './build/temp/video-js.swf' },
|
||||
novtt: { src: './build/temp/video.js', dest: './build/temp/alt/video.novtt.js' },
|
||||
dist: { expand: true, cwd: 'build/temp/', src: ['**/**'], dest: 'dist/', filter: 'isFile' },
|
||||
examples: { expand: true, cwd: 'build/examples/', src: ['**/**'], dest: 'dist/examples/', filter: 'isFile' },
|
||||
cdn: { expand: true, cwd: 'dist/', src: ['**/**'], dest: 'dist/cdn/', filter: 'isFile' },
|
||||
},
|
||||
aws_s3: {
|
||||
options: {
|
||||
accessKeyId: process.env.VJS_S3_KEY,
|
||||
secretAccessKey: process.env.VJS_S3_SECRET,
|
||||
bucket: process.env.VJS_S3_BUCKET,
|
||||
access: 'public-read',
|
||||
uploadConcurrency: 5
|
||||
},
|
||||
patch: {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'dist/cdn/',
|
||||
src: ['**'],
|
||||
dest: 'vjs/'+version.full+'/',
|
||||
params: { CacheControl: 'public, max-age=31536000' }
|
||||
}
|
||||
]
|
||||
},
|
||||
minor: {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'dist/cdn/',
|
||||
src: ['**'],
|
||||
dest: 'vjs/'+version.majorMinor+'/',
|
||||
params: { CacheControl: 'public, max-age=2628000' }
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
fastly: {
|
||||
options: {
|
||||
key: process.env.VJS_FASTLY_API_KEY
|
||||
},
|
||||
minor: {
|
||||
options: {
|
||||
host: 'vjs.zencdn.net',
|
||||
urls: [
|
||||
version.majorMinor+'/*'
|
||||
]
|
||||
}
|
||||
},
|
||||
patch: {
|
||||
options: {
|
||||
host: 'vjs.zencdn.net',
|
||||
urls: [
|
||||
version.full+'/*'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
minify: {
|
||||
expand: true,
|
||||
cwd: 'build/temp/',
|
||||
src: ['video-js.css'],
|
||||
dest: 'build/temp/',
|
||||
ext: '.min.css'
|
||||
}
|
||||
},
|
||||
sass: {
|
||||
dist: {
|
||||
files: {
|
||||
'build/temp/video-js.css': 'src/css/video-js.scss'
|
||||
}
|
||||
}
|
||||
},
|
||||
karma: {
|
||||
// this config file applies to all following configs except if overwritten
|
||||
options: {
|
||||
configFile: 'test/karma.conf.js'
|
||||
},
|
||||
|
||||
// these are run locally on local browsers
|
||||
dev: {
|
||||
browsers: ['Chrome', 'Firefox', 'Safari']
|
||||
},
|
||||
chromecanary: { browsers: ['ChromeCanary'] },
|
||||
chrome: { browsers: ['Chrome'] },
|
||||
firefox: { browsers: ['Firefox'] },
|
||||
safari: { browsers: ['Safari'] },
|
||||
ie: { browsers: ['IE'] },
|
||||
phantomjs: { browsers: ['PhantomJS'] },
|
||||
|
||||
// this only runs on PRs from the mainrepo on saucelabs
|
||||
saucelabs: { browsers: ['chrome_sl'] },
|
||||
chrome_sl: { browsers: ['chrome_sl'] },
|
||||
firefox_sl: { browsers: ['firefox_sl'] },
|
||||
safari_sl: { browsers: ['safari_sl'] },
|
||||
ipad_sl: { browsers: ['ipad_sl'] },
|
||||
android_sl: { browsers: ['android_sl'] },
|
||||
ie_sl: { browsers: ['ie_sl'] }
|
||||
},
|
||||
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'
|
||||
},
|
||||
src: ['package.json', 'bower.json', 'component.json']
|
||||
},
|
||||
minor: {
|
||||
options: {
|
||||
release: 'minor'
|
||||
},
|
||||
src: ['package.json', 'bower.json', 'component.json']
|
||||
},
|
||||
patch: {
|
||||
options: {
|
||||
release: 'patch'
|
||||
},
|
||||
src: ['package.json', 'bower.json', 'component.json']
|
||||
},
|
||||
prerelease: {
|
||||
options: {
|
||||
release: 'prerelease'
|
||||
},
|
||||
src: ['package.json', 'bower.json', 'component.json']
|
||||
},
|
||||
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
|
||||
},
|
||||
release: {
|
||||
tag_name: 'v'+ version.full,
|
||||
name: version.full,
|
||||
body: require('chg').find(version.full).changesRaw
|
||||
}
|
||||
},
|
||||
files: {
|
||||
src: [`dist/video-js-${version.full}.zip`] // Files that you want to attach to Release
|
||||
}
|
||||
},
|
||||
browserify: {
|
||||
build: {
|
||||
files: {
|
||||
'build/temp/video.js': ['src/js/video.js']
|
||||
},
|
||||
options: {
|
||||
browserifyOptions: {
|
||||
debug: true,
|
||||
standalone: 'videojs'
|
||||
},
|
||||
banner: license,
|
||||
plugin: [
|
||||
[ 'browserify-derequire' ]
|
||||
],
|
||||
transform: [
|
||||
require('babelify').configure({
|
||||
sourceMapRelative: './src/js'
|
||||
}),
|
||||
['browserify-versionify', {
|
||||
placeholder: '__VERSION__',
|
||||
version: pkg.version
|
||||
}],
|
||||
['browserify-versionify', {
|
||||
placeholder: '__VERSION_NO_PATCH__',
|
||||
version: version.majorMinor
|
||||
}]
|
||||
]
|
||||
}
|
||||
},
|
||||
test: {
|
||||
files: {
|
||||
'build/temp/tests.js': [
|
||||
'test/globals-shim.js',
|
||||
'test/unit/**/*.js'
|
||||
]
|
||||
},
|
||||
options: {
|
||||
browserifyOptions: {
|
||||
debug: true,
|
||||
standalone: 'videojs'
|
||||
},
|
||||
transform: [
|
||||
require('babelify').configure(),
|
||||
'browserify-istanbul'
|
||||
]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
files: {
|
||||
'build/temp/video.js': ['src/js/video.js']
|
||||
},
|
||||
options: {
|
||||
watch: true,
|
||||
keepAlive: true,
|
||||
browserifyOptions: {
|
||||
debug: true,
|
||||
standalone: 'videojs'
|
||||
},
|
||||
banner: license,
|
||||
plugin: [
|
||||
[ 'browserify-derequire' ]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
exorcise: {
|
||||
build: {
|
||||
options: {},
|
||||
files: {
|
||||
'build/temp/video.js.map': ['build/temp/video.js'],
|
||||
}
|
||||
}
|
||||
},
|
||||
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: {
|
||||
vtt: {
|
||||
options: {
|
||||
separator: '\n',
|
||||
},
|
||||
src: ['build/temp/video.js', 'node_modules/vtt.js/dist/vtt.js'],
|
||||
dest: 'build/temp/video.js',
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
// load all the npm grunt tasks
|
||||
require('load-grunt-tasks')(grunt);
|
||||
grunt.loadNpmTasks('videojs-doc-generator');
|
||||
grunt.loadNpmTasks('chg');
|
||||
|
||||
grunt.registerTask('build', [
|
||||
'clean:build',
|
||||
'jshint',
|
||||
'browserify:build',
|
||||
'browserify:test',
|
||||
'copy:novtt',
|
||||
'concat:vtt',
|
||||
'exorcise',
|
||||
'uglify',
|
||||
'sass',
|
||||
'version:css',
|
||||
'cssmin',
|
||||
'copy:fonts',
|
||||
'copy:swf',
|
||||
'vjslanguages'
|
||||
]);
|
||||
|
||||
grunt.registerTask('dist', [
|
||||
'clean:dist',
|
||||
'build',
|
||||
'copy:dist',
|
||||
'copy:examples',
|
||||
'zip:dist'
|
||||
]);
|
||||
|
||||
grunt.registerTask('cdn', [
|
||||
'dist',
|
||||
'copy:cdn',
|
||||
'dist-cdn'
|
||||
]);
|
||||
|
||||
// Remove this and add to the test task once mmcc's coverall changes are merged
|
||||
grunt.registerTask('newtest', ['build', 'karma:chrome']);
|
||||
|
||||
// Default task.
|
||||
grunt.registerTask('default', ['build', 'test-local']);
|
||||
|
||||
// Development watch task. Doing the minimum required.
|
||||
grunt.registerTask('dev', ['connect:dev', 'jshint', 'sass', 'browserify:build', 'karma:chrome']);
|
||||
|
||||
// Skin development watch task.
|
||||
grunt.registerTask('skin-dev', ['connect:dev', 'watch:skin']);
|
||||
|
||||
// Tests.
|
||||
// We want to run things a little differently if it's coming from Travis vs local
|
||||
if (process.env.TRAVIS) {
|
||||
grunt.registerTask('test', ['build', 'test-travis', 'coveralls']);
|
||||
} else {
|
||||
grunt.registerTask('test', ['build', 'test-local']);
|
||||
}
|
||||
|
||||
// Load all the tasks in the tasks directory
|
||||
grunt.loadTasks('build/tasks');
|
||||
};
|
||||
@@ -30,6 +30,7 @@
|
||||
"vtt.js": "git+https://github.com/gkatsev/vtt.js.git#shim-build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel": "^5.2.2",
|
||||
"babelify": "^6.0.1",
|
||||
"blanket": "^1.1.6",
|
||||
"browserify-derequire": "^0.9.4",
|
||||
|
||||
Reference in New Issue
Block a user