-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
How to suppress prepublish
hook on yarn install
#684
Comments
You can do this compatibly with the |
|
@acarl005 Can you clarify which version of yarn you are using, please? For me it's still doesn't work on "scripts": {
"prepublish": "node -e \"console.log(process.env['npm_config_argv'])\""
}, $ yarn
yarn install v0.15.1
success Already up-to-date.
$ node -e "console.log(process.env['npm_config_argv'])"
undefined
Done in 0.38s. Meanwhile npm works as expected: $ npm install
> [email protected] prepublish d:\Work\test-project
> node -e "console.log(process.env['npm_config_argv'])"
{"remain":[],"cooked":["install"],"original":["install"]} I'm on Windows 8.1 if it matters. |
@inikulin I'm using yarn {
"prepublish": "in-publish && source ./scripts/prepublish.sh || not-in-publish"
} I'm on OSX btw. |
Well, it still doesn't work properly. It just hits that line: https://github.com/iarna/in-publish/blob/master/index.js#L6 there it can't parse ❯ yarn
yarn install v0.15.1
success Already up-to-date.
$ in-publish && echo "Publish" || echo "Not in publish"
Not in publish ❯ yarn publish
yarn publish v0.15.1
[1/4] Bumping version...
info Current version: 1.0.0
question New version: 1.1.1
info New version: 1.1.1
[2/4] Logging in...
question npm username: inikulin
question npm email: [email protected]
question npm password:
success Logged in.
[3/4] Publishing...
$ in-publish && echo "Publish" || echo "Not in publish"
Not in publish \cc @kittens |
I see. It worked for me insofar as it suppressed the It would still be nice if yarn provided an analogous environment variable, like |
It would need to provide the exact same environment variable - |
I guess it will be a bit complicated, because you need to map yarn commands to npm commands. In meantime having some marker variables like |
I know that full backwards-compatibility is unrealistic. But having some marker variable would but great. Then I could write (and possibly publish) my own script to work for both yarn and npm. Either that or someone will update |
I'm working on a fix |
as far as I can see npm doesn't run prepublish as of v5. should yarn also switch? |
^ I think so. Its murder to try and install a few packages in a big lerna monorepo |
Agree |
node v6.5.0
yarn v0.15.1
NPM provides some shell environment variables during the installation process. I use one of them to suppress the
prepublish
hook afternpm install
, for I find it counterintuitive. Here is an example in aprepublish.sh
.$npm_config_argv
is not present onyarn install
, so this throws a SyntaxError. It would be a nice feature if yarn provided something analogous.The text was updated successfully, but these errors were encountered: