Documentation
¶
Index ¶
- func CollectFiles(app AppConfig) ([]string, error)
- func ExecutePush(ctx context.Context, client *api.Client, app AppConfig, result Result) error
- func ExplicitFiles(discovered []string, explicit []string) ([]string, error)
- func ListRemoteFiles(ctx context.Context, client *api.Client, app AppConfig) ([]api.AppCodeFile, error)
- func NormalizeHost(raw string) string
- func RemoteName(app AppConfig, projectRel string) string
- func WarnCycles(ctx context.Context, cycles [][]string) error
- type AppConfig
- type FileAction
- type Graph
- type MissingDependency
- type PullOptions
- type PullResult
- type PushPlan
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectFiles ¶
CollectFiles returns all files under dir matching glob, project-root relative.
func ExecutePush ¶
ExecutePush uploads/updates/deletes remote app files.
func ExplicitFiles ¶
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 ¶
NormalizeHost converts an API URL into the stored host form.
func RemoteName ¶
Types ¶
type AppConfig ¶
type AppConfig struct {
config.AppProjectConfig
ProjectRoot string
}
AppConfig is one resolved local app config.
func ResolveApp ¶
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 NewGraph ¶ added in v0.5.4
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
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
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.