Skip to content

Commit

Permalink
Use util-deprecate for deprecation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypnosphi committed May 28, 2021
1 parent 9c453ff commit 3ea0458
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const browserslist = require('browserslist');
const deprecate = require('util-deprecate');

const coreJsVersion = process.env.RING_UI_COREJS_VERSION ||
require('core-js/package.json').version;
Expand All @@ -9,8 +10,8 @@ module.exports = function config(api) {
api.cache(true);

if (isDeprecatedCoreJS) {
// eslint-disable-next-line no-console
console.log(`Compiling Ring UI with deprecated Core JS version "${coreJsVersion}". Consider updating to 3rd.`);
// TODO remove in 5.0
deprecate(`Compiling Ring UI with deprecated Core JS version "${coreJsVersion}". Consider updating to 3rd.`)();
}

return {
Expand Down
6 changes: 4 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
const path = require('path');

const deprecate = require('util-deprecate');

(function checkWebpack() {
const webpackVersion = require('webpack').version;
const isObsoleteWebpack = webpackVersion.startsWith('4');
if (isObsoleteWebpack) {
// eslint-disable-next-line no-console
console.log(`[WARN]: RingUI is used with Webpack@"${webpackVersion}". Ring UI requires Webpack@>=5`);
// TODO remove in 5.0
deprecate(`[WARN]: RingUI is used with Webpack@"${webpackVersion}". Ring UI requires Webpack@>=5`)();
}
}());

Expand Down

0 comments on commit 3ea0458

Please sign in to comment.