deploy

package
v0.5.0-beta.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

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

View Source
var ServerTargets = []string{"node", "vercel", "netlify", "cloudflare"}

ServerTargets run the portable server handler.

View Source
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

func ServerFeatures(root, outDir string) []string

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.

func WantsServer

func WantsServer(target string, features []string, staticOnly bool) bool

WantsServer reports whether a deploy to target must bundle the server: the node target always, the platform targets when the project has server features (and --static-only was not given).

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.
	SharedCache     bool
	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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL