1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-21 01:39:04 +02:00
video.js/build/docs-only.js
2019-08-30 14:14:53 -04:00

20 lines
559 B
JavaScript

const sh = require('shelljs');
const path = require('path');
module.exports = function(commit, commitRange) {
const SINGLE_COMMIT = `git diff-tree --no-commit-id --name-only -r ${commit}`;
const COMMIT_RANGE = `git diff --name-only ${commitRange}`;
let command = SINGLE_COMMIT;
if (commitRange) {
command = COMMIT_RANGE;
}
const output = sh.exec(command, {async: false, silent: true}).stdout;
const files = output.split('\n').filter(Boolean);
return files.every((file) => file.startsWith('docs') || path.extname(file) === '.md');
};