LoginSignup
3
3

More than 5 years have passed since last update.

grunt-license-reportをREADME通りにインストールして使えない人向けの記事

Posted at

Node.jsを使ってサービスを作っている時に、npmでインストールしたライブラリのライセンスを調べる必要性が出てきたので、ライセンスの一覧表的な物を生成できないか調べてみた。

結論

生成できた

レベルで言うとどの位の人向けの記事?

npmとgrunt-cliが分かるレベルの人向け

どのぐらい適当な記事?

動けば良いや程度の記事(Gruntfile.js以外は理解した上で書いています)

やり方

メモ: grunt-license-reportのリポジトリなのだが、少し修正しないと動かない部分があるので記事にした
https://github.com/Fkscorpion/grunt-license-report

package.json
{
  "name": "必須",
  "version": "必須",
  "dependencies": {
  },
  "devDependencies": {
    "grunt": "^1.0.1",
    "grunt-license-report": "0.0.8"
  }
}

↑dependenciesの部分に使いたいライブラリ名等を入れておくこと

Gruntfile.js
module.exports = function (grunt) {
  grunt.loadNpmTasks('grunt-license-report');

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    "grunt-license-report": {
      output: {
        path: './report/licenses',
        format: 'html'
      }
    }
  });
};
console
$ npm install
$ grunt grunt-license-report

↓Done.が出ればOK (入れてるライブラリで表示変わると思う)

Running "grunt-license-report" task
scanning ./
>> UNKNOWN LICENSE for arraybuffer.slice@0.0.6
>> UNKNOWN LICENSE for better-assert@1.0.2
>> UNKNOWN LICENSE for blob@0.0.4
>> UNKNOWN LICENSE for callsite@1.0.0
>> UNKNOWN LICENSE for component-bind@1.0.0
>> UNKNOWN LICENSE for component-emitter@1.1.2
>> UNKNOWN LICENSE for component-inherit@0.0.3
>> UNKNOWN LICENSE for express-resource@1.0.0
>> UNKNOWN LICENSE for indexof@0.0.1
>> UNKNOWN LICENSE for options@0.0.6
File ./report/licenses.html created.

Done.

./report/licenses.html を見てこのような表が生成されていれば成功です。
スクリーンショット 2017-02-10 16.27.16.png

参考にした記事

http://qiita.com/ymstmsys/items/c77b52fda7dc69d8f22f

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3