extension

package
v0.0.0-...-c3d2df8 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorefrontWebpackConfig        = "Resources/app/storefront/build/webpack.config.js"
	StorefrontWebpackCJSConfig     = "Resources/app/storefront/build/webpack.config.cjs"
	StorefrontEntrypointJS         = "Resources/app/storefront/src/main.js"
	StorefrontEntrypointTS         = "Resources/app/storefront/src/main.ts"
	StorefrontBaseCSS              = "Resources/app/storefront/src/scss/base.scss"
	AdministrationWebpackConfig    = "Resources/app/administration/build/webpack.config.js"
	AdministrationWebpackCJSConfig = "Resources/app/administration/build/webpack.config.cjs"
	AdministrationEntrypointJS     = "Resources/app/administration/src/main.js"
	AdministrationEntrypointTS     = "Resources/app/administration/src/main.ts"
)
View Source
const (
	TypePlatformApp    = "app"
	TypePlatformPlugin = "plugin"
	TypeShopwareBundle = "shopware-bundle"

	ComposerTypePlugin = "shopware-platform-plugin"
	ComposerTypeApp    = "shopware-app"
	ComposerTypeBundle = "shopware-bundle"
)
View Source
const DevVersionNumber = "6.9.9.9"

Variables

This section is empty.

Functions

func AddZipFiles

func AddZipFiles(w *zip.Writer, basePath, baseInZip string) error

func BuildAssetsForExtensions

func BuildAssetsForExtensions(ctx context.Context, sources []asset.Source, assetConfig AssetBuildConfig) error

func CleanupExtensionFolder

func CleanupExtensionFolder(path string, additionalPaths []string) error

func ConvertExtensionsToSources

func ConvertExtensionsToSources(ctx context.Context, extensions []Extension) []asset.Source

func CreateZip

func CreateZip(baseFolder, zipFile string) error

func FindAssetSourcesOfProject

func FindAssetSourcesOfProject(ctx context.Context, project string, shopCfg *shop.Config) []asset.Source

func GetConfiguredGoldMark

func GetConfiguredGoldMark() goldmark.Markdown

func GetPhpVersion

func GetPhpVersion(ctx context.Context, constraint *version.Constraints) (string, error)

func GetShopwareProjectConstraint

func GetShopwareProjectConstraint(project string) (*version.Constraints, error)

func GitCopyFolder

func GitCopyFolder(source, target, commitHash string) (string, error)

func InstallNPMDependencies

func InstallNPMDependencies(path string, packageJsonData NpmPackage, additionalParams ...string) error

func InstallNodeModulesOfConfigs

func InstallNodeModulesOfConfigs(ctx context.Context, cfgs ExtensionAssetConfig, force bool) ([]string, error)

func IsContributeProject

func IsContributeProject(projectRoot string) bool

IsContributeProject checks if the project is a contribution project aka shopware/shopware.

func LoadSymfonyEnvFile

func LoadSymfonyEnvFile(projectRoot string) error

LoadSymfonyEnvFile loads the Symfony .env file from the project root.

func PlatformPath

func PlatformPath(projectRoot, component, path string) string

func PrepareExtensionForRelease

func PrepareExtensionForRelease(ctx context.Context, sourceRoot, extensionRoot string, ext Extension) error

PrepareExtensionForRelease Remove secret from the manifest. sourceRoot is the original folder (contains also .git).

func PrepareFolderForZipping

func PrepareFolderForZipping(ctx context.Context, path string, ext Extension, extCfg *Config) error

func Unzip

func Unzip(r *zip.Reader, dest string) error

Types

type App

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

func (App) GetChangelog

func (a App) GetChangelog() (*extensionTranslated, error)

func (App) GetExtensionConfig

func (a App) GetExtensionConfig() *Config

func (App) GetLicense

func (a App) GetLicense() (string, error)

func (App) GetMetaData

func (a App) GetMetaData() *extensionMetadata

func (App) GetName

func (a App) GetName() (string, error)

func (App) GetPath

func (a App) GetPath() string

func (App) GetResourcesDir

func (a App) GetResourcesDir() string

func (App) GetRootDir

func (a App) GetRootDir() string

func (App) GetShopwareVersionConstraint

func (a App) GetShopwareVersionConstraint() (*version.Constraints, error)

func (App) GetType

func (App) GetType() string

func (App) GetVersion

func (a App) GetVersion() (*version.Version, error)

func (App) Validate

func (a App) Validate(_ context.Context, ctx *ValidationContext)

type AssetBuildConfig

type AssetBuildConfig struct {
	CleanupNodeModules           bool
	DisableAdminBuild            bool
	DisableStorefrontBuild       bool
	ShopwareRoot                 string
	ShopwareVersion              *version.Constraints
	Browserslist                 string
	SkipExtensionsWithBuildFiles bool
	NPMForceInstall              bool
	ContributeProject            bool
}

type Config

type Config struct {
	Store     ConfigStore      `yaml:"store"`
	Build     ConfigBuild      `yaml:"build"`
	Changelog changelog.Config `yaml:"changelog"`
}

type ConfigBuild

type ConfigBuild struct {
	ExtraBundles              []ConfigExtraBundle `yaml:"extraBundles,omitempty"`
	ShopwareVersionConstraint string              `yaml:"shopwareVersionConstraint,omitempty"`
	Zip                       struct {
		Composer struct {
			Enabled          bool     `yaml:"enabled"`
			BeforeHooks      []string `yaml:"before_hooks,omitempty"`
			AfterHooks       []string `yaml:"after_hooks,omitempty"`
			ExcludedPackages []string `yaml:"excluded_packages,omitempty"`
		} `yaml:"composer"`
		Assets struct {
			Enabled                    bool     `yaml:"enabled"`
			BeforeHooks                []string `yaml:"before_hooks,omitempty"`
			AfterHooks                 []string `yaml:"after_hooks,omitempty"`
			EnableESBuildForAdmin      bool     `yaml:"enable_es_build_for_admin"`
			EnableESBuildForStorefront bool     `yaml:"enable_es_build_for_storefront"`
			DisableSass                bool     `yaml:"es_build_disable_sass"`
			NpmStrict                  bool     `yaml:"npm_strict"`
		} `yaml:"assets"`
		Pack struct {
			Excludes struct {
				Paths []string `yaml:"paths,omitempty"`
			} `yaml:"excludes"`
			BeforeHooks []string `yaml:"before_hooks,omitempty"`
		} `yaml:"pack"`
	} `yaml:"zip"`
}

type ConfigExtraBundle

type ConfigExtraBundle struct {
	Path string `yaml:"path"`
	Name string `yaml:"name"`
}

type ConfigStore

type ConfigStore struct {
	Availabilities                      *[]string                          `yaml:"availabilities"`
	DefaultLocale                       *string                            `yaml:"default_locale"`
	Localizations                       *[]string                          `yaml:"localizations"`
	Categories                          *[]string                          `yaml:"categories"`
	Type                                *string                            `yaml:"type"`
	Icon                                *string                            `yaml:"icon"`
	AutomaticBugfixVersionCompatibility *bool                              `yaml:"automatic_bugfix_version_compatibility"`
	Description                         ConfigTranslated[string]           `yaml:"description"`
	InstallationManual                  ConfigTranslated[string]           `yaml:"installation_manual"`
	Tags                                ConfigTranslated[[]string]         `yaml:"tags"`
	Videos                              ConfigTranslated[[]string]         `yaml:"videos"`
	Highlights                          ConfigTranslated[[]string]         `yaml:"highlights"`
	Features                            ConfigTranslated[[]string]         `yaml:"features"`
	Faq                                 ConfigTranslated[[]ConfigStoreFaq] `yaml:"faq"`
	Images                              *[]ConfigStoreImage                `yaml:"images,omitempty"`
	ImageDirectory                      *string                            `yaml:"image_directory,omitempty"`
}

type ConfigStoreFaq

type ConfigStoreFaq struct {
	Question string `yaml:"question"`
	Answer   string `yaml:"answer"`
}

type ConfigStoreImage

type ConfigStoreImage struct {
	File     string                   `yaml:"file"`
	Activate ConfigStoreImageActivate `yaml:"activate"`
	Preview  ConfigStoreImagePreview  `yaml:"preview"`
	Priority int                      `yaml:"priority"`
}

type ConfigStoreImageActivate

type ConfigStoreImageActivate struct {
	German  bool `yaml:"de"`
	English bool `yaml:"en"`
}

type ConfigStoreImagePreview

type ConfigStoreImagePreview struct {
	German  bool `yaml:"de"`
	English bool `yaml:"en"`
}

type ConfigTranslated

type ConfigTranslated[T Translatable] struct {
	German  *T `yaml:"de"`
	English *T `yaml:"en"`
}

type Extension

type Extension interface {
	GetName() (string, error)
	GetResourcesDir() string

	// GetRootDir Returns the root folder where the code is located plugin -> src, app ->
	GetRootDir() string
	GetVersion() (*version.Version, error)
	GetLicense() (string, error)
	GetShopwareVersionConstraint() (*version.Constraints, error)
	GetType() string
	GetPath() string
	GetChangelog() (*extensionTranslated, error)
	GetMetaData() *extensionMetadata
	GetExtensionConfig() *Config
	Validate(context.Context, *ValidationContext)
}

func FindExtensionsFromProject

func FindExtensionsFromProject(ctx context.Context, project string) []Extension

func GetExtensionByFolder

func GetExtensionByFolder(path string) (Extension, error)

func GetExtensionByZip

func GetExtensionByZip(filePath string) (Extension, error)

type ExtensionAssetConfig

type ExtensionAssetConfig map[string]ExtensionAssetConfigEntry

func BuildAssetConfigFromExtensions

func BuildAssetConfigFromExtensions(ctx context.Context, sources []asset.Source, assetCfg AssetBuildConfig) ExtensionAssetConfig

func (ExtensionAssetConfig) FilterByAdmin

func (c ExtensionAssetConfig) FilterByAdmin() ExtensionAssetConfig

func (ExtensionAssetConfig) FilterByAdminAndEsBuild

func (c ExtensionAssetConfig) FilterByAdminAndEsBuild(esbuildEnabled bool) ExtensionAssetConfig

func (ExtensionAssetConfig) FilterByStorefrontAndEsBuild

func (c ExtensionAssetConfig) FilterByStorefrontAndEsBuild(esbuildEnabled bool) ExtensionAssetConfig

func (ExtensionAssetConfig) Has

func (c ExtensionAssetConfig) Has(name string) bool

func (ExtensionAssetConfig) Not

func (c ExtensionAssetConfig) Not(extensions []string) ExtensionAssetConfig

func (ExtensionAssetConfig) Only

func (c ExtensionAssetConfig) Only(extensions []string) ExtensionAssetConfig

func (ExtensionAssetConfig) RequiresAdminBuild

func (c ExtensionAssetConfig) RequiresAdminBuild() bool

func (ExtensionAssetConfig) RequiresShopwareRepository

func (c ExtensionAssetConfig) RequiresShopwareRepository() bool

func (ExtensionAssetConfig) RequiresStorefrontBuild

func (c ExtensionAssetConfig) RequiresStorefrontBuild() bool

type ExtensionAssetConfigAdmin

type ExtensionAssetConfigAdmin struct {
	Path          string  `json:"path"`
	EntryFilePath *string `json:"entryFilePath"`
	Webpack       *string `json:"webpack"`
}

type ExtensionAssetConfigEntry

type ExtensionAssetConfigEntry struct {
	BasePath                   string                         `json:"basePath"`
	Views                      []string                       `json:"views"`
	TechnicalName              string                         `json:"technicalName"`
	Administration             ExtensionAssetConfigAdmin      `json:"administration"`
	Storefront                 ExtensionAssetConfigStorefront `json:"storefront"`
	EnableESBuildForAdmin      bool
	EnableESBuildForStorefront bool
	DisableSass                bool
	NpmStrict                  bool
}

type ExtensionAssetConfigStorefront

type ExtensionAssetConfigStorefront struct {
	Path          string   `json:"path"`
	EntryFilePath *string  `json:"entryFilePath"`
	Webpack       *string  `json:"webpack"`
	StyleFiles    []string `json:"styleFiles"`
}

type NpmPackage

type NpmPackage struct {
	Dependencies    map[string]string `json:"dependencies"`
	DevDependencies map[string]string `json:"devDependencies"`
}

type PlatformPlugin

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

func (PlatformPlugin) GetChangelog

func (p PlatformPlugin) GetChangelog() (*extensionTranslated, error)

func (PlatformPlugin) GetExtensionConfig

func (p PlatformPlugin) GetExtensionConfig() *Config

func (PlatformPlugin) GetLicense

func (p PlatformPlugin) GetLicense() (string, error)

func (PlatformPlugin) GetMetaData

func (p PlatformPlugin) GetMetaData() *extensionMetadata

func (PlatformPlugin) GetName

func (p PlatformPlugin) GetName() (string, error)

func (PlatformPlugin) GetPath

func (p PlatformPlugin) GetPath() string

func (PlatformPlugin) GetResourcesDir

func (p PlatformPlugin) GetResourcesDir() string

GetResourcesDir returns the resources directory of the plugin.

func (PlatformPlugin) GetRootDir

func (p PlatformPlugin) GetRootDir() string

GetRootDir returns the src directory of the plugin.

func (PlatformPlugin) GetShopwareVersionConstraint

func (p PlatformPlugin) GetShopwareVersionConstraint() (*version.Constraints, error)

func (PlatformPlugin) GetType

func (PlatformPlugin) GetType() string

func (PlatformPlugin) GetVersion

func (p PlatformPlugin) GetVersion() (*version.Version, error)

func (PlatformPlugin) Validate

func (p PlatformPlugin) Validate(c context.Context, ctx *ValidationContext)

type ShopwareBundle

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

func (ShopwareBundle) GetChangelog

func (p ShopwareBundle) GetChangelog() (*extensionTranslated, error)

func (ShopwareBundle) GetExtensionConfig

func (p ShopwareBundle) GetExtensionConfig() *Config

func (ShopwareBundle) GetLicense

func (p ShopwareBundle) GetLicense() (string, error)

func (ShopwareBundle) GetMetaData

func (p ShopwareBundle) GetMetaData() *extensionMetadata

func (ShopwareBundle) GetName

func (p ShopwareBundle) GetName() (string, error)

func (ShopwareBundle) GetPath

func (p ShopwareBundle) GetPath() string

func (ShopwareBundle) GetResourcesDir

func (p ShopwareBundle) GetResourcesDir() string

GetResourcesDir returns the resources directory of the shopware bundle.

func (ShopwareBundle) GetRootDir

func (p ShopwareBundle) GetRootDir() string

GetRootDir returns the src directory of the bundle.

func (ShopwareBundle) GetShopwareVersionConstraint

func (p ShopwareBundle) GetShopwareVersionConstraint() (*version.Constraints, error)

func (ShopwareBundle) GetType

func (ShopwareBundle) GetType() string

func (ShopwareBundle) GetVersion

func (p ShopwareBundle) GetVersion() (*version.Version, error)

func (ShopwareBundle) Validate

func (p ShopwareBundle) Validate(c context.Context, ctx *ValidationContext)

type Translatable

type Translatable interface {
	string | []string | []ConfigStoreFaq
}

type ValidationContext

type ValidationContext struct {
	Extension Extension
	// contains filtered or unexported fields
}

func RunValidation

func RunValidation(ctx context.Context, ext Extension) *ValidationContext

func (*ValidationContext) AddError

func (c *ValidationContext) AddError(message string)

func (*ValidationContext) AddWarning

func (c *ValidationContext) AddWarning(message string)

func (*ValidationContext) Errors

func (c *ValidationContext) Errors() []string

func (*ValidationContext) HasErrors

func (c *ValidationContext) HasErrors() bool

func (*ValidationContext) HasWarnings

func (c *ValidationContext) HasWarnings() bool

func (*ValidationContext) Warnings

func (c *ValidationContext) Warnings() []string

Jump to

Keyboard shortcuts

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