morficus / license-ls Goto Github PK
View Code? Open in Web Editor NEWGet a list of licenses used by a projects dependencies
License: MIT License
Get a list of licenses used by a projects dependencies
License: MIT License
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
Using [email protected] with npm 7.19.0 does not work: it produces no output and does not terminate.
Simply run license-ls
with npm@latest
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.
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)
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
Getting a spawn error on Windows. Probably need to use npx
or npm.cmd
instead.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.