A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.netlify.com/build/functions/deploy/ below:

Deploy functions | Netlify Docs

This page describes workflows for deploying your functions.

Select your function language:

The deployment preparation process includes both compiling and bundling your TypeScript function files into executable artifacts.

You can use continuous deployment, the Netlify CLI, or the Netlify API to deploy functions.

With continuous deployment, your functions are built if needed and deployed each time you push changes to your Git provider. You can rely on Netlify’s default automatic build process, use your own custom build process on Netlify, or build outside of Netlify.

Netlify can automatically detect and build your functions from their source files. This is the most common workflow.

To use this option, follow the TypeScript file naming instructions on the get started with functions page.

TypeScript and JavaScript together

If you include TypeScript and JavaScript functions with the same name, for example, my-function.ts and my-function.js, the TypeScript function is ignored while the JavaScript function is deployed. This allows you to handle TypeScript compilation in a custom build command, if preferred. Netlify then bundles and deploys the resulting JavaScript function.

If you want more control over the handling of your function source files, you can use your site’s build command to customize the build process.

Netlify runs your build command before accessing your functions directory to prepare and deploy your functions. This means you can use your build command to override any part of the default preparation process up until the point Netlify deploys executable artifacts.

Here are some examples of customizations you could make to the process:

If you want your custom build to bypass Netlify’s automated function and dependency preparation entirely, your build process needs to result in Node.js ZIP archives in your functions directory. Netlify will deploy these without modification.

To customize the build process, do one of the following:

tsc hello/function.ts --outfile netlify/functions/hello.js

This example customizes the TypeScript compilation stage.

npm run test:functions && npm run build

Where test:functions is a unit testing script configured in package.json. For more information, visit our Forums for a verified Support Guide on testing your Netlify builds.

For even more control over the handling of your function source files and dependencies, you can bundle ZIP archives outside of Netlify.

If you put your bundled ZIP archives in your functions directory before you push changes to your Git provider, Netlify will deploy these executable artifacts without modification.

Consider CLI deploys instead

It’s not a best practice to track bundling results in Git. So, if you want to bundle your own ZIP archives, we recommend you use CLI deploys instead of continuous deployment with Git.

Netlify CLI can upload files directly from your local project directory to your site on Netlify.

Common use cases for this workflow:

Prepare your function dependencies before you deploy with the CLI.

  1. Install your dependencies. This enables Netlify CLI to automatically zip dependencies with your functions for deployment.
  2. Follow the instructions on the CLI page to deploy your site including your functions.

TypeScript and JavaScript together

If you include TypeScript and JavaScript functions with the same name, for example, my-function.ts and my-function.js, the TypeScript function is ignored while the JavaScript function is deployed. This allows you to handle TypeScript compilation locally, if preferred. Netlify then bundles and deploys the resulting JavaScript function.

Netlify API can upload functions when you use the file digest method for manual deploys.

Common use cases for this workflow:

Prepare your functions before you deploy with the API.

  1. Zip each function with its dependencies.
  2. Follow the instructions on the API page to deploy your site including executable artifacts for Netlify Functions.

The deployment preparation process includes bundling your JavaScript function files into executable artifacts.

You can use continuous deployment, the Netlify CLI, or the Netlify API to deploy functions.

With continuous deployment, your functions are built if needed and deployed each time you push changes to your Git provider. You can rely on Netlify’s default automatic build process, use your own custom build process on Netlify, or build outside of Netlify.

Netlify can automatically detect and build your functions from their source files. This is the most common workflow.

To use this option, follow the JavaScript file naming instructions on the get started with functions page.

TypeScript and JavaScript together

If you include TypeScript and JavaScript functions with the same name, for example, my-function.ts and my-function.js, the TypeScript function is ignored while the JavaScript function is deployed. This allows you to handle TypeScript compilation in a custom build command, if preferred. Netlify then bundles and deploys the resulting JavaScript function.

If you want more control over the handling of your function source files, you can use your site’s build command to customize the build process.

Netlify runs your build command before accessing your functions directory to prepare and deploy your functions. This means you can use your build command to override any part of the default preparation process up until the point Netlify deploys executable artifacts.

Here are some examples of customizations you could make to the process:

If you want your custom build to bypass Netlify’s automated function and dependency preparation entirely, your build process needs to result in Node.js ZIP archives in your functions directory. Netlify will deploy these without modification.

To customize the build process, do one of the following:

rollup hello/function.js --file netlify/functions/hello.js --format cjs

This example uses Rollup to bundle a specific function.

npm run test:functions && npm run build

Where test:functions is a unit testing script configured in package.json. For more information, visit our Forums for a verified Support Guide on testing your Netlify builds.

For even more control over the handling of your function source files and dependencies, you can bundle ZIP archives outside of Netlify.

If you put your bundled ZIP archives in your functions directory before you push changes to your Git provider, Netlify will deploy these executable artifacts without modification.

Consider CLI deploys instead

It’s not a best practice to track bundling results in Git. So, if you want to bundle your own ZIP archives, we recommend you use CLI deploys instead of continuous deployment with Git.

Netlify CLI can upload files directly from your local project directory to your site on Netlify.

Common use cases for this workflow:

Prepare your function dependencies before you deploy with the CLI.

  1. Install your dependencies. This enables Netlify CLI to automatically zip dependencies with your functions for deployment.
  2. Follow the instructions on the CLI page to deploy your site including your functions.

TypeScript and JavaScript together

If you include TypeScript and JavaScript functions with the same name, for example, my-function.ts and my-function.js, the TypeScript function is ignored while the JavaScript function is deployed. This allows you to handle TypeScript compilation locally, if preferred. Netlify then bundles and deploys the resulting JavaScript function.

Netlify API can upload functions when you use the file digest method for manual deploys.

Common use cases for this workflow:

Prepare your functions before you deploy with the API.

  1. Zip each function with its dependencies.
  2. Follow the instructions on the API page to deploy your site including executable artifacts for Netlify Functions.

The deployment preparation process includes compiling your Go function files into executable artifacts.

You can use continuous deployment, the Netlify CLI, or the Netlify API to deploy functions.

With continuous deployment, your functions are built if needed and deployed each time you push changes to your Git provider. You can rely on Netlify’s default automatic build process, use your own custom build process on Netlify, or build outside of Netlify.

Netlify can automatically detect and build your functions from their source files. This is the most common workflow.

To use this option, follow the Go file naming instructions on the Lambda compatibility for Functions page.

If you want more control over the handling of your function source files, you can use your site’s build command to customize the build process.

Netlify runs your build command before accessing your functions directory to prepare and deploy your functions. This means you can use your build command to override any part of the default preparation process up until the point Netlify deploys executable artifacts.

Here are some examples of customizations you could make to the process:

If you want your custom build to bypass Netlify’s automated function preparation entirely, your build process needs to result in binaries compiled for the linux operating system and amd64 architecture in your functions directory. Netlify will deploy these without modification.

You can customize go build in one of the following ways.

GOOS=linux GOARCH=amd64 go build -o netlify/functions/hello ./hello/function.go && GOOS=linux GOARCH=amd64 go build -o netlify/functions/goodbye ./goodbye/function.go

This example builds source files saved in multiple different directories into compiled binaries in the functions directory for deployment.

npm run build && npm run build:function

This example invokes a script stored in package.json. Visit the example repository to explore the full example.

For even more control over the handling of your function source files, you can compile binaries outside of Netlify. The binaries must be compiled for the linux operating system and amd64 architecture. Use the Go compilation environment variables GOOS and GOARCH to set the compiler targets:

GOOS=linux GOARCH=amd64 go build

If you put your compiled binaries in your functions directory before you push changes to your Git provider, Netlify will deploy these executable artifacts without modification.

Consider CLI deploys instead

It’s not a best practice to track compilation results in Git. So, if you want to compile your own binaries, we recommend you use CLI deploys instead of continuous deployment with Git.

Netlify CLI can upload files directly from your local project directory to your site on Netlify.

Common use cases for this workflow:

Prepare your functions before you deploy with the CLI.

  1. Compile your Go functions to binaries for the linux operating system and amd64 architecture in your functions directory.

GOOS=linux GOARCH=amd64 go build

  1. Follow the instructions on the CLI page to deploy your site including executable artifacts for Netlify Functions.

Netlify API can upload functions when you use the file digest method for manual deploys.

Common use cases for this workflow:

Prepare your functions before you deploy with the API.

  1. Compile your Go functions to binaries for the linux operating system and amd64 architecture in your functions directory.

GOOS=linux GOARCH=amd64 go build

  1. Follow the instructions on the API page to deploy your site including executable artifacts for Netlify Functions.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4