Replies: 1 comment 1 reply
-
Great ideas, I will provide some feedback on each one:
I'd be veery much in favour of this, but should point out that there are some other DHIS2 specific aspects to the current implementation apart from the default static resources:
On balance, I still think this is a good idea, but we need to consider the additional work and discuss it with @varl. Apart from the time it will take to extract a generic implementation from the current implementation and let the
I agree the way the types have been declared in the code is pretty quirky and should be improved. My personal preference would be to not use classes for this but to add TypeScript Type Declaration files, see here. I don't have experience with this type of thing, but it seems to be a good solution here. One thing we should consider as well, is our generated documentation. It's probably possible to generate docs from these
Yeah, this would be good. Additionally, we need a "debug-mode" in the package, probably this should be some command in the example-app. It needs to do the following:
The reason we need this, is because:
The above is needed, and when using the |
Beta Was this translation helpful? Give feedback.
-
I was just reading through the network shim's code to get a better understading of its inner workings so I can review dhis2/cli-utils-cypress#176 properly.
After having read through the code, I like the way it's designed. It's quite straight forward and wouldn't change that at all.
I'm wondering about a few things though:
1. Open source, dhis2-agnostic network shim library
To me it'd make a lot of sense to create a standalone repository for the network shim, as it's quite dhis2 agnostic (except for the list of default static resources, which could be extracted). That way we expose the functionality to others out there as well (true open source, yay). I think it could be quite a useful resource to other cypress users out there, but if it remains in our cypress package, no one will find and/or use it.
2. Provide types or classes that are used in both the commands as well as the plugin code through a separate package to both packages
The types are defined in the createState.js. This makes it quite hard to have access to these, especially in the commands package. I have to fall back to the createState file of the plugins package while reading the code to know what is what.
I'm wondering how we could improve that without too much effort. One way we could improve it is with simple classes instead of type definitions (
NetworkShimState
,NetworkShimConfig
,RequestStub
), then reading the code inside the commands package is a bit more clear, e. g:This would
3. Use
debug
moduleIf we used the
debug
module, we could log the various steps while using the network shim inside an app, would be quite nice to see if everything is working as expected or notcc @HendrikThePendric
Beta Was this translation helpful? Give feedback.
All reactions