node

package
v0.395.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FUNCTIONS_DIR   = "functions"
	AUTH_HOOKS_DIR  = "functions/auth"
	JOBS_DIR        = "jobs"
	SUBSCRIBERS_DIR = "subscribers"
)

Variables

This section is empty.

Functions

func Bootstrap

func Bootstrap(dir string, opts ...BootstrapOption) error

Bootstrap ensures that the target directory has a package.json file with the correct dependencies required by the Keel Custom Functions runtime, and additionally it ensures that a tsconfig.json file has been generated

func CheckNodeVersion

func CheckNodeVersion() error

func Generate

func Generate(ctx context.Context, schema *proto.Schema, cfg *config.ProjectConfig, opts ...func(o *generateOptions)) (codegen.GeneratedFiles, error)

Generate generates and returns a list of objects that represent files to be written to a project. Calling .Write() on the result will cause those files be written to disk. This function should not interact with the file system so it can be used in a backend context.

func GenerateClient

func GenerateClient(ctx context.Context, schema *proto.Schema, makePackage bool, apiName string) (codegen.GeneratedFiles, error)

func GetDependencies added in v0.369.2

func GetDependencies(options *bootstrapOptions) (map[string]string, map[string]string)

func HasFunctions

func HasFunctions(sch *proto.Schema, cfg *config.ProjectConfig) bool

HasFunctions returns true if the schema contains any custom functions or jobs.

func HasTests

func HasTests(dir string) bool

HasTests returns true if there any TypeScript test files in dir or any of it's subdirectories.

func IsEnabled

func IsEnabled(dir string, s *proto.Schema, cfg *config.ProjectConfig) bool

IsEnabled returns true if the provided dir contains any tests or if the provided schema contains any functions.

func Scaffold

func Scaffold(dir string, schema *proto.Schema, cfg *config.ProjectConfig) (codegen.GeneratedFiles, error)

func WithDevelopmentServer

func WithDevelopmentServer(b bool) func(o *generateOptions)

WithDevelopmentServer enables or disables the generation of the development server entry point. By default this is disabled.

Types

type BootstrapOption

type BootstrapOption func(o *bootstrapOptions)

func WithLogger added in v0.369.2

func WithLogger(l func(string)) BootstrapOption

func WithOutputWriter added in v0.369.2

func WithOutputWriter(w io.Writer) BootstrapOption

func WithPackageManager added in v0.374.0

func WithPackageManager(p string) BootstrapOption

func WithPackagesPath

func WithPackagesPath(p string) BootstrapOption

WithPackagesPath causes any @teamkeel packages to be installed from this path. The path should point to the directory that contains all the different @teamkeel packages.

type DevelopmentServer

type DevelopmentServer struct {
	URL string
	// contains filtered or unexported fields
}

func StartDevelopmentServer added in v0.369.1

func StartDevelopmentServer(ctx context.Context, dir string, options *ServerOpts) (*DevelopmentServer, error)

StartDevelopmentServer will start a new node runtime server serving/handling custom function requests

func (*DevelopmentServer) Kill

func (ds *DevelopmentServer) Kill() error

func (*DevelopmentServer) Output

func (ds *DevelopmentServer) Output() string

func (*DevelopmentServer) Rebuild added in v0.368.0

func (ds *DevelopmentServer) Rebuild() error

Rebuild triggers tsx to re-start the app in watch mode. tsx does not watch node_modules or dot-directories like .build and given we change files in these places we need a way to manually trigger a restart.. The tsx docs say that in watch mode you can "Press Return to manually rerun" so we just send a newline to stdin.

type IncorrectNodeVersionError

type IncorrectNodeVersionError struct {
	Current string
	Minimum string
}

func (*IncorrectNodeVersionError) Error

func (n *IncorrectNodeVersionError) Error() string

type NodeNotFoundError

type NodeNotFoundError struct{}

func (*NodeNotFoundError) Error

func (n *NodeNotFoundError) Error() string

type NpmInstallError

type NpmInstallError struct {
	Output string
	// contains filtered or unexported fields
}

func (*NpmInstallError) Error

func (n *NpmInstallError) Error() string

type PackageJson added in v0.369.2

type PackageJson struct {
	Dependencies    map[string]string `json:"dependencies"`
	DevDependencies map[string]string `json:"devDependencies"`
}

type ServerOpts

type ServerOpts struct {
	Port    string
	EnvVars map[string]string
	Output  io.Writer
	Debug   bool
	Watch   bool
}

Jump to

Keyboard shortcuts

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