Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle deprecation warning message #1427

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
})();
Loading