Do you want to request a _feature_ or report a _bug_?
Bug
If the current behavior is a bug, please provide the steps to reproduce.
Add this to your package.json
:
"scripts": {
"install": "yarn install --ignore-optional",
},
Run
yarn install
What is the current behavior?
> yarn install
yarn install v0.16.0
success Already up-to-date.
$ yarn install --ignore-optional
yarn install v0.16.0
success Already up-to-date.
$ yarn install --ignore-optional
yarn install v0.16.0
success Already up-to-date.
$ yarn install --ignore-optional
yarn install v0.16.0
success Already up-to-date.
$ yarn install --ignore-optional
Terminate batch job (Y/N)?
yarn install v0.16.0
Terminate batch job (Y/N)?
^C
What is the expected behavior?
No infinite loop. Perhaps copy what Composer does: emits this warning:
A script named install would override a Composer command and has been skipped
And then carries on with the built-in command.
Please mention your node.js, yarn and operating system version.
Node: v6.3.1
Yarn: 0.16.0
OS: Win10 Anniversary
Moving to #1374
Honestly this seems like intentional behaviour, I don't think we should do anything explicitly to detect a yarn
install command since we don't know the location of the original binary and any detection will be sloppy. install
is a valid lifecycle script hook and we're executing it correctly, there's nothing being ignored.
@kittens I was really confused by your response until I googled "npm lifecycle scripts" and came across this.
I actually didn't know that install
was a special thing that was _supposed_ to run after yarn/npm install
-- I thought it was just a regular script. I didn't know it would be triggered automatically after a yarn install
; I just wanted to run it manually via yarn run install
.
In that case, this does make perfect sense. Sorry @wyze and @thejameskyle -- thank you for taking my issue report seriously, but I think @kittens is actually right here. This was due to my own misunderstanding. I don't think you need to try to detect this situation.
Most helpful comment
Honestly this seems like intentional behaviour, I don't think we should do anything explicitly to detect a
yarn
install command since we don't know the location of the original binary and any detection will be sloppy.install
is a valid lifecycle script hook and we're executing it correctly, there's nothing being ignored.