Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer scripts from README shouldn't run in non-dev mode #1244

Open
robolmos opened this issue Nov 28, 2020 · 6 comments
Open

Composer scripts from README shouldn't run in non-dev mode #1244

robolmos opened this issue Nov 28, 2020 · 6 comments

Comments

@robolmos
Copy link

README has these lines for the scripts:

"scripts": {
    "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
    "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
}

But when php-compatibility is in the require-dev section, the scripts should be like this so they don't run and error in non-dev mode, such as running composer update --lock --no-dev

"scripts": {
    "post-install-cmd": "[ $COMPOSER_DEV_MODE -eq 0 ] || \"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
    "post-update-cmd" : "[ $COMPOSER_DEV_MODE -eq 0 ] || \"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
}

Thanks for the continued effort on this helpful project!

@jrfnl
Copy link
Member

jrfnl commented Nov 28, 2020

@robolmos Oh, nice! I'd looked for something like that before, but hadn't come across that environment variable at the time. Will this also work as-is on non-*nix systems ?

FYI: we're nearing the end of the dev cycle for version 10.0.0. As of that version, you won't need these scripts anymore, as PHPCompatibility will install (require) a Composer plugin which will handle this automatically.

@robolmos
Copy link
Author

robolmos commented Nov 29, 2020

@jrfnl Good question. I'm not sure about non-*nix systems (most likely it wouldn't for something like Win CMD or Powershell) and unfortunately don't have one easily accessible to test with at the moment. Thanks for the heads up.

@willrowe
Copy link

Just ran into this issue when deploying to a non-dev server. I should have thought of it, but the README should also be updated.

@elistone
Copy link

+1 that this should be added to the readme, was having issues with deployments.

@jrfnl
Copy link
Member

jrfnl commented Jan 19, 2022

I hear you all. I'm really hoping to be able to get back to this project soonish, which would lead to the release of 10.0. With the changes in that, you won't need the scripts anymore, so that should solve the issue either way.

For now, I'm leaving this issue open to make it easier to find if people run into this in the mean time.

@willrowe
Copy link

Thanks @jrfnl! Is there anything you could use help with for v10?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants