UNPKG

madrun

Version:

CLI tool to run multiple npm-scripts in a madly comfortable way

29 lines (20 loc) 583 B
'use strict'; const keys = require('all-object-keys'); const jessy = require('jessy'); const isFn = (a) => typeof a === 'function'; module.exports = (scripts) => { const problems = getNames(scripts); if (!problems.length) return ''; return `echo 'fix scripts first: "${problems.join('", "')}"'`; }; function getNames(scripts) { const result = []; const all = keys(scripts); for (const key of all) { const fn = jessy(key, scripts); if (!isFn(fn)) result.push(key); } return result; }