Skip to content
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

Doesn't work with yarn's workspace #24

Closed
zhouzi opened this issue Mar 24, 2018 · 3 comments
Closed

Doesn't work with yarn's workspace #24

zhouzi opened this issue Mar 24, 2018 · 3 comments
Assignees

Comments

@zhouzi
Copy link

zhouzi commented Mar 24, 2018

When adding a package to a yarn's workspace-enabled multi packages repository, it fails to add a package because the command needs the -W flag. From my understanding, arguments are not passed through.

To reproduce this bug:

  1. In a new folder, create a package.json with:
    {
    	"private": true,
    	"workspaces": ["packages/*"]
    }
  2. Run yarn
  3. Run install-peerdeps <package> --dev -W -Y

The command fails with:

Running this command will add the dependency to the workspace root rather than workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).

@nathanhleung
Copy link
Owner

nathanhleung commented Mar 24, 2018

Thanks for the issue. I can push a fix in a few days - but if you need a fix immediately please feel free to submit a pull request.

You'd need to add the option here: https://github.com/nathanhleung/install-peerdeps/blob/master/src/cli.js#L41

And then pass it in the options object here: https://github.com/nathanhleung/install-peerdeps/blob/master/src/cli.js#L129

And finally add the -W flag here: https://github.com/nathanhleung/install-peerdeps/blob/master/src/install-peerdeps.js#L178

I can take care of releasing/docs. Let me know!

If not, keep an eye out for a release from me in a few days.

@zhouzi
Copy link
Author

zhouzi commented Mar 24, 2018

No problem, I went the plain old way and simply installed the peer dependencies one by one. I was giving install-peerdeps a try for the first time and assumed that arguments were passed through. Apparently, it's more complicated than I thought. 😊

@nathanhleung
Copy link
Owner

In v1.7.0 extra args can be passed through using --. In your case, you can update (yarn global add install-peerdeps) and then run install-peerdeps <package> --dev -Y -- -W.

Hope this helps if you ever choose to use this package again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants