Skip to content

Commit

Permalink
Hide non actionable ts-node warning (#2123)
Browse files Browse the repository at this point in the history
* Hide warning about not finding ts-node

* Changesets
  • Loading branch information
frandiox committed May 17, 2024
1 parent 1f578a3 commit ca4cf04
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-grapes-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-hydrogen': patch
---

Hide non actionable warning about ts-node.
20 changes: 20 additions & 0 deletions packages/cli/src/lib/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,26 @@ export function muteDevLogs({workerReload}: {workerReload?: boolean} = {}) {
(params) => params,
],
);

// TODO: Remove this when this warning is fixed in @shopify/cli
// This is printed using the `debug` package, which prints to stderr.
const processStderrWrite = process.stderr.write;
const timeout = setTimeout(() => {
process.stderr.write = processStderrWrite;
}, 5000);
process.stderr.write = (...args) => {
if (
typeof args[0] === 'string' &&
args[0].includes('Could not find ts-node')
) {
clearTimeout(timeout);
process.stderr.write = processStderrWrite;
return false;
}

// @ts-ignore
return processStderrWrite.apply(process.stderr, args);
};
}

const originalWrite = process.stdout.write;
Expand Down

0 comments on commit ca4cf04

Please sign in to comment.