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

Install peerDependencies #40

Merged
merged 3 commits into from
Apr 24, 2016
Merged

Install peerDependencies #40

merged 3 commits into from
Apr 24, 2016

Conversation

ericclemmons
Copy link
Member

When using this webpack plugin in a project using @cycle/core which has rx as peer dependency I met an infinite loop:

node_modules/.bin/webpack
ts-loader: Using typescript@1.8.10 and /Users/chadrien/src/ml/tsconfig.json
Installing `@cycle/core`...
/Users/chadrien/src/ml
├── @cycle/core@6.0.3  extraneous
└── UNMET PEER DEPENDENCY rx@*

npm WARN @cycle/core@6.0.3 requires a peer of rx@* but none was installed.
npm WARN ml No description
npm WARN ml No repository field.
npm WARN ml No license field.
Installing `@cycle/core`...
/Users/chadrien/src/ml
├── @cycle/core@6.0.3  extraneous
└── UNMET PEER DEPENDENCY rx@*

npm WARN @cycle/core@6.0.3 requires a peer of rx@* but none was installed.
npm WARN ml No description
npm WARN ml No repository field.
npm WARN ml No license field.
Installing `@cycle/core`...
/Users/chadrien/src/ml
├── @cycle/core@6.0.3  extraneous
└── UNMET PEER DEPENDENCY rx@*

And going on until a hit ctrl-c

Maybe an approach to this would be to install the peer dependencies of a package if it has any.

@chadrien
Copy link
Author

My bad, I was hitting the infinite loop because I had neither a .npmrc nor setting {save: true} in the plugin configuration.

But the fact that peer dependencies could/should be installed as well remain

@ericclemmons
Copy link
Member

@chadrien Hey, I'm back from vacation. Funny, I use @cycle/core as my test to ensure namespaced dependencies are installed :)

Anyway, I think this is a great feature. It actually annoyed me how, with v3.1.0 nearing release, I still had to exit to the terminal to install rx.

Luckily it looks like this should be a cinch, as parsing the error from the previous install is possible and npm install accepts ranges:

$ npm install sax@">=0.1.0 <0.2.0"
$ npm install @myorg/privatepackage@">=0.1.0 <0.2.0" 

@ericclemmons ericclemmons added this to the 3.1.0 milestone Apr 22, 2016
@ericclemmons ericclemmons self-assigned this Apr 22, 2016
@ericclemmons ericclemmons changed the title Infinite loop when a package have peerDependency Install peerDependencies Apr 22, 2016
@ericclemmons
Copy link
Member

With #13 I'm going to change the save options to be either --save or --save-dev, which will solve the cyclical problem.

@ericclemmons
Copy link
Member

I can foresee this being a problem for any aliased package (e.g. react is aliased as react-lite) that we'd ignore UNMET PEER DEPENDENCY errors for.

However, I'm willing to overlook that, since it just means a duplicate dependency may be installed, but never used.

@ericclemmons
Copy link
Member

Ok, I think I got it!

peers

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

Successfully merging this pull request may close these issues.

2 participants