-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: layer meta and source options #62
Conversation
Side note: For framework consumers, we can use this meta to show beautiful banners (ie: nuxi cli) |
Codecov Report
@@ Coverage Diff @@
## main #62 +/- ##
==========================================
+ Coverage 87.20% 87.27% +0.06%
==========================================
Files 3 3
Lines 469 503 +34
Branches 60 65 +5
==========================================
+ Hits 409 439 +30
- Misses 60 64 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Actually I would prefer to only support a Each source should specify the I don't see an usage of overwriting the meta honestly. The only usage I could see is to overwrite the layer config, but IMO it can be done by adding another layer after it: {
extends: [
'./base-layer.ts',
'./my-overwrite.ts'
]
} |
Sources define meta overwrite support is particularly useful for multi-apps when we want to configure an app layer or toggle its features. (config for a specifc layer only not the merged result). Also extending some layers, needs more than just a source string. Like a token for cloning them (and we don't want a merged token! Each layer might need it's token) For nuxt modules, it is comparable to module defaults and user options for module (meta, despite it's name is both static meta and layer-source configuration) |
I do believe we need to split this PR into two:
|
Regarding multi apps, I would like to better understand the idea.
I would like to see an example, because the meta data !== that overwriting the config options. Except if you are thinking of a Or we should define what metadata have a special purpose into Nuxt. Always best to think is to imagine an example for Nuxt: export default defineNuxtConfig({
extends: [
'./ui', // global layer for all apps
['./admin', { baseURL: '/admin/' }] // only for /admin/ ?
]
}) It is still not clear how to bring micro-frontend to Nuxt right now, would love to discuss with an RFC first because it is a big subject. I do believe the Source options, I would like to see when it is required or how we can improve. Multi apps: can we write a readme on how to create them in Nuxt? |
Thanks for the reviews @atinux. So far, what C12 will provide are very basic and non-opinionated building blocks for conf layer meta and source options.
Re Nuxt, we definitely need to explore how we imagine Multi-App support and also use extends meta. Allowed types and behavior is finally defined at Framework level. But all functionalities in c12 is essentially the first step to explore those ideas. I am happy to deprecate some options from c12 if finally there was no usage or introducing (unpreventable) anti-patterns. Let's continue discussion about Nuxt together with @danielroe in next steps :) |
A New
$meta
config is supported for each configuration. This is mainly useful in conjunction with extended layers which can provide their metadata (such as name, version, etc).Secondly, when extending a layer, users can provide custom source options
{ source: 'extend-source', options: {} }
orsource: ['extend-source, { ...options }]
. This is useful for defining options when extending a layer. Passing options such as cloning tokens.It is possible to override layer config and meta also using
opts.overrides
andopts.meta
but it is probably for specific cases, such as multi-app support when we need to override a layer. we might not advocate this in general to users but gives an escape hatch to configure a layer meta itself by the consumer.