FriendsOfShopware / shopware-cli

CLI for Shopware Account and Shopware 6
MIT License
84 stars 32 forks source link

No fallback to Shopware6.5 path style for shopware-cli project ci command #425

Closed ioanok closed 2 weeks ago

ioanok commented 4 weeks ago

PHP Version

8.2

Shopware Version

6.5

Plugin Version

0.4.55

Actual behaviour

When using shopware-cli project ci with Shopware 6.5, especially with B2B Suite? It seems to be rebuilding the storefront files every time, even though they already come with the extension. This is because shopware-cli is looking for a shopware 6.6 style path

sw6.6 path: vendor/store.shopware.com/swagb2bplatform/src/Resources/app/storefront/dist/storefront/js/swag-b2b-platform/swag-b2b-platform.js
sw6.5 path: vendor/store.shopware.com/swagb2bplatform/src/Resources/app/storefront/dist/storefront/js/swag-b2b-platform.js

Because the path does not match, the tool builds the assets of swagb2bplatform, and the result overrides the original minified JS file. This new file is broken and can not be used; you will get an error like in the screenshot.

For shopware-cli project storefront-build there is a fallback for sw 6.5 path-style, but nothing for shopware-cli project ci

jsFile := filepath.Join("js", kebabCased+DotJs)

if newLayout {
    jsFile = filepath.Join("js", kebabCased, kebabCased+DotJs)
}

The logic which has no fallback when you run shopware-cli project ci https://github.com/FriendsOfShopware/shopware-cli/blob/main/extension/asset_platform.go#L437

Expected behaviour

Steps to Reproduce?

build with shopware-cli project ci a demo shopware project which has B2B Suite plugin installed

shyim commented 3 weeks ago

I just remembered the always build storefront is expected so in 6.5. Because the build JS files are not stable and may break at any time.

Shopware 6.6 introduced isolated JS builds, so each plugin is compiled alone without external dependencies.