-
Notifications
You must be signed in to change notification settings - Fork 53
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
refactor(react-query): improve cli utils #1383
Conversation
People can be co-author:
|
🦋 Changeset detectedLatest commit: 06aa4c0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: 0 B Total Size: 69 kB ℹ️ View Unchanged
|
CodSpeed Performance ReportMerging #1383 will create unknown performance changesComparing Summary
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1383 +/- ##
==========================================
+ Coverage 73.86% 75.81% +1.95%
==========================================
Files 69 69
Lines 593 583 -10
Branches 134 128 -6
==========================================
+ Hits 438 442 +4
+ Misses 144 130 -14
Partials 11 11
|
@@ -10,7 +10,7 @@ export function copy(version: number) { | |||
return false | |||
} | |||
|
|||
files.forEach((file) => { | |||
for (const file of files) { |
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.
This may not have a significant impact on our project, but I agree with the intent and would like to follow it.
ref: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-for-each.md
try { | ||
// eslint-disable-next-line @typescript-eslint/no-require-imports | ||
return { exports: require(name) as T, isSuccess: true } | ||
return require(name) as T | ||
} catch { | ||
return { exports: undefined, isSuccess: false } | ||
throw new Error(`${name} is not found.`) | ||
} | ||
} |
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.
Previously, loadModule did not throw errors directly but instead followed a structure where the CLI (node) would terminate at the point where the function was used. However, this approach made testing difficult, as mocking require in Node.js is not possible. For this reason, we decided to modify the utils function to throw errors directly, as it allows for more reliable testing.
P.S. Once this PR is merged, I plan to implement a global error handler for the CLI and custom error classes in the next version.
ref: https://github.com/tj/commander.js?tab=readme-ov-file#override-exit-and-output-handling
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.
Sorry for late review! Thanks👍
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @suspensive/[email protected] ### Patch Changes - [#1383](#1383) [`2c06c84`](2c06c84) Thanks [@gwansikk](https://github.com/gwansikk)! - refactor(react-query): improve cli utils - Updated dependencies \[]: - @suspensive/[email protected] - @suspensive/[email protected] - @suspensive/[email protected] ## @suspensive/[email protected] ### Patch Changes - Updated dependencies \[]: - @suspensive/[email protected] ## @suspensive/[email protected] ### Patch Changes - Updated dependencies \[]: - @suspensive/[email protected] ## @suspensive/[email protected] ## @suspensive/[email protected]
# Overview related: #1383 (comment) - add error handler in commander.js - add logger utils (for consistency) ref: https://github.com/tj/commander.js?tab=readme-ov-file#override-exit-and-output-handling ## PR Checklist - [x] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 2. I added documents and tests. --------- Co-authored-by: Jonghyeon Ko <[email protected]>
Overview
closed: #1292
PR Checklist