mage2tv / magento-cache-clean

A faster drop in replacement for bin/magento cache:clean with file watcher
BSD 3-Clause "New" or "Revised" License
527 stars 61 forks source link

exchanged `vendor/bin/cache-clean.js` with `bin/cache-clean.js` #83

Closed aliuosio closed 3 years ago

Vinai commented 3 years ago

Hi @aliuosio,

I appreciate your PR, but I'm a bit surprised by it, too. Magento 2 doesn't specify a config.bin-dir in its compser.json, which means the utility would be installed into vendor/bin/ (which is the default value for bin-dir).

For global installs, the binary is installed into whatever is specified as the users composer bin-dir (by default ~/.composer/vendor/bin).

This means that a user wouldn't be able to run the command in the way you specify (unless they configure their project, or their global composer setup and their $PATH accordingly first).

Can you please explain your reasoning?

aliuosio commented 3 years ago

@Vinai i did a composer require --dev mage2tv/magento-cache-clean to a magento 2.2.9 installation The executable is sent to the same bin folder as bin/magento The behaviour is new to me too. i tought it was meant be like that now and you forgot the update the README.md

this is the composer.json

{
    "name": "magento/project-community-edition",
    "description": "eCommerce Platform for Growth (Community Edition)",
    "type": "project",
    "version": "2.1.0",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "ext-json": "*",
        "magento/product-community-edition": "2.2.9",
        "mageplaza/magento-2-spanish-language-pack": "*",
        "mageplaza/magento-2-italian-language-pack": "*",
        "mageplaza/magento-2-french-language-pack": "*",
        "mageplaza/magento-2-danish-language-pack": "*",
        "mageplaza/magento-2-dutch-language-pack": "*",
        "composer/composer": "@alpha",
        "league/pipeline": "0.3.0",
        "smile/elasticsuite": "~2.6.0",
        "snowdog/frontools": "^1.7",
        "snowdog/theme-blank-sass": "1.1.4",
        "heidelpay/magento2": "^20.5",
        "magento/data-migration-tool": "2.2.3",
        "magepal/magento2-gmailsmtpapp": "^2.6",
        "dhl/module-shipping-m2": "0.10.3",
        "faonni/module-re-captcha": "^2.0",
        "amzn/amazon-payments-magento-2-plugin": "^2.0.16",
        "splendidinternet/mage2-locale-de-de": "^1.54",
        "dvdoug/boxpacker": "^2.6"
    },
    "require-dev": {
        "phpunit/phpunit": "4.1.0",
        "squizlabs/php_codesniffer": "1.5.3",
        "phpmd/phpmd": "@stable",
        "pdepend/pdepend": "2.2.2",
        "fabpot/php-cs-fixer": "~1.2",
        "lusitanian/oauth": "~0.3 <=0.7.0",
        "sebastian/phpcpd": "2.0.0",
        "mage2tv/magento-cache-clean": "^1.0"
    },
    "config": {
        "use-include-path": true,
        "bin-dir": "bin"
    },
    "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/"
        },
        "psr-0": {
            "": "app/code/"
        },
        "files": [
            "app/etc/NonComposerComponentRegistration.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
            "Magento\\Tools\\": "dev/tools/Magento/Tools/",
            "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
            "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
            "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "repositories": {
        "magento": {
            "type": "composer",
            "url": "https://repo.magento.com/"
        },           
},
    "extra": {
        "magento-force": "override"
    }
}
Vinai commented 3 years ago

Interesting. According to the composer documentation there are two ways to configure the bin dir location:

  1. by configuring it in the root composer.json at config.bin-dir
  2. by using the environment variable COMPOSER_BIN_DIR

Since the coposer.json you posted doesn't have the bin-dir set, maybe somehow the environment points to the bin/ directory? Can you check?

aliuosio commented 3 years ago

@Vinai Haha... we both overlooked the bin Directory in the composer.json i posted.

see

    "config": {
        "use-include-path": true,
        "bin-dir": "bin"
    },`

Is me right?

aliuosio commented 3 years ago

@Vinai So ignore my pull request, please

Vinai commented 3 years ago

Ups, funny! I Ctrl-F searched for "bin-dir", but somehow must have made a typo or something - completely missed it 👍 Thanks anyhow for the PR, love to see people using the utility 😄

aliuosio commented 3 years ago

Thanks for this open source utility. Chapeau