GithubHelp home page GithubHelp logo

morficus / license-ls Goto Github PK

View Code? Open in Web Editor NEW
19.0 2.0 6.0 729 KB

Get a list of licenses used by a projects dependencies

License: MIT License

JavaScript 100.00%
license licenses ls list npm-ls package report reporter spdx spdx-license

license-ls's People

Contributors

dependabot[bot] avatar lahmatiy avatar morficus avatar paulogoncalvesbh avatar

Stargazers

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

Watchers

 avatar  avatar

license-ls's Issues

Add support for SPDX expressions

npm allows the "license" field in package.json to have either just an spdx value (such as "MIT") or an spdx expression (such as "(MIT OR Apache-2.0)")

currently this tool does not have support for expressions and will report them as unknown ((MIT OR Apache-2.0)) when attempting to display the full license name.

This would be a good module to use to make things easier: https://www.npmjs.com/package/spdx-expression-parse

Ability to specify custom labels

when formatting the output as a table, the header values are fixed.
it would be convenient to allow user to specify custom names for each column

license-ls does not work with npm@7 and hangs forever

license-ls does not work with npm@7 and hangs forever

Using [email protected] with npm 7.19.0 does not work: it produces no output and does not terminate.

How to reproduce?

Simply run license-ls with npm@latest

Details

7.19.0

...\license-ls> set DEBUG=license-ls
...\license-ls> node cli.js --depth=0 --prod > NUL
- Analyzing  license-ls Got these options: [
  "--depth=0",
  "--prod=true",
  "--production=true",
  "--include=id,name,version,license,repository,author,homepage,dependencyLevel",
  "--csv=[object Object]",
  "--table=[object Object]",
  "--xml=[object Object]"
] +0ms
- Analyzing  license-ls The `node ls` command exited with the following code: 0 +619ms
  license-ls Total paths found: 1 +0ms
  license-ls Dependency paths: [ '7.19.0' ] +0ms
(node:16820) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, lstat '...\license-ls\7.19.0'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16820) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To term
inate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:16820) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
/ Analyzing

The spinner before Analyzing keeps spinning forever and you have to termine license-ls manually.

Error causes

The cuplrit seems to be that npm 7 changed the argument handling drastically:

...\license-ls> npm -v
6.14.13

...\license-ls> npm list --parseable --prod --depth=0 "--csv=[object Object]"
...\license-ls
...\license-ls\node_modules\cross-spawn
...\license-ls\node_modules\debug
...\license-ls\node_modules\glob
...\license-ls\node_modules\json2csv
...\license-ls\node_modules\jstoxml
...\license-ls\node_modules\lodash
...\license-ls\node_modules\ora
...\license-ls\node_modules\read-package-tree
...\license-ls\node_modules\spdx-expression-parse
...\license-ls\node_modules\spdx-license-list
...\license-ls\node_modules\table
...\license-ls\node_modules\yargs

...\license-ls>
...\license-ls>npm -v
7.19.0

...\license-ls>npm list --parseable --prod --depth=0 "--csv=[object Object]"
7.19.0

...\license-ls>

When license-ls is started with [email protected] npmList(...) returns ['7.19.0'] as package list.
This in turn leads to a Error: ENOENT which is not handled and the spinner keeps spinning.

(The hang only occurs in an interactive TTY as ora does not animate the spinners when
license-ls is started by other means)

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.