-
Notifications
You must be signed in to change notification settings - Fork 63
Conversation
Storybook and Tailwind configuration previews: Ready Storybook: https://wordpress.github.io/openverse-frontend/_preview/2109 Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again. You can check the GitHub pages deployment action list to see the current status of the deployments. |
Size Change: -1.56 kB (0%) Total Size: 902 kB
ℹ️ View Unchanged
|
src/modules/prometheus.ts
Outdated
}) as unknown as ServerMiddleware | ||
|
||
const PrometheusModule: Module = function () { | ||
// Nuxt types don't fully type `this` parameter, this.nuxt is 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.
FWIW you can use this feature (no pun intended) to type this
.
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 saw the example of typing this
in the Nuxt's Module type:
https://github.com/nuxt/nuxt/blob/853439ddf945b6ee358d5912e6e5a68009633c27/packages/types/config/module.d.ts#L29
But the this.nuxt
's type there is any
:( . I am not sure it's worth the effort to add the type (and search for what exactly needs to be added) since the modules will need to be refactored for Nuxt 3.
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.
Gotcha. FWIW when I remove the @ts-ignore
locally I don't get any errors when I run pnpm types
, but maybe my local environment isn't configured correctly?
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.
You're right, it must have been WebStorm complaining for me. I removed the @ts-ignore
comments, and added type to app
parameter from the nuxt/types
repository hooks module (ConnectServer
)
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 looks great to me, Olga. Do you mind if we did it as a separate PR? Otherwise, it's hard to evaluate the differences in the code in the first PR that addresses the underlying issue. I'm happy to take this code reorganisation on as a separate task after the first PR is merged though, if you'd like (or review and approve this PR quickly 🙂)
I am happy with any way that you feel is best, @sarayourfriend ! We can merge your PR as is. |
260a950
to
f619a7f
Compare
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!
src/modules/prometheus.ts
Outdated
}) as unknown as ServerMiddleware | ||
|
||
const PrometheusModule: Module = function () { | ||
// Nuxt types don't fully type `this` parameter, this.nuxt is 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.
Gotcha. FWIW when I remove the @ts-ignore
locally I don't get any errors when I run pnpm types
, but maybe my local environment isn't configured correctly?
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. Appreciate the effort towards keeping the nuxt.config.ts
file manageable.
e57c7c4
to
919c462
Compare
Description
This PR is a suggested implementation of extracting the Prometheus setup from
nuxt.config
into a separate Nuxt module. I think it will be easier to have Prometheus set up as a separate module when moving from Nuxt 2 to Nuxt 3 because it will not affect thenuxt.config
changes anymore, and typing the modules should become easier with Nuxt3.