oroinc / platform

Main OroPlatform package with core functionality.
Other
627 stars 351 forks source link

Issue with Autolinker.js bower dependency #783

Closed MikeParkin closed 6 years ago

MikeParkin commented 6 years ago

The autolinker.js bower.json includes the name of Autolinker using an uppercase (which is against the bower spec and I've reported it to them here: https://github.com/gregjacobs/Autolinker.js/issues/226 ).

However in the Oro Ui require.yml this line exists:

    'autolinker': 'bundles/bowerassets/autolinker.js/dist/Autolinker.js'

This fails on oro:requirejs:build on case sensitive filesystems as the files are downloaded as bowerassets/Autolinker.js (i presume, because of the name of the bower package).

It looks like this was changed 6 months ago from uppercase to lowercase, not sure how no-one has found this already!

MikeParkin commented 6 years ago

from: vendor/oro/platform/src/Oro/Bundle/UIBundle/Resources/config/requirejs.yml

        'autolinker': 'bundles/bowerassets/autolinker.js/dist/Autolinker.js'

changed here:

https://github.com/oroinc/platform/commit/9c0228a326a861e8c7d8cbdf3ed7c8843e18df83#diff-d0226bb1319f77e5a72f9be0e343e148

anyt commented 6 years ago

Hi MikeParkin, First of all, thanks for the report. For downloading bower and npm dependencies we use https://asset-packagist.orocrm.com composer repository, instead of bower directly. The commit you are referring were done in scope of transferring from fxpio composer plugin to asset-packagist in order to speed-up composer update process and remove dependency to global composer plugin.

And since composer lowercase all package names we MUST use the same approach here. so there is no issue with autolinker.js, and if you really have it, please provide platform version number you are using and environment details.

Also there is an open issue with case-sensetive packages at asset-packagist repository, you can check it here to leave your suggestions about naming, since it's not compatible for composer and bower packages for now https://github.com/hiqdev/asset-packagist/pull/64

MikeParkin commented 6 years ago

Ahh, amazing thanks for that pointer.

We hadn't updated our composer.json to the new URL (we still had https://packagist.orocrm.com).

Will give this a test and confirm it's now lowercase!

anyt commented 6 years ago

It's not a replacement for https://packagist.orocrm.com, you should use 2 repositories together: https://github.com/oroinc/platform-application/blob/master/composer.json#L11-L17 also it's highly recommended to disable fxpio plugin, you can do it with this configuration for the project: https://github.com/oroinc/platform-application/blob/master/composer.json#L45-L47 or you can just remove it completely from the system as enabling it will slowdown composer operations a lot.

MikeParkin commented 6 years ago

Hi @anyt great, thank you.

LRotherfield commented 6 years ago

@anyt I updated our composer.json to an exact mirror (just copy and pasted over my current file) of: https://github.com/oroinc/platform-application/blob/2.4/composer.json

And now I am getting:

composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - oro/platform 2.4.x-dev requires bower-asset/autolinker.js 1.4.* -> no matching package found.
    - oro/platform 2.4.2 requires bower-asset/autolinker.js 1.4.* -> no matching package found.
    - oro/platform 2.4.1 requires bower-asset/autolinker.js 1.4.* -> no matching package found.
    - oro/platform 2.4.0 requires bower-asset/autolinker.js 1.4.* -> no matching package found.
    - oro/platform 2.4.x-dev requires bower-asset/autolinker.js 1.4.* -> no matching package found.
    - oro/platform 2.4.2 requires bower-asset/autolinker.js 1.4.* -> no matching package found.
    - oro/platform 2.4.1 requires bower-asset/autolinker.js 1.4.* -> no matching package found.
    - oro/platform 2.4.0 requires bower-asset/autolinker.js 1.4.* -> no matching package found.
    - oro/platform 2.4.2 requires bower-asset/autolinker.js 1.4.* -> no matching package found.
    - Installation request for oro/platform 2.4.* -> satisfiable by oro/platform[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
anyt commented 6 years ago

seems it's a problem on asset-packagist side, I'm checking it.

anyt commented 6 years ago

please run composer cache-clear and then composer update again. This should work now.

LRotherfield commented 6 years ago

Hi @anyt

I can now update composer but I am still getting a bowerasset with a capital A:

            "name": "bower-asset/Autolinker.js",
            "version": "1.4.4",
            "source": {
                "type": "git",
                "url": "https://github.com/gregjacobs/Autolinker.js.git",
                "reference": "355143d271c314e1cb68eb120b55450461927427"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/gregjacobs/Autolinker.js/zipball/355143d271c314e1cb68eb120b55450461927427",
                "reference": "355143d271c314e1cb68eb120b55450461927427",
                "shasum": ""
            },
            "type": "bower-asset-library",
            "extra": {
                "bower-asset-main": "dist/Autolinker.js",
                "bower-asset-ignore": [
                    "**/.*",
                    "build",
                    "node_modules",
                    "bower_components",
                    "test",
                    "tests",
                    "vendor"
                ]
            },
            "license": [
                "MIT"
            ],
            "description": "Automatically links URLs, email addresses, mentions (Twitter, Instagram) in a string of text or HTML.",
            "keywords": [
                "anchor",
                "auto",
                "autolink",
                "link",
                "url",
                "urls"
            ]
        },

screen shot 2017-12-19 at 09 01 30

I am still using the composer.json from here: https://github.com/oroinc/platform-application/blob/2.4/composer.json

Any thoughts?

anyt commented 6 years ago

This can be done only when fxpio plugin working, can you run composer global remove fxp/composer-asset-plugin, rm -rf vendor and then againcomposer update.

sections with bower-asset-ignore are added by the plugin, that means that it worked instead of our asset-packagist repository

anyt commented 6 years ago

without plugin I have this at the lock file for autolinker

       {
            "name": "bower-asset/autolinker.js",
            "version": "1.4.4",
            "source": {
                "type": "git",
                "url": "https://github.com/gregjacobs/Autolinker.js.git",
                "reference": "355143d271c314e1cb68eb120b55450461927427"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/gregjacobs/Autolinker.js/zipball/355143d271c314e1cb68eb120b55450461927427",
                "reference": "355143d271c314e1cb68eb120b55450461927427",
                "shasum": null
            },
            "type": "bower-asset",
            "license": [
                "MIT"
            ]
        },

and in web folder it's lowercased also

MikeParkin commented 6 years ago

Thanks, we'll test and report back!

LRotherfield commented 6 years ago

Amazing, thanks @anyt that is working perfectly now, it was my confusion between removing the calls to the plugin in the composer.json and actually removing the plugin from composer.

Thanks again

anyt commented 6 years ago

Actually the plugin work, even if you didn't mention it at composer.json because of the same package naming strategy used by plugin and asset-packagist, the calls in composer.json just configure post-install actions to know where to copy assets after plugin will download deps, so it work even without any configs as soon as it met npm-asset/* or bower-asset/* dep in composer.json. But below configuration leds to disable plugin for the project, even if you have it installed. https://github.com/oroinc/platform-application/blob/master/composer.json#L45-L47

do you have this lines in composer.json?

LRotherfield commented 6 years ago

Hi @anyt, yes I have those lines in my composer.json, as above I had an exact copy of: https://github.com/oroinc/platform-application/blob/2.4/composer.json

anyt commented 6 years ago

Thank you, I'll investigate why it wasn't disable the plugin.