-
Notifications
You must be signed in to change notification settings - Fork 79
feat!: use netlify/functions as the default functions directory #2188
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
Merged
Parent:
Create webpack.yml
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fca4286
feat!: use netlify/functions as the default functions directory
eduardoboucas 0add8d9
chore: fix tests in Node 8
eduardoboucas 0c99646
chore: clean up tests
eduardoboucas 022cbef
Merge branch 'master' into feat/new-functions-directory
eduardoboucas 5554f9d
feat: add backward-compatibility for netlify-automatic-functions dire…
eduardoboucas ad918ae
Merge branch 'master' into feat/new-functions-directory
eduardoboucas a68da83
Merge branch 'master' into feat/new-functions-directory
eduardoboucas 8b2dd8e
chore: update test snapshots
eduardoboucas c8c403c
chore: update netlify-automatic-functions warning message
eduardoboucas 388758e
Merge branch 'master' into feat/new-functions-directory
eduardoboucas 0db710d
chore: update test snapshots
eduardoboucas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
packages/build/tests/plugins/fixtures/functions_src_default_and_legacy/manifest.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| name: test | ||
| inputs: [] |
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
packages/build/tests/plugins/fixtures/functions_src_default_and_legacy/netlify.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [[plugins]] | ||
| package = "./plugin" |
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
packages/build/tests/plugins/fixtures/functions_src_default_and_legacy/plugin.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| 'use strict' | ||
|
|
||
| module.exports = { | ||
| onPreBuild({ constants: { FUNCTIONS_SRC } }) { | ||
| console.log(FUNCTIONS_SRC) | ||
| }, | ||
| } |
5 changes: 4 additions & 1 deletion
5
packages/build/tests/plugins/fixtures/functions_src_dynamic/plugin.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
packages/build/tests/plugins/fixtures/functions_src_dynamic_bundle/plugin.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,16 @@ | ||
| 'use strict' | ||
|
|
||
| const { mkdir } = require('fs') | ||
| const { dirname } = require('path') | ||
| const { promisify } = require('util') | ||
|
|
||
| const pMkdir = promisify(mkdir) | ||
|
|
||
| const DEFAULT_FUNCTIONS_SRC = 'netlify-automatic-functions' | ||
| const DEFAULT_FUNCTIONS_SRC = 'netlify/functions' | ||
|
|
||
| module.exports = { | ||
| async onPreBuild() { | ||
| await pMkdir(dirname(DEFAULT_FUNCTIONS_SRC)) | ||
| await pMkdir(DEFAULT_FUNCTIONS_SRC) | ||
| }, | ||
| } |
4 changes: 3 additions & 1 deletion
4
packages/build/tests/plugins/fixtures/functions_src_dynamic_ignore/plugin.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/build/tests/plugins/fixtures/functions_src_legacy/manifest.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| name: test | ||
| inputs: [] |
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
packages/build/tests/plugins/fixtures/functions_src_legacy/netlify.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [[plugins]] | ||
| package = "./plugin" |
7 changes: 7 additions & 0 deletions
7
packages/build/tests/plugins/fixtures/functions_src_legacy/plugin.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| 'use strict' | ||
|
|
||
| module.exports = { | ||
| onPreBuild({ constants: { FUNCTIONS_SRC } }) { | ||
| console.log(FUNCTIONS_SRC) | ||
| }, | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Theoretically there's nothing stopping people from explicitcly defining
netlify-automatic-functionsin the config as being their functions directory, in which case this warning should not be printed. However, to achieve this we would need to move this logic to@netlify/config, because at this point we don't know whetherfunctionswas added by the user or by us.@ehmicky do you have an opinion on this?
Uh oh!
There was an error while loading. Please reload this page.
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.
We ran some logs few weeks ago which confirmed that virtually no one was using
netlify-automatic-functionssince we have not documented it.The main risk here is for users of
@netlify/plugin-nextjswho installed it in theirpackage.json. Those users will not know aboutnetlify-automatic-functionssince this is done under the hood. Instead, the way to fix this error would be for them to upgrade@netlify/plugin-nextjs(after we've released the new versions usingnetlify/functions).I think this warning message is still safe to keep, but we might not need to move it to
@netlify/config.On the other hand, we might want to create an issue/PR to print a warning message in
@netlify/buildwhen a build is using the old version of@netlify/plugin-nextjs. What do you think?