Skip to content

Commit

Permalink
Merge pull request #1427 from contentstack/fix/DX-51/deprecation-warning
Browse files Browse the repository at this point in the history
fix: handle deprecation warning message
  • Loading branch information
aman19K authored Jun 5, 2024
2 parents a034cee + 5b8cd04 commit 430d83a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions packages/contentstack/bin/run.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
#!/usr/bin/env node
// eslint-disable-next-line unicorn/prefer-top-level-await
(async () => {
const oclif = await import('@oclif/core');
await oclif.execute({ development: false, dir: __dirname });
try {
// Store the original process.emitWarning function
const originalEmitWarning = process.emitWarning;

// Override process.emitWarning to filter out the punycode deprecation warning
process.emitWarning = (warning, type, code, ...args) => {
if (type === 'DeprecationWarning' && typeof warning === 'string' && warning.includes('punycode')) {
// Ignore punycode deprecation warning
return;
}
// Call the original emitWarning function for other warnings
originalEmitWarning.call(process, warning, type, code, ...args);
};

const oclif = await import('@oclif/core');
await oclif.execute({ development: false, dir: __dirname });
} catch (error) {
console.error('An error occurred while executing oclif:', error);
}
})();

0 comments on commit 430d83a

Please sign in to comment.