Comments (10)
I'll take a look at branching this and see what I come up.
from install-peerdeps.
It could certainly shell out to npm config get registry.
from install-peerdeps.
This would be a huge improvement. As far as I can tell, this project right now is unusable because our corporate requirements result in needing to use multiple regestries, which are separated by package namespaces:
Example
@my-corp/my-package
loads from private registry "A"@my-other-corp-group/my-package
loads from private registry "B"eslint
loads from a mirror of the public NPMJS.org registry, which is private registry "C"
from install-peerdeps.
Hmm, I'm not sure how that would work with npm config get registry
, which pulls a single value; if you're using scoped registries, npm install
figures that out by itself.
from install-peerdeps.
The point of this script is to install peer dependencies for a specified package, right? npm isntall
doesn't do that. So if a package has namespaced dependencies, it should be able to resolve those.
Seems this package could do that by just passing each found package to node install
via child_process.spawn()
. That's effectively what I'm having to build as a custom script instead of using this utility.
from install-peerdeps.
That's basically what it's already doing: https://github.com/nathanhleung/install-peerdeps/blob/master/src/install-peerdeps.js#L84-L103
Since it's using npm install
by default, in the proper directory, I'm not sure why it's not already working.
I think the issue is that getPackageData is making a direct request to the registry. I think the solution is, to shell out to npm show --json ${packageName}
, and use that data - that way the registry for the package will be taken from npmrc normally.
from install-peerdeps.
Yeah, since getPackageJson
calls getPackageData
, and passes the provided registry from the CLI option, it can only track across one registry. There's nothing in the NPM standard mandating dependencies are available in the same registry as the package referencing them.
from install-peerdeps.
A PR would be appreciated.
from install-peerdeps.
I'm not sure how to address it in this project without significant restructuring of the interfaces being exposed. In the script I've built privately, I've avoided all the registry and proxy passing entirely (that adds a huge amount of complexity with the corporate proxies I have to deal with). Instead of using the remote registry to get package data or npm show
, I'm just drilling into node_modules
to find a package.json like the peers-only
option does here. That's not particularly future-proof though and is a good design question for what this project wants to do.
from install-peerdeps.
It seems like just a refactor in getPackageJson
, you can leave getPackageData
intact and unused?
from install-peerdeps.
Related Issues (20)
- 'request' package needs to be replaced
- ERR spawn npm ENOENT HOT 21
- Fix issue with `child_process.spawn` on Windows
- Move tests to GitHub Actions, add Windows Tests HOT 11
- `ERR undefined` with v3.0.1 when running on Windows 10 HOT 5
- Feature request: Install from package.json
- Do we have the actual source code for this tool? HOT 3
- Cannot read property 'forEach' of undefined HOT 8
- should not error when there are no peer dependencies; just quietly install the package and move on HOT 3
- ERR: undefined when installing eslint-config-airbnb HOT 7
- --no-registry flag does not work HOT 2
- ERR Unexpected end of JSON input HOT 6
- `@babel/polyfill` warning HOT 3
- Install peer deps using absolute url
- `ERR undefined` with v3.0.3 install-peerdeps HOT 4
- Feature Request: Add ability to ignore some peerDependencies HOT 4
- load package version failure when using yarn@3
- --no-registry not work HOT 1
- install-peerdeps `ERR undefined` on windows HOT 6
- Support --ignore-scripts flag
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from install-peerdeps.