summaryrefslogtreecommitdiff
path: root/javascript/videojs/build/docs-only.js
blob: c8abcb904ec3dea402d0c775d8bba569ff2a3e63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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');
};