shop

package
v0.0.0-...-e8f7fe3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoComposerFileFound        = errors.New("could not determine Shopware version as no composer.json or composer.lock file was found")
	ErrShopwareDependencyNotFound = errors.New("could not determine Shopware version as no shopware/core dependency was found")
)

Functions

func ConfigSchema

func ConfigSchema() []byte

ConfigSchema returns the JSON schema for the .shopware-project.yml configuration file.

func DefaultConfigFileName

func DefaultConfigFileName() string

func IsShopwareVersion

func IsShopwareVersion(projectRoot string, requiredVersion string) (bool, error)

func NewShopClient

func NewShopClient(ctx context.Context, config *Config) (*adminSdk.Client, error)

Types

type Config

type Config struct {
	AdditionalConfigs []string `yaml:"include,omitempty"`
	// The URL of the Shopware instance
	URL string `yaml:"url"`
	// Controls date-based compatibility behavior, formatted as YYYY-MM-DD.
	CompatibilityDate string            `yaml:"compatibility_date,omitempty" jsonschema:"format=date"`
	Build             *ConfigBuild      `yaml:"build,omitempty"`
	AdminApi          *ConfigAdminApi   `yaml:"admin_api,omitempty"`
	ConfigDump        *ConfigDump       `yaml:"dump,omitempty"`
	ConfigDeployment  *ConfigDeployment `yaml:"deployment,omitempty"`
	Validation        *ConfigValidation `yaml:"validation,omitempty"`
	ImageProxy        *ConfigImageProxy `yaml:"image_proxy,omitempty"`
	// When enabled, composer scripts will be disabled during CI builds
	DisableComposerScripts bool `yaml:"disable_composer_scripts,omitempty"`
	// When enabled, composer install will be skipped during CI builds
	DisableComposerInstall bool `yaml:"disable_composer_install,omitempty"`
	// contains filtered or unexported fields
}

func ReadConfig

func ReadConfig(ctx context.Context, fileName string, allowFallback bool) (*Config, error)

func (*Config) HasCompatibilityDate

func (c *Config) HasCompatibilityDate() bool

func (*Config) IsAdminAPIConfigured

func (c *Config) IsAdminAPIConfigured() bool

func (*Config) IsCompatibilityDateAtLeast

func (c *Config) IsCompatibilityDateAtLeast(requiredDate string) (bool, error)

func (Config) IsFallback

func (c Config) IsFallback() bool

type ConfigAdminApi

type ConfigAdminApi struct {
	// Client ID of integration
	ClientId string `yaml:"client_id,omitempty"`
	// Client Secret of integration
	ClientSecret string `yaml:"client_secret,omitempty"`
	// Username of admin user
	Username string `yaml:"username,omitempty"`
	// Password of admin user
	Password string `yaml:"password,omitempty"`
	// Disable SSL certificate check
	DisableSSLCheck bool `yaml:"disable_ssl_check,omitempty"`
}

type ConfigBuild

type ConfigBuild struct {
	// When enabled, the assets will not be copied to the public folder
	DisableAssetCopy bool `yaml:"disable_asset_copy,omitempty"`
	// When enabled, the assets of extensions will be removed from the extension public folder. (Requires Shopware 6.5.2.0)
	RemoveExtensionAssets bool `yaml:"remove_extension_assets,omitempty"`
	// When enabled, the extensions source code will be keep in the final build
	KeepExtensionSource bool `yaml:"keep_extension_source,omitempty"`
	// When enabled, the source maps will not be removed from the final build
	KeepSourceMaps bool `yaml:"keep_source_maps,omitempty"`
	// Paths to delete for the final build
	CleanupPaths []string `yaml:"cleanup_paths,omitempty"`
	// Browserslist configuration for the Storefront build
	Browserslist string `yaml:"browserslist,omitempty"`
	// Extensions to exclude from the build
	ExcludeExtensions []string `yaml:"exclude_extensions,omitempty"`
	// When enabled, the storefront build will be skipped
	DisableStorefrontBuild bool `yaml:"disable_storefront_build,omitempty"`
	// Extensions to force build for, even if they have compiled files
	ForceExtensionBuild []ConfigBuildExtension `yaml:"force_extension_build,omitempty"`
	// When enabled, the shopware admin will be built
	ForceAdminBuild bool `yaml:"force_admin_build,omitempty"`
	// Keep following node_modules in the final build
	KeepNodeModules []string `yaml:"keep_node_modules,omitempty"`
	// MJML email template compilation configuration
	MJML *ConfigBuildMJML `yaml:"mjml,omitempty"`
	// When enabled, built assets are cached and restored on subsequent builds when sources haven't changed
	AssetCaching bool `yaml:"asset_caching,omitempty"`
	// Hooks to run at specific points during CI builds
	Hooks *ConfigBuildHooks `yaml:"hooks,omitempty"`
	// Shopware bundles to include in builds (alternative to composer.json extra.shopware-bundles)
	Bundles []ConfigProjectBundle `yaml:"bundles,omitempty"`
}

func (ConfigBuild) IsMjmlEnabled

func (c ConfigBuild) IsMjmlEnabled() bool

type ConfigBuildExtension

type ConfigBuildExtension struct {
	// Name of the extension
	Name string `yaml:"name" jsonschema:"required"`
}

ConfigBuildExtension defines the configuration for forcing extension builds.

type ConfigBuildHooks

type ConfigBuildHooks struct {
	// Commands to run before anything runs
	Pre []string `yaml:"pre,omitempty"`
	// Commands to run after everything completes
	Post []string `yaml:"post,omitempty"`
	// Commands to run before composer install
	PreComposer []string `yaml:"pre-composer,omitempty"`
	// Commands to run after composer install
	PostComposer []string `yaml:"post-composer,omitempty"`
	// Commands to run before asset build
	PreAssets []string `yaml:"pre-assets,omitempty"`
	// Commands to run after asset build
	PostAssets []string `yaml:"post-assets,omitempty"`
}

ConfigBuildHooks defines hooks to run at specific points during CI builds.

type ConfigBuildMJML

type ConfigBuildMJML struct {
	// Whether to enable MJML compilation
	Enabled bool `yaml:"enabled,omitempty"`
	// Directories to search for MJML files
	SearchPaths []string `yaml:"search_paths,omitempty"`
	// When enabled, mj-include directives in MJML templates are processed.
	// MJML 5 ignores mj-include by default for security reasons; set this to
	// true to opt back in. Each search_path is automatically added to the
	// mj-include allowlist for files compiled inside it, so templates can
	// include siblings under the same search_path (e.g. a shared _includes/
	// folder) without further configuration.
	AllowIncludes bool `yaml:"allow_includes,omitempty"`
	// Extra directories outside any search_path that mj-include is allowed to
	// read from. Relative paths are resolved against the project root.
	// Absolute paths are used as-is. Most projects do not need this — set it
	// only when partials live outside the search_path tree. Implies
	// allow_includes.
	IncludePaths []string `yaml:"include_paths,omitempty"`
}

ConfigBuildMJML defines the configuration for MJML email template compilation.

func (ConfigBuildMJML) GetPaths

func (c ConfigBuildMJML) GetPaths(projectRoot string) []string

func (ConfigBuildMJML) ResolveIncludePaths

func (c ConfigBuildMJML) ResolveIncludePaths(projectRoot string) []string

ResolveIncludePaths returns IncludePaths as absolute paths. Relative entries are resolved against projectRoot; absolute entries are returned unchanged. Returns nil when no paths are configured.

type ConfigDeployment

type ConfigDeployment struct {
	Hooks struct {
		// The pre hook will be executed before the deployment
		Pre ConfigDeploymentHook `yaml:"pre"`
		// The post hook will be executed after the deployment
		Post ConfigDeploymentHook `yaml:"post"`
		// The pre-install hook will be executed before the installation
		PreInstall ConfigDeploymentHook `yaml:"pre-install"`
		// The post-install hook will be executed after the installation
		PostInstall ConfigDeploymentHook `yaml:"post-install"`
		// The pre-update hook will be executed before the update
		PreUpdate ConfigDeploymentHook `yaml:"pre-update"`
		// The post-update hook will be executed after the update
		PostUpdate ConfigDeploymentHook `yaml:"post-update"`
	} `yaml:"hooks"`

	Store struct {
		LicenseDomain string `yaml:"license-domain"`
	} `yaml:"store"`

	Cache struct {
		AlwaysClear bool `yaml:"always_clear"`
	} `yaml:"cache"`

	// The extension management of the deployment
	ExtensionManagement struct {
		// When enabled, the extensions will be installed, updated, and removed
		Enabled bool `yaml:"enabled"`
		// Which extensions should not be managed
		Exclude []string `yaml:"exclude"`

		Overrides ConfigDeploymentOverrides `yaml:"overrides"`

		// DEPRECATED, On these extensions, it will be always called plugin:update
		ForceUpdatesDeprecated []string `yaml:"force_updates,omitempty" jsonschema:"deprecated=true"`
		// On these extensions, it will be always called plugin:update
		ForceUpdate []string `yaml:"force-update,omitempty"`
	} `yaml:"extension-management"`

	OneTimeTasks []struct {
		Id     string `yaml:"id" jsonschema:"required"`
		Script string `yaml:"script" jsonschema:"required"`
	} `yaml:"one-time-tasks"`

	// Staging mode configuration for the deployment
	Staging *ConfigDeploymentStaging `yaml:"staging,omitempty"`
}

type ConfigDeploymentHook

type ConfigDeploymentHook struct {
	Steps []ConfigDeploymentHookStep
}

ConfigDeploymentHook is a deployment hook. It can either be a single script (string) or a list of steps that are executed individually. Each step can be a plain script string or an object with a "title" and a "script".

func (ConfigDeploymentHook) JSONSchema

func (ConfigDeploymentHook) JSONSchema() *jsonschema.Schema

func (*ConfigDeploymentHook) UnmarshalYAML

func (h *ConfigDeploymentHook) UnmarshalYAML(value *yaml.Node) error

type ConfigDeploymentHookStep

type ConfigDeploymentHookStep struct {
	// An optional title shown in the deployment output for this step
	Title string `yaml:"title,omitempty"`
	// The script that is executed for this step
	Script string `yaml:"script"`
}

ConfigDeploymentHookStep is a single titled step of a deployment hook.

type ConfigDeploymentOverrides

type ConfigDeploymentOverrides map[string]struct {
	State string `yaml:"state"`
}

func (ConfigDeploymentOverrides) JSONSchema

type ConfigDeploymentStaging

type ConfigDeploymentStaging struct {
	// When enabled, staging setup commands will be executed during installation and upgrade
	Enabled bool `yaml:"enabled,omitempty"`
}

ConfigDeploymentStaging defines staging mode configuration.

type ConfigDump

type ConfigDump struct {
	// Allows to rewrite single columns, perfect for GDPR compliance
	Rewrite map[string]map[string]string `yaml:"rewrite,omitempty"`
	// Only export the schema of these tables, supports glob wildcards (e.g. "customer*")
	NoData []string `yaml:"nodata,omitempty"`
	// Ignore these tables from export, supports glob wildcards (e.g. "customer*")
	Ignore []string `yaml:"ignore,omitempty"`
	// Add an where condition to that table, schema is table name as key, and where statement as value
	Where map[string]string `yaml:"where,omitempty"`
}

func (*ConfigDump) EnableAnonymization

func (c *ConfigDump) EnableAnonymization()

EnableAnonymization adds default column rewrites for anonymizing customer data

func (*ConfigDump) EnableClean

func (c *ConfigDump) EnableClean()

EnableClean adds default tables that should be excluded from data dump in clean mode

func (*ConfigDump) NormalizeFakerExpressions

func (c *ConfigDump) NormalizeFakerExpressions()

NormalizeFakerExpressions wraps bare faker expressions with {{- -}} delimiters so they can be properly evaluated by the mysqldump faker processor.

type ConfigImageProxy

type ConfigImageProxy struct {
	// The URL of the upstream server to proxy requests to when files are not found locally
	URL string `yaml:"url,omitempty"`
}

type ConfigProjectBundle

type ConfigProjectBundle struct {
	// Relative path from project root to the bundle directory
	Path string `yaml:"path" jsonschema:"required"`
	// Optional override for the bundle name; defaults to the directory basename
	Name string `yaml:"name,omitempty"`
}

ConfigProjectBundle defines a project-level Shopware bundle.

type ConfigValidation

type ConfigValidation struct {
	// Ignore items from the validation.
	Ignore []ConfigValidationIgnoreItem `yaml:"ignore,omitempty"`

	IgnoreExtensions []ConfigValidationIgnoreExtension `yaml:"ignore_extensions,omitempty"`

	// PhpVersion overrides the PHP version used for linting (e.g. "8.4").
	// When set, this takes precedence over the version derived from composer.json or the static Shopware-to-PHP mapping.
	PhpVersion string `yaml:"php_version,omitempty"`
}

ConfigValidation is used to configure the project validation.

type ConfigValidationIgnoreExtension

type ConfigValidationIgnoreExtension struct {
	// The name of the extension to ignore.
	Name string `yaml:"name"`
}

type ConfigValidationIgnoreItem

type ConfigValidationIgnoreItem struct {
	// The identifier of the item to ignore.
	Identifier string `yaml:"identifier"`
	// The path of the item to ignore.
	Path string `yaml:"path,omitempty"`
	// The message of the item to ignore.
	Message string `yaml:"message,omitempty"`
}

ConfigValidationIgnoreItem is used to ignore items from the validation.

type ConsoleResponse

type ConsoleResponse struct {
	Commands []struct {
		Name       string `json:"name"`
		Hidden     bool   `json:"hidden"`
		Definition struct {
			Arguments interface{} `json:"arguments"`
			Options   map[string]struct {
				Shortcut string `json:"shortcut"`
			} `json:"options"`
		} `json:"definition"`
	} `json:"commands"`
}

func GetConsoleCompletion

func GetConsoleCompletion(ctx context.Context, projectRoot string) (*ConsoleResponse, error)

func (ConsoleResponse) GetCommandOptions

func (c ConsoleResponse) GetCommandOptions(name string) []string

Jump to

Keyboard shortcuts

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