apps

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectFiles

func CollectFiles(app AppConfig) ([]string, error)

CollectFiles returns all files under dir matching glob, project-root relative.

func ExecutePush

func ExecutePush(ctx context.Context, client *api.Client, app AppConfig, result Result) error

ExecutePush uploads/updates/deletes remote app files.

func ExplicitFiles

func ExplicitFiles(discovered []string, explicit []string) ([]string, error)

ExplicitFiles intersects discovered files with explicit project-relative selections.

func ListRemoteFiles added in v0.5.4

func ListRemoteFiles(ctx context.Context, client *api.Client, app AppConfig) ([]api.AppCodeFile, error)

ListRemoteFiles returns the app's code files currently on the server.

func NormalizeHost

func NormalizeHost(raw string) string

NormalizeHost converts an API URL into the stored host form.

func RemoteName

func RemoteName(app AppConfig, projectRel string) string

func WarnCycles added in v0.5.4

func WarnCycles(ctx context.Context, cycles [][]string) error

WarnCycles reports require cycles found while ordering an upload.

Types

type AppConfig

type AppConfig struct {
	config.AppProjectConfig
	ProjectRoot string
}

AppConfig is one resolved local app config.

func ResolveApp

func ResolveApp(candidates []AppConfig, requested string) (AppConfig, error)

ResolveApp selects one app by local name.

func VisibleApps

func VisibleApps(projectRoot string, project config.ProjectConfig, activeHost, activeSite string) []AppConfig

VisibleApps filters apps by active host/site.

type FileAction

type FileAction struct {
	Action string `json:"action"`
	Local  string `json:"local,omitempty"`
	Name   string `json:"name"`
}

FileAction describes one cloud-code operation.

type Graph added in v0.5.4

type Graph struct {
	// contains filtered or unexported fields
}

Graph is the local require graph of an app's cloud code, keyed by remote name.

func LoadGraph added in v0.5.4

func LoadGraph(app AppConfig, files []string) (*Graph, error)

LoadGraph reads files from disk and builds their require graph.

func NewGraph added in v0.5.4

func NewGraph(app AppConfig, sources map[string]string) *Graph

NewGraph builds the require graph from project-relative paths and their source.

func (*Graph) Missing added in v0.5.4

func (g *Graph) Missing(files []string, remote []api.AppCodeFile) []MissingDependency

Missing lists selected files that require a local file which is not being pushed and that the server cannot resolve from its current files either; uploading them would fail with UnknownModule.

func (*Graph) Order added in v0.5.4

func (g *Graph) Order(files []string) ([]string, [][]string)

Order returns files in upload order: every file after the local files it requires, with main.js last. The runtime tolerates require cycles, so they are broken (walking from main.js first) and returned instead of rejected. Files unknown to the graph are kept, without dependencies.

type MissingDependency added in v0.5.4

type MissingDependency struct {
	Name     string
	Requires string
}

MissingDependency is a file that requires a local file which is neither part of the push nor present on the server.

type PullOptions added in v0.2.2

type PullOptions struct {
	Only []string
}

PullOptions controls app-code pull scope.

type PullResult added in v0.2.2

type PullResult struct {
	AppKey    string       `json:"app_key"`
	LocalName string       `json:"local_name"`
	Files     []string     `json:"files,omitempty"`
	Written   []FileAction `json:"written,omitempty"`
}

PullResult is emitted by apps code pull.

func Pull added in v0.2.2

func Pull(ctx context.Context, client *api.Client, app AppConfig, opts PullOptions) (PullResult, error)

Pull downloads remote app code files into the configured local app directory.

type PushPlan

type PushPlan struct {
	Uploads []FileAction `json:"uploads,omitempty"`
	Deletes []FileAction `json:"deletes,omitempty"`
}

PushPlan groups upload/delete work.

func BuildPushPlan

func BuildPushPlan(app AppConfig, localFiles []string, remoteFiles []api.AppCodeFile, sync bool) PushPlan

BuildPushPlan computes upload/delete actions.

type Result

type Result struct {
	AppKey    string       `json:"app_key"`
	LocalName string       `json:"local_name"`
	Files     []string     `json:"files,omitempty"`
	Uploads   []FileAction `json:"uploads,omitempty"`
	Created   []FileAction `json:"created,omitempty"`
	Updated   []FileAction `json:"updated,omitempty"`
	Deleted   []FileAction `json:"deleted,omitempty"`
	Sync      bool         `json:"sync,omitempty"`
}

Result is emitted by apps push.

func PlanPush

func PlanPush(ctx context.Context, client *api.Client, app AppConfig, selected []string, sync bool) (Result, []string, error)

PlanPush computes a structured push result from local and remote files.

func PlanPushFromRemote added in v0.5.4

func PlanPushFromRemote(app AppConfig, selected []string, remoteFiles []api.AppCodeFile, sync bool) (Result, []string)

PlanPushFromRemote computes a structured push result against an already fetched remote file list.

Jump to

Keyboard shortcuts

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