Giter Club home page Giter Club logo

npm-remote-ls's Introduction

npm-remote-ls

Build Status Coverage Status NPM version Standard Version

Examine a package's dependency graph before you install it.

Installation

npm install npm-remote-ls -g

Usage

Listing Package Dependencies

Help!

There are various command line flags you can toggle for npm-remote-ls, for details run:

npm-remote-ls --help

API

Return dependency graph for latest version:

var ls = require('npm-remote-ls').ls;

ls('grunt', 'latest', function(obj) {
  console.log(obj);
});

Return dependency graph for specific version:

var ls = require('npm-remote-ls').ls;

ls('grunt', '0.1.0', function(obj) {
  console.log(obj);
});

Return a flattened list of dependencies:

var ls = require('npm-remote-ls').ls;

ls('grunt', '0.1.0', true, function(obj) {
  console.log(obj);
});

Configure to only return production dependencies:

var ls = require('npm-remote-ls').ls
var config = require('npm-remote-ls').config

config({
  development: false,
  optional: false
})

ls('yargs', 'latest', true, function (obj) {
  console.log(obj)
})

Configure to return peer dependencies:

var ls = require('npm-remote-ls').ls
var config = require('npm-remote-ls').config

config({
  development: true,
  peer: true
})

ls('grunt-contrib-coffee', 'latest', true, function (obj) {
  console.log(obj)
})

License

ISC

npm-remote-ls's People

Contributors

bcoe avatar domcleal avatar dylang avatar nexdrew avatar othiym23 avatar pixnbits avatar waldyrious avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

npm-remote-ls's Issues

Larger flatten'd output is truncated to 101 items

I am seeing truncated flatten'd output to 101 items as below:

$ npm-remote-ls -f gulp-iconfont
[ '[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
... 394 more items ]

Memoize request to registry

Since npm-remote-ls fetch the info for all the versions of a module stored on the registry there's no need to ask for it each time, so memoize/cache the results and use them instead of doing a new request. The async module already being used has a function just for it.

Add metadata to the returned tree

Instead of return just a tree with the dependencies, return instead a tree of objects with a dependencies entry and some basic metadata like name, version, repo url... or better than this, the full object from packageJson.versions[version], replacing version strings from the dependencies object values with the content of the child ones. I know this will break compatibility so it will be needed to release a major version, but I think the extra information data will compensate it. I can do a pull-request for this myself.

Follow standard node callback style and include `err` parameter.

Since this is an asynchronous operation, this:

ls('grunt', '0.1.0', true, function(obj) { /* ... */ });

Should be:

ls('grunt', '0.1.0', true, function(err, obj) { /* ... */ });

If there is a network error, npm is down, there is no internet, or any other failure then there is no way to communicate that to the calling code. The calling code simply gets an empty list back, which it can't differentiate from a package with no dependencies. This module appears to sometimes print error messages directly to the console, which isn't an OK way to report errors.

Additionally, it's not possible to use anything like bluebird to promisify this library since bluebird expects callback-based code to follow standard node callbacks.

I recognize this would be a breaking change unfortunately, but is much more "node-y" and would improve the library to behave like most of the node ecosystem expects :)

Support scoped packages

Packages with scoped names (e.g. @scope/pkg) need to have the slash URL-encoded (e.g. @scope%2Fpkg), for any package name given to ls() or any dependencies encountered. Otherwise, the Couch registry returns 404.

This currently blocks the ability to manually add a scoped package to the whitelist in npm Enterprise (called via package-whitelist).

npme add-package @kadira/storybook
analyzing dependencies for @kadira/storybook:
Cannot convert undefined or null to object
[]
[?] add dependencies to /etc/npme/data/whitelist? (Y/n)
could not load @kadira/storybook@* status = 404

Command Line and API both timing out when fetching dependencies (for a big repo)

Repo is @storybook/vue, it has roughly 800 dependencies. It should not matter however. The weird thing is the problem is intermittent. It was offline for a while (a few days, I guess), and then was working for me yesterday until around 5pm Amsterdam time. I finally traced the issue in my app back to this library. You can reproduce the error using the API and the command line.

(error truncated for brevity)
Command

npm-remote-ls --name @storybook/vue --version 4.0.7

Error

could not load dom-walk@^0.1.0 error = connect ETIMEDOUT 104.16.18.35:443
could not load commander@^2.19.0 error = connect ETIMEDOUT 104.16.25.35:443
could not load global@^4.3.2 error = connect ETIMEDOUT 104.16.19.35:443
could not load webpack-dev-middleware@^3.4.0 error = connect ETIMEDOUT 104.16.19.35:443
could not load @babel/helper-plugin-utils@^7.0.0 error = connect ETIMEDOUT 104.16.22.35:443
could not load @babel/plugin-transform-sticky-regex@^7.0.0 error = connect ETIMEDOUT 104.16.19.35:443
...

Please help!

Support local directories with a package.json

When working on the source code of a module, it would be nice if npm-remote-ls was able to list the transitive dependencies of that local module by pointing it at the directory containing the package.json file.

[BUG] Does not work with URLs as dependencies

What / Why

The package.json syntax supports URLs as dependencies but npm-remote-ls doesn't seem to recognize them.

Current Behavior

Any references to dependencies which use URL (i.e. git) syntax do not resolve.

Steps to Reproduce

Use a dependency reference that uses URLs syntax.

Expected Behavior

All valid dependency syntax supported by npm package.json would be supported by this library.

References

Can we have flags to igonre the following outputs?

Hi
when we do npm-remote-ls -f -n "xxx"

We sometimes got these messages , I guess it is from npm itself.
Is there a way to have a flag to supress the message?
Thanks

could not find a satisfactory version for string github:bestiejs/benchmark.js
could not find a satisfactory version for string https://github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz
could not find a satisfactory version for string https://github.com/component/global/archive/v2.0.1.tar.gz
[ '[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.