-
Notifications
You must be signed in to change notification settings - Fork 17
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
Compatibility with yarn #10
base: master
Are you sure you want to change the base?
Conversation
Huh, I was under the impression that Yarn was using |
Seems they don't use |
Kind of, they don't support |
May you merge this please? |
Please don't be demanding to |
Ok, so the main delay here was that I wanted to verify that install was the only time Yarn would run Yarn has a publish command that runs the See: Because of that, this PR is going to need revision to detect that usage. |
Treating
This private fork does the trick: 'use strict'
function inCommand (cmd) {
try {
var npm_config_argv = JSON.parse(process.env['npm_config_argv'])
} catch (e) {
return false
}
if (typeof npm_config_argv !== 'object') process.exit(1)
if (!npm_config_argv.cooked) process.exit(1)
if (!npm_config_argv.cooked instanceof Array) process.exit(1)
var V
if (npm_config_argv.cooked[0] === 'run') npm_config_argv.cooked.shift()
while ((V = npm_config_argv.cooked.shift()) !== undefined) {
if (/^-/.test(V)) continue
if (cmd.test(V)) return true
return false
}
return false
}
exports.inPublish = function () {
return inCommand(/^(?:pre)?pu(b(l(i(sh?)?)?)?)?$/)
}
exports.inInstall = function () {
return inCommand(/^(?:pre)?i(n(s(t(a(ll?)?)?)?)?)?$/)
} I'd argue it's a breaking change, and would require a semver major bump. |
@garthk It's not clear to me what you're trying to change? Can you PR that so I can see a diff? |
Diff as requested in discussion on iarna#10. Not sure it'll work for all use cases, but it works for mine, so I've quietly forked it until `npm@4` comes along and straightens this mess out for everyone.
yarn
===npm install
alsoyarn
!==npm publish