mirror of
https://github.com/videojs/video.js.git
synced 2024-12-25 02:42:10 +02:00
@gkatsev updated options customizer and github-release options. closes #2903
This commit is contained in:
parent
565dba8671
commit
08f03c160c
@ -2,7 +2,7 @@ CHANGELOG
|
|||||||
=========
|
=========
|
||||||
|
|
||||||
## HEAD (Unreleased)
|
## HEAD (Unreleased)
|
||||||
_(none)_
|
* @gkatsev updated options customizer and github-release options ([view](https://github.com/videojs/video.js/pull/2903))
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import {gruntCustomizer, gruntOptionsMaker} from './options-customizer.js';
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
require('time-grunt')(grunt);
|
require('time-grunt')(grunt);
|
||||||
|
|
||||||
@ -41,6 +42,19 @@ module.exports = function(grunt) {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const githubReleaseDefaults = {
|
||||||
|
options: {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customizes _.merge behavior in `browserifyGruntOptions` to concatenate
|
* Customizes _.merge behavior in `browserifyGruntOptions` to concatenate
|
||||||
* arrays. This can be overridden on a per-call basis to
|
* arrays. This can be overridden on a per-call basis to
|
||||||
@ -52,11 +66,7 @@ module.exports = function(grunt) {
|
|||||||
* @param {Mixed} sourceValue
|
* @param {Mixed} sourceValue
|
||||||
* @return {Object}
|
* @return {Object}
|
||||||
*/
|
*/
|
||||||
function browserifyGruntCustomizer(objectValue, sourceValue) {
|
const browserifyGruntCustomizer = gruntCustomizer;
|
||||||
if (Array.isArray(objectValue)) {
|
|
||||||
return objectValue.concat(sourceValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a unique object of Browserify Grunt task options.
|
* Creates a unique object of Browserify Grunt task options.
|
||||||
@ -70,9 +80,10 @@ module.exports = function(grunt) {
|
|||||||
*
|
*
|
||||||
* @return {Object}
|
* @return {Object}
|
||||||
*/
|
*/
|
||||||
function browserifyGruntOptions(options = null, customizer = browserifyGruntCustomizer) {
|
const browserifyGruntOptions = gruntOptionsMaker(browserifyGruntDefaults, browserifyGruntCustomizer);
|
||||||
return _.merge({}, browserifyGruntDefaults, options, customizer);
|
|
||||||
}
|
const githubReleaseCustomizer = gruntCustomizer;
|
||||||
|
const githubReleaseOptions = gruntOptionsMaker(githubReleaseDefaults, githubReleaseCustomizer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates processor functions for license banners.
|
* Creates processor functions for license banners.
|
||||||
@ -296,28 +307,14 @@ module.exports = function(grunt) {
|
|||||||
password: process.env.VJS_GITHUB_TOKEN
|
password: process.env.VJS_GITHUB_TOKEN
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
release: {
|
release: githubReleaseOptions(),
|
||||||
|
prerelease: githubReleaseOptions({
|
||||||
options: {
|
options: {
|
||||||
release: {
|
release: {
|
||||||
tag_name: 'v'+ version.full,
|
|
||||||
name: version.full,
|
|
||||||
body: require('chg').find(version.full).changesRaw
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
prerelease: {
|
|
||||||
options: {
|
|
||||||
release: {
|
|
||||||
tag_name: 'v'+ version.full,
|
|
||||||
name: version.full,
|
|
||||||
body: require('chg').find(version.full).changesRaw,
|
|
||||||
prerelease: true
|
prerelease: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
files: {
|
|
||||||
src: [`dist/video-js-${version.full}.zip`] // Files that you want to attach to Release
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
browserify: {
|
browserify: {
|
||||||
options: browserifyGruntOptions(),
|
options: browserifyGruntOptions(),
|
||||||
|
49
build/options-customizer.js
Normal file
49
build/options-customizer.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import _ from 'lodash-compat';
|
||||||
|
/**
|
||||||
|
* Customizes _.merge behavior in `gruntOptions` to concatenate
|
||||||
|
* arrays. This can be overridden on a per-call basis to
|
||||||
|
*
|
||||||
|
* @see https://lodash.com/docs#merge
|
||||||
|
* @function GruntCustomizer
|
||||||
|
* @private
|
||||||
|
* @param {Mixed} objectValue
|
||||||
|
* @param {Mixed} sourceValue
|
||||||
|
* @return {Object}
|
||||||
|
*/
|
||||||
|
function gruntCustomizer(objectValue, sourceValue) {
|
||||||
|
if (Array.isArray(objectValue)) {
|
||||||
|
return objectValue.concat(sourceValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a gruntOptions instance for the specific defaultOptions and gruntCustomizer
|
||||||
|
*
|
||||||
|
* @function browserifyGruntOptions
|
||||||
|
* @private
|
||||||
|
* @param {Object} [options]
|
||||||
|
* @param {Function} [customizer=gruntCustomizer]
|
||||||
|
* If the default array-concatenation behavior is not desireable,
|
||||||
|
* pass _.noop or a unique customizer (https://lodash.com/docs#merge).
|
||||||
|
*
|
||||||
|
* @return {Function}
|
||||||
|
*/
|
||||||
|
function gruntOptionsMaker(defaultOptions, gruntCustomizer) {
|
||||||
|
/**
|
||||||
|
* Creates a unique object of Browserify Grunt task options.
|
||||||
|
*
|
||||||
|
* @function gruntOptions
|
||||||
|
* @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}
|
||||||
|
*/
|
||||||
|
return function gruntOptions(options = null, customizer = gruntCustomizer) {
|
||||||
|
return _.merge({}, defaultOptions, options, customizer);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export { gruntCustomizer, gruntOptionsMaker };
|
Loading…
Reference in New Issue
Block a user