build
build copied to clipboard
Shareable configurations
We could allow configurations to be shareable like ESLint does.
This could be as simple as adding an extends property that points to either a Node.js module name, or to a file path. The shared configuration would be deeply merged, with lower merging priority.
We could also have naming conventions such as netlify-build-config-*. And npm tags and GitHub tags netlify and netlify-build-config.
What do you think?
related https://github.com/netlify/build/issues/18
Not sure I follow. How does this materialize? A extends key on a plugin declarations in netlify.yml|toml?
Yes for example, let's say there's a Node.js module named my-shared-netlify-config that exports the following netlify.json:
{
"build": {
"lifecycle": {
"init": "echo init",
"build": "echo this does not have priority"
}
}
}
Then the following netlify.yml:
extends: my-shared-netlify-config
build:
lifecycle:
getCache: echo getCache
build: echo this has priority
Would resolve to:
build:
lifecycle:
init: echo init
getCache: echo getCache
build: echo this has priority
I see. This would make reading the build instructions more difficult (unless you understood what extend does under the hood and where it resolves from)
For now we should keep this as simple and explicit as possible.
It's possible for users to achieve this functionality in userland via yml extend << and other variables.
Lets hold off on this for now until we see feature requests on this
It's possible for users to achieve this functionality in userland via yml extend << and other variables.
<< only allows merging within the same file, not merging other files or importing Node.js modules.
This would make reading the build instructions more difficult (unless you understood what extend does under the hood and where it resolves from)
This would be done by @netlify/config during configuration loading. Since we are supporting several file formats, anyone who wants to operate on configuration objects has to use that configuration loading function anyway. Unless you meant something else by "reading the build instructions"?
Lets hold off on this for now until we see feature requests on this
I think this should be straightforward to implement (just need to make a require() call and use a deep-merge library) but we can hold off on this if you think this might not be needed. :+1:

Let's hold off on this for right now. I will show you how it's possible in userland
We need this for plugin presets: #370.
Mentioned in https://github.com/f22hd/netlify-plugin-nx-skip-build/issues/1#issuecomment-953186352
This issue has been automatically marked as stale because it has not had activity in 1 year. It will be closed in 14 days if no further activity occurs. Thanks!
This issue was closed because it had no activity for over 1 year.