-
-
Notifications
You must be signed in to change notification settings - Fork 62
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: add types for storage handler #307
Conversation
Codecov Report
@@ Coverage Diff @@
## master #307 +/- ##
==========================================
- Coverage 65.45% 65.42% -0.03%
==========================================
Files 26 26
Lines 1401 1400 -1
Branches 201 204 +3
==========================================
- Hits 917 916 -1
+ Misses 482 481 -1
- Partials 2 3 +1
Continue to review full report at Codecov.
|
it removes return data from deletePackage is not required
type StorageUpdateHandler = (name: string, cb: StorageUpdateCallback) => void; | ||
type StorageWriteCallback = (name: string, json: Package, callback: Callback) => void; | ||
type PackageTransformer = (pkg: Package) => Package; | ||
type ReadPackageCallback = (err: any | null, data?: Package) => void; |
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.
err: any | null
how about err: Error | null
?
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.
Verdccio core not use Error
, it uses VerdaccioError
which are http status codes, the problem is these types are in @verdaccio/common-api
and include them here would create a circle dependency. I added a comment in that file so in the future we can find a better solution, for now it must be any
.
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.
Plugins must return errors defined in @verdaccio/common-api
, there are a complete library of methods ready to use, this will be documented in future blog posts.
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.
monorepo/core/types/index.d.ts
Lines 385 to 386 in f0887bd
// FIXME: error should be export type `VerdaccioError = HttpError & { code: number };` | |
// but this type is on @verdaccio/commons-api and cannot be used here yet |
This one, I see !!!
will it break if you can move that here and use this package in common-api
? for types ?
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.
No, but @verdaccio/types
must be free of dependencies, and VerdaccioError
has one from http-status
... I think we must create a custom type and get rid of http-status
in the future, so then, that would not be a problem anymore.
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.
I think we must create a custom type and get rid of http-status in the future, so then, that would not be a problem anymore.
Yup this one is better solution I think
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.
🙃 so ... can I merge?
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.
sure 😀
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.
🚀
Type: fix
Scope: types
Description:
Improve and fix types for
ILocalPackageManager
verdaccio/generator-verdaccio-plugin#18