build

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildCmd = &cobra.Command{
	Use:   "build [flags] [site-directory]",
	Short: "Run a build and post it to hyphen",
	Long: `
The build command runs a build and uploads it to hyphen without deploying.

Usage:
	hyphen build [flags] [site-directory]

Examples:
hyphen build
hyphen build --type static ./dist

--type defaults to docker. Static builds require a final directory argument
containing an already-built website. Files are gzipped, uploaded directly with
a short-lived SiteRegistry token, finalized, and registered as a static build.

Use 'hyphen build --help' for more information about available flags.
`,
	Args: func(cmd *cobra.Command, args []string) error {
		if err := cobra.RangeArgs(0, 1)(cmd, args); err != nil {
			return err
		}
		directory := ""
		if len(args) == 1 {
			directory = args[0]
		}
		return build.ValidateInput(buildType, directory, flags.DockerfileFlag)
	},
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		return user.ErrorIfNotAuthenticated()
	},
	RunE: func(cmd *cobra.Command, args []string) error {
		printer = cprint.NewCPrinter(flags.VerboseFlag)
		printer.SetFormat(outputFormatFlag)

		result, runErr := runBuild(cmd, args)
		if runErr != nil {
			if printer.IsJSON() {
				emitFailure(printer, map[string]any{}, runErr)

				cmd.SilenceErrors = true
				cmd.SilenceUsage = true
			}
			return runErr
		}

		return printer.Emit(result)
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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