Documentation ¶
Index ¶
- Constants
- func Bootstrap(dir string, opts ...BootstrapOption) error
- func CheckNodeVersion() error
- func Generate(ctx context.Context, schema *proto.Schema, opts ...func(o *generateOptions)) (codegen.GeneratedFiles, error)
- func GenerateClient(ctx context.Context, schema *proto.Schema, makePackage bool, apiName string) (codegen.GeneratedFiles, error)
- func GetDependencies(options *bootstrapOptions) (map[string]string, map[string]string)
- func HasFunctions(sch *proto.Schema) bool
- func HasTests(dir string) bool
- func IsEnabled(dir string, s *proto.Schema) bool
- func Scaffold(dir string, schema *proto.Schema) (codegen.GeneratedFiles, error)
- func WithDevelopmentServer(b bool) func(o *generateOptions)
- type BootstrapOption
- type DevelopmentServer
- type IncorrectNodeVersionError
- type NodeNotFoundError
- type NpmInstallError
- type PackageJson
- type ServerOpts
Constants ¶
const ( FUNCTIONS_DIR = "functions" 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, 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 GetDependencies ¶ added in v0.369.2
func HasFunctions ¶
HasFunctions returns true if the schema contains any custom functions or jobs.
func HasTests ¶
HasTests returns true if there any TypeScript test files in dir or any of it's subdirectories.
func IsEnabled ¶
IsEnabled returns true if the provided dir contains any tests or if the provided schema contains any functions.
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 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 ¶
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