-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[feat] use Netlify internal functions directory for generated functions #2113
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
Changes from 2 commits
e228bbc
7ecb000
2bcbeb7
b730c54
bb5939d
b10fcb9
4fe2486
12e3766
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sveltejs/adapter-netlify': patch | ||
| --- | ||
|
|
||
| Deploy generated Netlify entrypoint to the internal functions directory. This allows it to co-exist with other Netlify functions. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,4 @@ yarn.lock | |
| .svelte-kit | ||
| .cloudflare | ||
| .pnpm-debug.log | ||
| .netlify | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,5 @@ | |
| node_modules | ||
| /.svelte | ||
| /build | ||
| /functions | ||
| /functions | ||
| /.netlify/functions* | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"type":"commonjs"} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,13 @@ | ||
| [build] | ||
| command = "npm run build" | ||
| publish = ".svelte-kit/netlify/build/" | ||
| functions = ".svelte-kit/netlify/functions/" | ||
|
|
||
| [build.environment] | ||
| NPM_FLAGS="--prefix=/dev/null" | ||
|
|
||
| [[plugins]] | ||
| package = "/.netlify/netlify-plugin-pnpm" | ||
|
|
||
| [dev] | ||
| # Disable svelte-kit dev so we can test functions | ||
ascorbic marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| framework = "#static" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,13 +27,12 @@ export default { | |
| }; | ||
| ``` | ||
|
|
||
| Then, make sure you have a [netlify.toml](https://docs.netlify.com/configure-builds/file-based-configuration) file in the project root. This will determine where to write static assets and functions to based on the `build.publish` and `build.functions` settings, as per this sample configuration: | ||
| Then, make sure you have a [netlify.toml](https://docs.netlify.com/configure-builds/file-based-configuration) file in the project root. This will determine where to write static assets and functions to based on the `build.publish` settings, as per this sample configuration: | ||
|
|
||
| ```toml | ||
| [build] | ||
| command = "npm run build" | ||
| publish = "build/publish/" | ||
| functions = "build/functions/" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if we can just remove this. Where will it put functions then? We put this here on purpose so that all output would show up under
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or at least if we're going to remove this line, should we also remove the Perhaps what we could do is maintain the old behavior and use the directories in these files if they are present and if they are not then we use the directory you're specifying as a default
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The functions will be in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If they user isn't using the Netlify CLI then presumably this won't be an issue anyway, as it wouldn't be using the Netlify preset when building locally as the auto-detection won't trigger it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Though I suppose the user could have manually specified the preset.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, thanks for clarifying and being patient as I come up-to-speed on Netlify stuff. I'm on board with your plan. Lets always output to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, so skip the CLI detection entirely?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would be the benefit of CLI detection? If we're not using the Netlify CLI, I'm assuming that any code
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct. I'll update the PR.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I've updated the PR as follows:
One thing I'd like to suggest for a follow-up PR is that |
||
| ``` | ||
|
|
||
| ## Netlify alternatives to SvelteKit functionality | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.