Option to create own context
nnaydenow opened this issue · 4 comments
Currently, you can only use --dev
flag to set dev context. Please provide option to set custom defined context like test or anything else.
Can you elaborate on how exactly you'd like to use this feature and what you're trying to achieve?
Hi @thepassle,
Currently in the browser usage version you can change the context from dev to non dev using the boolean flag. In the cli you can also use the ---dev flag which will change the context. I have my own custom plugin where I have 3 contexts - public (used by users) / internal (with additional information to fulfil automatically generation of our documentation) / dev (using extra logs provided by you and some additional linters added by us that validates the custom element documentation to our case). I want to be able create my own context so I can read and use in the plugins using the context object inside hooks.
It's still not entirely clear to me what is preventing you from doing that, especially if you're using the analyzer programmatically, you can just pass in your own context:
https://github.com/open-wc/custom-elements-manifest/blob/a61e373ffcadd2632119c0f396150da2437d61bd/packages/analyzer/src/create.js#L11C1-L12C1
e.g.:
create({modules, context: {dev: false, foo: 'bar'}});
I'm trying to do this with the cli API. Seems like I need to to a little restructuring and I'll be able to achieve what I'm trying. Thanks!