Skip to content

Commit

Permalink
fix: Supress experimental/deprecated warnings on startup
Browse files Browse the repository at this point in the history
Fixes #762
  • Loading branch information
Göran Sander committed Apr 9, 2024
1 parent c7e8f3b commit e2090a7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
run: |
pwd
./node_modules/.bin/esbuild src/bundle.js --bundle --external:axios --external:xdg-open --external:enigma.js --outfile=build.cjs --format=cjs --platform=node --target=node18 --minify
pkg --output "./${DIST_FILE_NAME}" -t node18-macos-x64 ./build.cjs --config package.json --compress GZip
pkg --output "./${DIST_FILE_NAME}" -t node18-macos-x64 ./build.cjs --config package.json --options no-deprecation --compress GZip
chmod +x "${DIST_FILE_NAME}"
security delete-keychain build.keychain || true
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
- name: Build binaries
run: |
./node_modules/.bin/esbuild src/bundle.js --bundle --external:axios --external:xdg-open --external:enigma.js --outfile=build.cjs --format=cjs --platform=node --target=node18 --minify
pkg --output "./${env:DIST_FILE_NAME}.exe" -t node18-win-x64 ./build.cjs --config package.json --compress GZip
pkg --output "./${env:DIST_FILE_NAME}.exe" -t node18-win-x64 ./build.cjs --config package.json --options no-deprecation --compress GZip
# # Extract signing certificate to files on disk
# New-Item -ItemType directory -Path certificate
Expand Down Expand Up @@ -330,7 +330,7 @@ jobs:
- name: Build binaries
run: |
./node_modules/.bin/esbuild src/bundle.js --bundle --external:axios --external:xdg-open --external:enigma.js --outfile=build.cjs --format=cjs --platform=node --target=node18 --minify
pkg --output "./${DIST_FILE_NAME}" -t node18-linux-x64 ./build.cjs --config package.json --compress GZip
pkg --output "./${DIST_FILE_NAME}" -t node18-linux-x64 ./build.cjs --config package.json--options no-deprecation --compress GZip
chmod +x ${DIST_FILE_NAME}
Expand Down
24 changes: 24 additions & 0 deletions src/butler-sos.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@ const telemetry = require('./lib/telemetry');
const promClient = require('./lib/prom-client');
const { verifyConfigFile } = require('./lib/config-file-verify');

// Suppress experimental warnings
// https://stackoverflow.com/questions/55778283/how-to-disable-warnings-when-node-is-launched-via-a-global-shell-script
const originalEmit = process.emit;
process.emit = function (name, data, ...args) {
// console.log(`Got a Node.js event: ${name}`);
// console.log(`Type of data: ${typeof data}`);
// if (typeof data === `object`) {
// console.log(`Data: ${JSON.stringify(data)}`);
// console.log(`Data name: ${data.name}`);
// console.log(`Data message: ${data.message}`);
// }
// console.log(`Args: ${args}`);

if (
name === `warning` &&
typeof data === `object` &&
data.name === `ExperimentalWarning` &&
data.message.includes(`Fetch API`)
) {
return false;
}
return originalEmit.apply(process, arguments);
};

globals.initInfluxDB();

if (
Expand Down

0 comments on commit e2090a7

Please sign in to comment.