-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cli-hooks): silence node warnings that can break @slack/cli-hooks #2096
Conversation
@@ -42,7 +42,7 @@ export function DefaultProtocol(args) { | |||
// If the particular hook invocation is requesting manifest generation we | |||
// ensure any logging is a no-op to prevent littering stdout with logging | |||
// and confusing the CLI's manifest JSON payload parsing. | |||
const loggerMethod = manifestOnly ? () => { } : console.log; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linter auto-pilot
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2096 +/- ##
=======================================
Coverage 91.65% 91.66%
=======================================
Files 38 38
Lines 10311 10313 +2
Branches 647 647
=======================================
+ Hits 9451 9453 +2
Misses 848 848
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and thanks for updating the README
too! 📚
We can merge this whenever, but I'm hoping we can instead separate stdout
and stderr
as part of the default hook protocol on the CLI side of things 👀 IMO debug printing possible warnings would be more ideal for finding odd configurations or other errors that might cause later problems with hooks.
That shouldn't block this, but I'm thinking we can revert these changes if that lands while these warnings are only appearing in unsupported Node versions?
I'm also wondering if we improve testing in later PRs to exercise the hooks in multiple versions of multiple runtimes 😉
'get-manifest': 'npx -q --no-install -p @slack/cli-hooks slack-cli-get-manifest', | ||
doctor: 'NODE_NO_WARNINGS=1 npx -q --no-install -p @slack/cli-hooks slack-cli-doctor', | ||
'check-update': 'NODE_NO_WARNINGS=1 npx -q --no-install -p @slack/cli-hooks slack-cli-check-update', | ||
'get-manifest': 'NODE_NO_WARNINGS=1 npx -q --no-install -p @slack/cli-hooks slack-cli-get-manifest', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 Nice find! I hadn't noticed these warnings in the versions we officially support - 18
, 20
, 22
for now - but think this is a nice and quick guard for those on the cutting edge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'm honestly a little confused around why the warnings are happening only 23
. A long time ago, node used odd majors as "experimental" releases and even majors as "stable" releases, but I thought they stopped that pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Node release schedule is so interesting to me!
I believe odd versions are treated as a "current" release and act as an upgrading version to the next even version. These odd versions never get long term support 😅
We might want to discuss testing with the latest current version across the SDKs to make sure bumping to the next current LTS goes smooth.
Supporting that version IMO is another question 🤔
I'm also very much in favour of updating the Slack CLI to separate It would be nice to have a future where all I also share the concern that meaningful warnings could be suppressed. For example, I think
I'm in favour of reverting this once we improve the CLI as well!
We should. I imagine the hooks package should support the same node versions that the Slack SDK and Bolt Frameworks support? |
Wow! Mirroring
I'm hoping to start a PR that separates these outputs soon! I hadn't thought about the
Right now I think we're testing these versions alright, but I don't think we test that an actual This might also not be a problem after hook enhancements! I left another comment about testing (not necessarily supporting) the current Node version to make upgrades to the next LTS a bit easier, but that might be discussion for future changes! 🤔 This does seem good to merge as is though! Please of course feel free to tag a release too if you'd like. Or let me know if that's a tag I can make. I still plan to follow up with reversions and revisions in the CLI, but let's not block improvement here 💪 |
Summary
This pull request updates the
@slack/cli-hooks
to silence the node process warning output.The reason for this update is that warnings can break some hooks, such as
get-manifest
, because the output must be valid JSON and the warning message is plain-text. For other hooks, such asdoctor
the warning is displayed to the user when the CLI command is executed, which can be confusing. I've left the warning forstart
because the user's code may need to print warning messages to the console.Example of a node warning message
This is an example using node v23.2.0:
Expected
get-hooks
JSONReviewers
Requirements (place an
x
in each[ ]
)