Skip to content
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

Improve the whook create command #162

Open
nfroidure opened this issue Aug 18, 2023 · 0 comments
Open

Improve the whook create command #162

nfroidure opened this issue Aug 18, 2023 · 0 comments

Comments

@nfroidure
Copy link
Owner

nfroidure commented Aug 18, 2023

There is a clear pattern here:

API_DEFINITIONS: 'DelayService',
ENV: 'ENVService',
APM: 'APMService',
APP_CONFIG: 'AppConfig',
};
const allTypes = {
...commonServicesTypes,
...whookSimpleTypes,

We should be able to load all services types from the WHOOK_PLUGINS to help creating handlers smoothly.

It would be easy to get all services names by getting key of Knifecycle initializersStates property but getting the types is a bit more tricky :

  • for constants : get the literal value type (but branded types won't be possible)
  • for services : read the initializer path and find types the initializer return of use type names endind with Service

A temporary solution can be to put any/unknown as the type and let the dev import it since it woul be nice step to just be able to list the services in the CLI selector.

Another option could be to require whook plugins (but more generally any Knifecycle module) to export the list of services they embed with their name/type/path mappings to retrieve something like that:
https://github.com/nfroidure/whook/blob/2126f07fea694dc7963e79dd91056e57eaec52bd/packages/whook/src/commands/create.ts#L26C1-L37C3

@nfroidure nfroidure self-assigned this Aug 18, 2023
@nfroidure nfroidure changed the title Improve the whook create commande Improve the whook create command Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant