Skip to content

Commit 430d83a

Browse files
authored
Merge pull request #1427 from contentstack/fix/DX-51/deprecation-warning
fix: handle deprecation warning message
2 parents a034cee + 5b8cd04 commit 430d83a

File tree

1 file changed

+19
-2
lines changed
  • packages/contentstack/bin

1 file changed

+19
-2
lines changed

packages/contentstack/bin/run.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
#!/usr/bin/env node
22
// eslint-disable-next-line unicorn/prefer-top-level-await
33
(async () => {
4-
const oclif = await import('@oclif/core');
5-
await oclif.execute({ development: false, dir: __dirname });
4+
try {
5+
// Store the original process.emitWarning function
6+
const originalEmitWarning = process.emitWarning;
7+
8+
// Override process.emitWarning to filter out the punycode deprecation warning
9+
process.emitWarning = (warning, type, code, ...args) => {
10+
if (type === 'DeprecationWarning' && typeof warning === 'string' && warning.includes('punycode')) {
11+
// Ignore punycode deprecation warning
12+
return;
13+
}
14+
// Call the original emitWarning function for other warnings
15+
originalEmitWarning.call(process, warning, type, code, ...args);
16+
};
17+
18+
const oclif = await import('@oclif/core');
19+
await oclif.execute({ development: false, dir: __dirname });
20+
} catch (error) {
21+
console.error('An error occurred while executing oclif:', error);
22+
}
623
})();

0 commit comments

Comments
 (0)