Skip to content

Commit

Permalink
🤫 Quiet warning about punycode (#1485)
Browse files Browse the repository at this point in the history
Fixes #1166
  • Loading branch information
rowanc1 authored Aug 22, 2024
1 parent 5ac2d0b commit 64e1191
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/nasty-suits-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"myst-cli": patch
"mystmd": patch
---

Suppress punycode deprecation warning
2 changes: 2 additions & 0 deletions packages/myst-cli/src/build/site/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export function createServerLogger(session: ISession, ready: () => void): Logger
// This is a spurious Remix warning https://github.com/remix-run/remix/issues/2677
if (line.includes('is not listed in your package.json dependencies')) return;
if (line.includes('was not found in your node_modules')) return;
// This is the punycode deprecation warning
if (line.includes('--trace-deprecation') || line.includes('DEP0040')) return;
if (line.startsWith('Rebuilding')) {
session.log.debug(line);
return;
Expand Down
12 changes: 12 additions & 0 deletions packages/mystmd/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#!/usr/bin/env node
import 'core-js/actual'; // This adds backwards compatible functionality for various CLIs

// This suppresses the punycode deprecation warning
// https://github.com/jupyter-book/mystmd/issues/1166
const { emit: originalEmit } = process;
function suppressor(event: string, error: Error) {
return event === 'warning' && error.name === 'DeprecationWarning'
? false
: // eslint-disable-next-line prefer-rest-params
originalEmit.apply(process, arguments);
}
(process as any).emit = suppressor;

import { Command } from 'commander';
import version from './version.js';
import { makeBuildCLI } from './build.js';
Expand Down

0 comments on commit 64e1191

Please sign in to comment.