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: add support to per-function configuration files #1030
Conversation
⏱ Benchmark resultsComparing with b472a84 largeDepsEsbuild: 7.5s⬆️ 4.15% increase vs. b472a84
LegendlargeDepsNft: 36.9s⬆️ 3.83% increase vs. b472a84
LegendlargeDepsZisi: 55.3s⬆️ 3.96% increase vs. b472a84
|
@eduardoboucas What was the idea behind restricting this to certain directories instead of allowing it for every function? We did not want to expose this config support to user-generated functions? Also do you think that zisi is the right place for reading the config? The problem I have with it is that not all of the config is relevant for zisi, |
Yes, exactly! Once we get to ISC, I think we'll want to allow all types of functions to be configured that way, but until then I don't think it makes sense for user-generated functions to use this functionality. Asking people to write a per-function JSON feels incredibly unergonomic, and they'd be better off using
Note that zip-it-and-ship-it is the only package capable of resolving a functions config. Imagine this: [functions."next_*"]
node_bundler = "nft"
Personally, I don't think that passing to zip-it-and-ship-it a configuration property that it doesn't use or understand is that big of a problem, but I'm happy to discuss any alternative options you have in mind. |
c3f429c
to
dbb03b9
Compare
Other question: The Proposal only specifies Should we limit/restrict this? I personally don't see any downside of allowing all options, but I probably am missing something. Should we add validation of the config? We can also do that later, once we introduce non zisi config stuff. At least then it would make sense IMHO. |
I also don't see any obvious downsides of allowing all configuration properties. I think the proposal mentioned those two as examples of properties we have an identified use case for in the deploy configuration API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, left a few comments.
@eduardoboucas I cannot add you as reviewer, because you are the creator. would you mind looking over basically your own code once more, and comment if you notice something? |
Done! |
LGTM! |
Okay I consider this done. I'm not going to merge this yet, but will start to build the skip bundling based on this PR and then merge both together. |
* feat: add none bundler that does not bundle anything * chore: fix fixtures * Update src/runtimes/node/bundlers/none/index.ts Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com> * Update src/runtimes/node/bundlers/none/index.ts Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com> * chore: update snapshot Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>
BEGIN_COMMIT_OVERRIDE
feat: add support to per-function configuration files (#1030)
feat: new bundler that allows to skip bundling (#1173)
END_COMMIT_OVERRIDE
Summary
Adds support to per-function configuration files. These files are only taken into account if they are inside a directory that is part of the new
configFileDirectories
configuration property.Take the following project structure as an example:
If
configFileDirectories
contains.netlify/functions-internal
, theninternal-function-1
andinternal-function-2
will read configuration properties from.netlify/functions-internal/internal-function-1/internal-function-1.json
and.netlify/functions-internal/internal-function-2.json
, respectively.Even if there was a
netlify/functions/user-function-1.json
file, it would be ignored ifnetlify/functions
was not part ofconfigFileDirectories
.Any configuration properties loaded from a per-function configuration file take precedence over the global
config
object.A picture of a cute animal (not mandatory, but encouraged)