I'm facing a small issue here. I'm trying to use composer's script to lint my PHP project. So far what I've done is have a composer file, and enter some scripts in them. My snippet of composer file looks something like this:
"scripts": {
"document": "vendor/bin/apigen generate -s ./src -d ./docs",
"codecept": "vendor/bin/codecept",
"test": "vendor/bin/codecept run",
"lint": "vendor/bin/phpcs --standard=PSR2 src",
"bootstrap": "composer install && composer codecept bootstrap"
}
I've already defined dependencies and it works perfectly on POSIX compliant machines (MAC/Linux based OS), but when someone who is using windows wants to use any of the scripts, it simply doesn't work.
Problem I'm facing is, I've got /
as directory separator but windows understands \
I thought windows was smart enough to automatically convert this.
Dirty solution what I'm thinking of would be to have windows-lint command which is really really annoying. I just wanted to know what other people are doing when they want to work on multiple OS.
Thanks in advance!
Just use scripts without specifying vendor/bin
path, it will be done by composer automatically, see the Note section in https://getcomposer.org/doc/articles/scripts.md#writing-custom-commands
"scripts": {
"document": "apigen generate -s ./src -d ./docs",
"codecept": "codecept",
"test": "codecept run",
"lint": "phpcs --standard=PSR2 src",
"bootstrap": "composer install && composer codecept bootstrap"
}