Documentation
¶
Overview ¶
Package deploy writes host-specific adapter files (redirects, config) into a built site so it can be dropped onto a static host without manual setup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ServerTargets = []string{"node", "vercel", "netlify", "cloudflare"}
ServerTargets run the portable server handler.
var Targets = []string{"netlify", "vercel", "cloudflare", "gh-pages", "docker", "node"}
Targets lists the supported deploy adapters.
Functions ¶
func Emit ¶
func Emit(target string, cfg *config.Config, root, outDir string, opts ...Options) ([]string, error)
Emit writes the adapter files for target and returns their paths. root is the project directory (vercel.json and the Docker files live there); outDir is the build output.
func ServerFeatures ¶
ServerFeatures lists the server-side features a built project uses. A static host serves none of them, so deploying such a project to a static target would publish pages whose dynamic parts silently do nothing.
Types ¶
type Options ¶
type Options struct {
// StaticOnly acknowledges that the project uses server features that a
// static target will not run, and deploys the static output anyway.
StaticOnly bool
// Server is the bundled portable server (build.BuildServerBundle). It is
// required for the node target and for platform targets of projects with
// server features (see WantsServer).
Server *ServerPlan
}
Options tunes Emit.
type ServerPlan ¶
type ServerPlan struct {
Target string
// Bundle is the absolute path of the generated entry.
Bundle string
// Exclude lists dist-relative slash paths that must not be published as
// static files (shells of request-time pages, dynamic templates): the
// bundle carries them.
Exclude []string
// ServerPaths are URL globs that must reach the function.
ServerPaths []string
HasMiddleware bool
// AssetExts lists the extensions (".js") of the public non-HTML files; on
// platforms that route pages through the function for middleware they are
// carved out so assets keep going straight to the CDN.
AssetExts []string
HasActions bool
HasAPI bool
// UsesRevalidate reports revalidatePath/revalidateTag calls in the sources.
UsesRevalidate bool
// SharedCache is true when krate.config sets a shared cache adapter.
ShutdownTimeout int
Port int
// Warnings are filled by Emit for the caller to print.
Warnings []string
}
ServerPlan describes a bundled portable server (build.BuildServerBundle) for the deploy adapters.