Skip to content

Commit

Permalink
fix: extension build with custom project root, fixes #246
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Jan 14, 2024
1 parent a5b2ee4 commit a40b61c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions cmd/extension/extension_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,22 @@ var extensionAssetBundleCmd = &cobra.Command{
validatedExtensions = append(validatedExtensions, ext)
}

constraint, err := validatedExtensions[0].GetShopwareVersionConstraint()
if err != nil {
return fmt.Errorf("cannot get shopware version constraint: %w", err)
}
if os.Getenv("SHOPWARE_PROJECT_ROOT") == "" {
constraint, err := extension.GetShopwareProjectConstraint(os.Getenv("SHOPWARE_PROJECT_ROOT"))
if err != nil {
return fmt.Errorf("cannot get shopware version constraint from project %s: %w", os.Getenv("SHOPWARE_PROJECT_ROOT"), err)
}
assetCfg.ShopwareVersion = constraint
} else {
constraint, err := validatedExtensions[0].GetShopwareVersionConstraint()
if err != nil {
return fmt.Errorf("cannot get shopware version constraint: %w", err)
}

assetCfg.ShopwareVersion = constraint
assetCfg.ShopwareVersion = constraint
}

err = extension.BuildAssetsForExtensions(cmd.Context(), extension.ConvertExtensionsToSources(cmd.Context(), validatedExtensions), assetCfg)
if err != nil {
if err := extension.BuildAssetsForExtensions(cmd.Context(), extension.ConvertExtensionsToSources(cmd.Context(), validatedExtensions), assetCfg); err != nil {
return fmt.Errorf("cannot build assets: %w", err)
}

Expand Down

0 comments on commit a40b61c

Please sign in to comment.