Skip to content

Commit

Permalink
chore: 🤖 hide deprecation warns if global installed
Browse files Browse the repository at this point in the history
  • Loading branch information
heldrida committed Nov 5, 2024
1 parent 174a644 commit 6256834
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@ const semver = require('semver');
const { asyncParser, init } = require('../dist/bundle');
const { loadJSONFromPackageRoot } = require('../dist/utils/json');
const { checkForPackageUpdates } = require('../dist/utils/update-notifier');
const { isGlobalNodeModuleInstall } = require('../dist/utils/fs');

const pkgJson = loadJSONFromPackageRoot('package.json');
const pkgVersion = pkgJson.version;
const requiredVersion = pkgJson.engines.node;

// Hide deprecation warnings for production builds
// Otherwise, shows in development environment
// https://nodejs.org/api/process.html#processnodeprecation
if (isGlobalNodeModuleInstall()) {
process.noDeprecation = true;
}

if (!semver.satisfies(process.version, requiredVersion)) {
// TODO: Pick text from locales
console.error(`⚠️ You are using Node ${process.version}. We require Node ${requiredVersion} or higher!`);
Expand Down

0 comments on commit 6256834

Please sign in to comment.