Giter Club home page Giter Club logo

bower-license's Introduction

Bower License

Show a project's bower dependencies and their licenses

#Installation

npm install -g bower-license

#Usage Bower license comes in both command line and as an npm library:

bower-license

├─ highlight
│  └─ licenses: UNKNOWN
├─ [email protected]
│  └─ licenses: MIT*
├─ [email protected]
│  ├─ licenses: MIT*
│  └─ homepage: http://millermedeiros.github.com/js-signals/
├─ [email protected]
│  └─ licenses: MIT*
├─ [email protected]
│  ├─ licenses: UNKNOWN
│  └─ homepage: https://github.com/highslide-software/highcharts.com
├─ [email protected]
│  ├─ licenses: MIT*
│  └─ homepage: https://github.com/millermedeiros/Hasher
├─ jquery-throttle-debounce@undefined
│  ├─ licenses: MIT*
│  └─ homepage: https://github.com/cowboy/jquery-throttle-debounce
├─ [email protected]
│  ├─ licenses: MIT*
│  └─ repository: https://github.com/AceMetrix/jquery-deparam
├─ [email protected]
│  ├─ licenses: MIT*
│  └─ homepage: https://github.com/Modernizr/Modernizr
├─ [email protected]
│  ├─ licenses: MIT*
│  └─ homepage: https://github.com/DmitryBaranovskiy/raphael
├─ [email protected]
│  ├─ licenses: MIT*
│  ├─ homepage: https://github.com/kriskowal/es5-shim
│  └─ repository: http://github.com/kriskowal/es5-shim
├─ [email protected]
│  ├─ licenses: MIT*
│  ├─ homepage: https://github.com/vakata/jstree
│  └─ repository: https://github.com/vakata/jstree
├─ [email protected]
│  ├─ licenses
│  │  └─ 0: MIT
│  ├─ homepage: https://github.com/cujojs/meld
│  └─ repository: https://github.com/cujojs/meld
├─ keymaster@undefined
│  ├─ licenses: MIT*
│  ├─ homepage: https://github.com/madrobby/keymaster
│  └─ repository: https://github.com/madrobby/keymaster
├─ [email protected]
│  ├─ licenses: MIT*
│  ├─ homepage: https://github.com/knockout/knockout
│  └─ repository: https://github.com/SteveSanderson/knockout
├─ [email protected]
│  └─ licenses
│     └─ 0: MIT
└─ [email protected]
   ├─ licenses: Apache*
   └─ repository: https://github.com/twitter/bootstrap

Export options:

bower-license -e json

Used as a library:

var license = require('bower-license');
license.init({directory: '/path/to/bower_components'}, function(licenseMap, err){
    if (!err) {
        console.log(licenseMap);
    }
});

#Notes Any asterisks (*) after a license value were implictly discovered/detected by their README or LICENSE file and may not be truly reliable.

bower-license's People

Contributors

barryowens avatar eheikes avatar mojoaxel avatar mrestivill avatar plurch avatar richleland avatar sebthom avatar sudodoki avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bower-license's Issues

license check fails if package.json does not contain repository URL

We are getting the following exception in some of our projects.

/opt/node-6.3.0/lib/node_modules/bower-license/node_modules/npm-license/lib/index.js:32
                moduleInfo.repository = json.repository.url.replace('git://github.com', 'https://github.com').replace('.git', '');
                                                           ^

TypeError: Cannot read property 'replace' of undefined
    at flatten (/opt/node-6.3.0/lib/node_modules/bower-license/node_modules/npm-license/lib/index.js:32:60)
    at /opt/node-6.3.0/lib/node_modules/bower-license/node_modules/npm-license/lib/index.js:131:9
    at /opt/node-6.3.0/lib/node_modules/bower-license/node_modules/read-installed/read-installed.js:142:5
    at /opt/node-6.3.0/lib/node_modules/bower-license/node_modules/read-installed/read-installed.js:263:14
    at asyncMap (/opt/node-6.3.0/lib/node_modules/bower-license/node_modules/slide/lib/async-map.js:27:18)
    at next (/opt/node-6.3.0/lib/node_modules/bower-license/node_modules/read-installed/read-installed.js:234:5)
    at /opt/node-6.3.0/lib/node_modules/bower-license/node_modules/read-installed/read-installed.js:167:12
    at /opt/node-6.3.0/lib/node_modules/bower-license/node_modules/read-package-json/read-json.js:356:5
    at checkBinReferences_ (/opt/node-6.3.0/lib/node_modules/bower-license/node_modules/read-package-json/read-json.js:320:45)
    at final (/opt/node-6.3.0/lib/node_modules/bower-license/node_modules/read-package-json/read-json.js:354:3)

The reason is that some bower modules are missing a repository URL in their package.json.
We could work around it by changing in
/opt/node-6.3.0/lib/node_modules/bower-license/node_modules/npm-license/lib/index.js

    if (!unversioned[json.name]){
        if (json.repository) {
            if (typeof json.repository === 'object') {
                   moduleInfo.repository = json.repository.url.replace('git://github.com', 'https://github.com').replace('.git', '');
            }
    if (!unversioned[json.name]){
        if (json.repository) {
            if (typeof json.repository === 'object') {
                if(typeof json.repository.url === "string") // NEW: test if url actually is a string
                   moduleInfo.repository = json.repository.url.replace('git://github.com', 'https://github.com').replace('.git', '');
            }

Error when attempting to run through command line or gulp

I am receiving the following error when attempting to run bower-license in my directory which contains my bower_components and my bower.json file:

C:\Users\fangiot\Documents\Development\Moodys\ERSUI\component>bower-license
C:\Users\fangiot\AppData\Roaming\npm\node_modules\bower-license\node_modules\bower-json\node_modules\graceful-fs\polyfills.js:224
      throw er
            ^
Error: EISDIR, illegal operation on a directory
    at Error (native)
    at Object.fs.readSync (fs.js:552:19)
    at Object.fs.readSync (C:\Users\fangiot\AppData\Roaming\npm\node_modules\bower-license\node_modules\bower-json\node_modules\graceful-fs\polyfills.js:218:23)
    at Object.fs.readFileSync (fs.js:389:28)
    at module.exports (C:\Users\fangiot\AppData\Roaming\npm\node_modules\bower-license\node_modules\package-license\index.js:25:45)
    at C:\Users\fangiot\AppData\Roaming\npm\node_modules\bower-license\lib\index.js:48:41
    at C:\Users\fangiot\AppData\Roaming\npm\node_modules\bower-license\node_modules\npm-license\lib\index.js:144:9
    at C:\Users\fangiot\AppData\Roaming\npm\node_modules\bower-license\node_modules\npm-license\node_modules\read-installed\read-installed.js:138:5
    at C:\Users\fangiot\AppData\Roaming\npm\node_modules\bower-license\node_modules\npm-license\node_modules\read-installed\read-installed.js:251:14
    at asyncMap (C:\Users\fangiot\AppData\Roaming\npm\node_modules\bower-license\node_modules\npm-license\node_modules\read-installed\node_modules\slide\lib\async-map.js:27:18)

Any thoughts on how I might fix this?

In the gulp task, I have tried pointing it at both the base directory and the bower.json file to see if that helps, but I get similar errors.

Thanks!

Only works in current directory

I had to process.chdir() to my target directory in order for bower-license to work; it'd be nice if it behaved more like npm-license in that regard.

indexOf is not a function

Getting the following error when using bower-license against fullcalendar.
https://github.com/fullcalendar/fullcalendar

With the following license:
[{"type":"MIT","url":"https://github.com/fullcalendar/fullcalendar/blob/master/LICENSE.txt"}]

I was able to workaround by updating line 68 of index.js:
var iAsk = license.indexOf('');
to
var iAsk = license.indexOf ? license.indexOf('
') : -1;

Stack:
Z:\workspace_anaas_rto\Alert Notification Bluemix Software\src\node_modules\bower-license\lib\index.js:69
var iAsk = license.indexOf('*');
^

TypeError: license.indexOf is not a function
at Z:\workspace_anaas_rto\Alert Notification Bluemix Software\src\node_modules\bower-license\lib\index.js:69:49
at Array.filter (native)
at Function..filter..select (Z:\workspace_anaas_rto\Alert Notification Bluemix Software\src\node_modules\bower-license\node_modules\underscore\underscore.js:172:65)
at Z:\workspace_anaas_rto\Alert Notification Bluemix Software\src\node_modules\bower-license\lib\index.js:68:49
at Z:\workspace_anaas_rto\Alert Notification Bluemix Software\src\node_modules\bower-license\node_modules\npm-license\lib\index.js:134:9
at Z:\workspace_anaas_rto\Alert Notification Bluemix Software\src\node_modules\bower-license\node_modules\npm-license\node_modules\read-installed\read-installed.js:142:5
at Z:\workspace_anaas_rto\Alert Notification Bluemix Software\src\node_modules\bower-license\node_modules\npm-license\node_modules\read-installed\read-installed.js:263:14
at asyncMap (Z:\workspace_anaas_rto\Alert Notification Bluemix Software\src\node_modules\bower-license\node_modules\npm-license\node_modules\read-installed\node_modules\slide\lib\async-map.js:27:18)
at next (Z:\workspace_anaas_rto\Alert Notification Bluemix Software\src\node_modules\bower-license\node_modules\npm-license\node_modules\read-installed\read-installed.js:234:5)
at Z:\workspace_anaas_rto\Alert Notification Bluemix Software\src\node_modules\bower-license\node_modules\npm-license\node_modules\read-installed\read-installed.js:179:7

Callback parameters do not follow convention

Your callback function parameters are reversed when compared to conventional pattern of callback(err, data){}. Wrapping the init function into a Promise erroneously returns an error since the data is being passed as the first parameter.

license.init('/path/to/package', function(licenseMap, err){
    if (!err) {
        console.log(licenseMap);
    }
});

Error if package has directory called license

This is almost certainly an edge case for my workplace, but we have an internally published package where the license is in a directory called "license". This crashes the application with the following log.

I'm happy to create a PR to fix this as it's almost certainly trivial. However, what's the chances of the PR being merged?

C:\Code>node_modules\.bin\bower-license
C:\Code\node_modules\bower-json\node_modules\graceful-fs\polyfills.js:224
      throw er
      ^

Error: EISDIR: illegal operation on a directory, read
    at Object.fs.readSync (fs.js:675:18)
    at Object.fs.readSync (C:\Code\node_modules\bower-json\node_modules\graceful-fs\polyfills.js:218:23)
    at tryReadSync (fs.js:540:20)
    at Object.fs.readFileSync (fs.js:583:19)
    at module.exports (C:\Code\node_modules\package-license\index.js:25:45)
    at C:\Code\node_modules\bower-license\lib\index.js:60:41
    at C:\Code\node_modules\npm-license\lib\index.js:134:9
    at C:\Code\node_modules\read-installed\read-installed.js:142:5
    at C:\Code\node_modules\read-installed\read-installed.js:263:14
    at asyncMap (C:\Code\node_modules\slide\lib\async-map.js:27:18)

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.