clients/js: suppress lib warnings
This commit is contained in:
parent
dfe4baf1b1
commit
2734600234
|
@ -1,24 +1,9 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
// <sigh>
|
||||
// when the native secp256k1 is missing, the eccrypto library decides TO PRINT A MESSAGE TO STDOUT:
|
||||
// https://github.com/bitchan/eccrypto/blob/a4f4a5f85ef5aa1776dfa1b7801cad808264a19c/index.js#L23
|
||||
//
|
||||
// do you use a CLI tool that depends on that library and try to pipe the output
|
||||
// of the tool into another? tough luck
|
||||
//
|
||||
// for lack of a better way to stop this, we patch the console.info function to
|
||||
// drop that particular message...
|
||||
// </sigh>
|
||||
const infoTemp = console.info;
|
||||
console.info = function (x: string) {
|
||||
if (x != "secp256k1 unavailable, reverting to browser version") {
|
||||
infoTemp(x);
|
||||
}
|
||||
};
|
||||
|
||||
import yargs from "yargs";
|
||||
import { hideBin } from "yargs/helpers";
|
||||
// Quiet is here so that it can trigger before the afflicted libraries' on-import warnings can be emitted.
|
||||
// It is also imported so that it can side-effect without being tree-shaken.
|
||||
import "./quiet";
|
||||
// https://github.com/yargs/yargs/blob/main/docs/advanced.md#example-command-hierarchy-using-indexmjs
|
||||
import * as aptos from "./cmds/aptos";
|
||||
import * as chainId from "./cmds/chainId";
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// <sigh>
|
||||
// when the native secp256k1 is missing, the eccrypto library decides TO PRINT A MESSAGE TO STDOUT:
|
||||
// https://github.com/bitchan/eccrypto/blob/a4f4a5f85ef5aa1776dfa1b7801cad808264a19c/index.js#L23
|
||||
//
|
||||
// do you use a CLI tool that depends on that library and try to pipe the output
|
||||
// of the tool into another? tough luck
|
||||
//
|
||||
// for lack of a better way to stop this, we patch the console.info function to
|
||||
// drop that particular message...
|
||||
// </sigh>
|
||||
const info = console.info;
|
||||
console.info = function (x: string) {
|
||||
if (x !== "secp256k1 unavailable, reverting to browser version") {
|
||||
info(x);
|
||||
}
|
||||
};
|
||||
const warn = console.warn;
|
||||
console.warn = function (x: string) {
|
||||
if (
|
||||
x !==
|
||||
"bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)"
|
||||
) {
|
||||
warn(x);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue