1 | const Log = require('./log');
|
2 | const deprecated = require('../conf/deprecated.json');
|
3 | const Deprecated = require('deprecated-obj');
|
4 |
|
5 | module.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 | };
|