UNPKG

741 BJavaScriptView Raw
1const Deprecated = require('deprecated-obj');
2const deprecated = require('../conf/deprecated.json');
3const Log = require('./log');
4
5module.exports = (config, log = new Log()) => {
6 const deprecations = new Deprecated(deprecated, config);
7 const compliant = deprecations.getCompliant();
8 const violations = deprecations.getViolations();
9 if (Object.keys(violations).length > 0) {
10 log.warn(`Deprecated configuration options found. Please migrate before the next major release.`);
11 }
12 for (const d in violations) {
13 log.warn(
14 `The "${d}" option is deprecated. ${
15 violations[d] ? (/^[A-Z]/.test(violations[d]) ? violations[d] : `Please use "${violations[d]}" instead.`) : ''
16 }`
17 );
18 }
19 return compliant;
20};