scarf-sh / scarf-js

Installation analytics for your npm package
https://scarf.sh
Apache License 2.0
157 stars 12 forks source link

Yarn support #3

Open aviaviavi opened 4 years ago

aviaviavi commented 4 years ago

Right now Scarf uses npm ls output to determine dependency info for finding scarfSettings in a package.json. We'll need parity for users that are using yarn.

aviaviavi commented 4 years ago

Due to https://github.com/yarnpkg/yarn/issues/5476, yarn support in scarf-js seems challenging as it looks like we can't print anything to the console during postintsall. It looks like we could still fire off analytics calls since the script will get run, but not being able to tell the user what we're doing is a serious limitation. I'll be investigating more.

zenflow commented 4 years ago

@aviaviavi What about the other package scripts, preinstall & install? https://classic.yarnpkg.com/en/docs/package-json#toc-scripts

If none of them work I would open up an issue with Yarn.

aviaviavi commented 4 years ago

Great idea @zenflow - I did some testing and unfortunately it looks like for transitive dependencies (which scarf-js typically is) each of the preinstall, postinstall and install scripts are not hooked up to stdout in yarn even though people have asked (see https://github.com/yarnpkg/yarn/issues/6971, yarnpkg/yarn#5476). So we're still in a position where we can't inform users about analytics when using yarn, so scarf-js will have to continue to be disabled until something there changes.

It seems like this request has already been essentially rejected but maybe it's worth opening up a new issue anyway?