Documentation
¶
Index ¶
- Variables
- func Delete(ctx context.Context, client *api.Client, theme string, resource Resource) error
- func DisplayPath(kind Kind, remoteName string) string
- func FetchResource(ctx context.Context, client *api.Client, theme string, kind Kind, ...) (api.ThemeResource, error)
- func GroupByKind(resources []Resource) map[Kind][]Resource
- func ProjectPathForResource(cfg Config, resource Resource) (string, bool)
- func ReadContent(ctx context.Context, client *api.Client, theme string, kind Kind, ...) ([]byte, error)
- func RunBuild(ctx context.Context, cfg Config) error
- func Upsert(ctx context.Context, client *api.Client, theme string, resource Resource, ...) error
- func UpsertBytes(ctx context.Context, client *api.Client, theme string, resource Resource, ...) error
- type Action
- type BuildConfig
- type Config
- type CopyOptions
- type CopyRef
- type CopyResult
- type DiffEntry
- type DiffResult
- type GitChanges
- type Kind
- type Options
- type PullOptions
- type PullResult
- type Resource
- func ClassifyProjectPath(cfg Config, relPath string) (Resource, bool, error)
- func CollectAll(cfg Config) ([]Resource, error)
- func CollectGenerated(cfg Config) ([]Resource, error)
- func FetchRemoteResources(ctx context.Context, client *api.Client, theme string) ([]Resource, error)
- func FilterResources(cfg Config, resources []Resource, opts Options) ([]Resource, error)
- func SortByKindOrder(resources []Resource) []Resource
- type ResourceContent
- type Result
- type RootSpec
Constants ¶
This section is empty.
Variables ¶
var KindOrder = []Kind{KindSnippet, KindLayout, KindTemplate, KindAsset}
KindOrder defines fallback transfer order when no more specific ordering is required.
Functions ¶
func DisplayPath ¶
DisplayPath returns the stable CLI-facing path for a resource.
func FetchResource ¶
func FetchResource(ctx context.Context, client *api.Client, theme string, kind Kind, remoteName string) (api.ThemeResource, error)
FetchResource returns one theme resource from its real collection endpoint.
func GroupByKind ¶ added in v0.1.3
GroupByKind groups resources by their Kind.
func ProjectPathForResource ¶
ProjectPathForResource maps a remote resource back to a project-relative local path.
func ReadContent ¶
func ReadContent(ctx context.Context, client *api.Client, theme string, kind Kind, remoteName string) ([]byte, error)
ReadContent fetches one theme resource body.
Types ¶
type Action ¶
type Action struct {
Kind Kind `json:"kind"`
DisplayPath string `json:"path"`
LocalPath string `json:"local_path,omitempty"`
RemoteName string `json:"remote_name"`
}
Action records one upload or delete operation.
type BuildConfig ¶
BuildConfig configures an optional pre-push/pre-sync build step.
type Config ¶
type Config struct {
Build *BuildConfig
Generated []string
Ignore []string
ProjectRoot string
Roots []RootSpec
Theme string
}
Config is the resolved theme sync configuration.
func ResolveConfig ¶
func ResolveConfig(projectRoot string, project projectconfig.ProjectConfig, explicitTheme string) (Config, error)
ResolveConfig resolves theme sync configuration from project config and flags.
type CopyOptions ¶
CopyOptions controls one copy run.
type CopyRef ¶
type CopyRef struct {
BaseURL string `json:"base_url"`
Site string `json:"site"`
Theme string `json:"theme"`
}
CopyRef identifies one site/theme/host tuple.
type CopyResult ¶
type CopyResult struct {
From CopyRef `json:"from"`
To CopyRef `json:"to"`
Items []Action `json:"items,omitempty"`
Skipped []Action `json:"skipped,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
CopyResult records copied resources.
type DiffResult ¶
type DiffResult struct {
Theme string `json:"theme"`
Changes []DiffEntry `json:"changes,omitempty"`
Entries []DiffEntry `json:"entries,omitempty"`
}
DiffResult reports all detected liquid mismatches.
type GitChanges ¶
GitChanges captures project-relative file changes from git.
func CollectGitChanges ¶
func CollectGitChanges(cfg Config, since string) (GitChanges, error)
CollectGitChanges returns git-based changed and deleted files for the project. When since is non-empty it is used as the diff ref instead of HEAD, allowing callers to detect committed-but-not-pushed changes (e.g. "origin/main").
type Kind ¶
type Kind string
Kind identifies a remote theme resource collection.
func ParseCLIPath ¶
ParseCLIPath maps a CLI file path onto a resource kind and remote name.
func (Kind) Collection ¶
func (Kind) DisplayRoot ¶
type Options ¶
type Options struct {
All bool
Build bool
DryRun bool
Force bool
Prune bool
Since string
Only []string
LiquidOnly bool
CSSOnly bool
JSOnly bool
ImagesOnly bool
FontsOnly bool
ConfirmOverwrite func(context.Context, Resource, error) (bool, error)
}
Options control one push/sync run.
type PullResult ¶
type PullResult struct {
Theme string `json:"theme"`
Written []Action `json:"written,omitempty"`
TimelineRendered bool `json:"-"`
}
PullResult reports files written by a pull operation.
type Resource ¶
type Resource struct {
Kind Kind `json:"kind"`
DisplayPath string `json:"path"`
LocalPath string `json:"local_path,omitempty"`
RemoteName string `json:"remote_name"`
PublicURL string `json:"public_url,omitempty"`
AbsPath string `json:"-"`
}
Resource represents one managed local or remote theme file.
func ClassifyProjectPath ¶
ClassifyProjectPath maps a project-relative path onto a configured resource kind.
func CollectAll ¶
CollectAll returns every managed local resource discovered under configured roots.
func CollectGenerated ¶
CollectGenerated returns generated resources that currently exist on disk.
func FetchRemoteResources ¶
func FetchRemoteResources(ctx context.Context, client *api.Client, theme string) ([]Resource, error)
FetchRemoteResources returns the current remote theme resources exposed by the theme API.
func FilterResources ¶
FilterResources applies selection flags to resources.
func SortByKindOrder ¶ added in v0.1.3
SortByKindOrder returns a new slice sorted by KindOrder, then alphabetically by DisplayPath within each kind.
type ResourceContent ¶ added in v0.1.13
ResourceContent pairs a theme resource with the bytes that will be uploaded.
func OrderResourceContentByLiquidDependencies ¶ added in v0.1.13
func OrderResourceContentByLiquidDependencies(items []ResourceContent) ([]ResourceContent, []string)
OrderResourceContentByLiquidDependencies returns resources ordered so Liquid dependencies are uploaded before the resources that reference them.
type Result ¶
type Result struct {
Built bool `json:"built,omitempty"`
Deleted []Action `json:"deleted,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
Mode string `json:"mode"`
Skipped []Action `json:"skipped,omitempty"`
Theme string `json:"theme"`
Uploaded []Action `json:"uploaded,omitempty"`
Warnings []string `json:"warnings,omitempty"`
TimelineRendered bool `json:"-"`
}
Result is emitted by push/sync commands.