From dd07b9fcb8795da7e23c93e1d12467167a8ff831 Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Mon, 8 Aug 2016 09:30:12 +0100 Subject: [PATCH] Add grunt license checker (#359) --- .gitignore | 1 + Gruntfile.js | 369 +++++++++++++++++++++++++---------------------- license/LICENSES | 138 ++++++++++++++++++ package.json | 2 + 4 files changed, 336 insertions(+), 174 deletions(-) create mode 100644 license/LICENSES diff --git a/.gitignore b/.gitignore index 544c9b50c..c647bb32d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ git-svn-diff.py *.~ *.log application/sessions/* +.licenses diff --git a/Gruntfile.js b/Gruntfile.js index a3e10e1ed..9e12adb55 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,26 +1,26 @@ module.exports = function(grunt) { grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - wiredep: { - task: { - ignorePath: '../../../', - src: ['application/views/partial/header_debug.php'] - } - }, - bower_concat: { - all: { - mainFiles: { - 'bootswatch-dist': ['bootstrap/dist/js/bootstrap.js'], - 'bootstrap-table': [ "src/bootstrap-table.js", "src/bootstrap-table.css", "dist/extensions/export/bootstrap-table-export.js", "dist/extensions/mobile/bootstrap-table-mobile.js"] - }, - dest: { - 'js': 'tmp/opensourcepos_bower.js', - 'css': 'tmp/opensourcepos_bower.css' - } - } - }, - bowercopy: { + pkg: grunt.file.readJSON('package.json'), + wiredep: { + task: { + ignorePath: '../../../', + src: ['application/views/partial/header_debug.php'] + } + }, + bower_concat: { + all: { + mainFiles: { + 'bootswatch-dist': ['bootstrap/dist/js/bootstrap.js'], + 'bootstrap-table': [ "src/bootstrap-table.js", "src/bootstrap-table.css", "dist/extensions/export/bootstrap-table-export.js", "dist/extensions/mobile/bootstrap-table-mobile.js"] + }, + dest: { + 'js': 'tmp/opensourcepos_bower.js', + 'css': 'tmp/opensourcepos_bower.css' + } + } + }, + bowercopy: { options: { // Bower components folder will be removed afterwards // clean: true @@ -42,164 +42,185 @@ module.exports = function(grunt) { // add here anything that should be copied in a tmp directory } }*/ - }, - cssmin: { - target: { - files: { - 'dist/<%= pkg.name %>.min.css': ['tmp/opensourcepos_bower.css', 'css/*.css', '!css/login.css', '!css/invoice_email.css'] - } - } - }, - concat: { - js: { - options: { - separator: ';' - }, - files: { - 'dist/<%= pkg.name %>.js': ['tmp/opensourcepos_bower.js', 'js/jquery*', 'js/*.js'] - } - }, - sql: { - options: { - banner: '-- >> This file is autogenerated from tables.sql and constraints.sql. Do not modify directly << --' - }, - files: { - 'database/database.sql': ['database/tables.sql', 'database/constraints.sql'], - 'database/migrate_phppos_dist.sql': ['database/tables.sql', 'database/phppos_migrate.sql', 'database/constraints.sql'] - } - } - }, - uglify: { - options: { - banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n' - }, - dist: { - files: { - 'dist/<%= pkg.name %>.min.js': ['dist/<%= pkg.name %>.js'] - } - } - }, - jshint: { - files: ['Gruntfile.js', 'js/*.js'], - options: { - // options here to override JSHint defaults - globals: { - jQuery: true, - console: true, - module: true, - document: true - } - } - }, - tags: { - css_header: { - options: { - scriptTemplate: '', - openTag: '', - closeTag: '', - absolutePath: true - }, - src: ['css/*.css', '!css/login.css', '!css/invoice_email.css'], - dest: 'application/views/partial/header_debug.php', - }, - mincss_header: { - options: { - scriptTemplate: '', - openTag: '', - closeTag: '', - absolutePath: true - }, - src: ['dist/*.css'], - dest: 'application/views/partial/header.php', - }, - mincss_header_templates: { - options: { - scriptTemplate: '', - openTag: '', - closeTag: '', - absolutePath: true - }, - src: ['dist/*.css', '!dist/bootstrap.min.css'], - dest: 'templates/spacelab/views/partial/header.php' - }, - css_login: { - options: { - scriptTemplate: '', - openTag: '', - closeTag: '', - absolutePath: true - }, - src: ['dist/bootstrap.min.css', 'css/login.css'], - dest: 'application/views/login.php' - }, - js: { - options: { - scriptTemplate: '', - openTag: '', - closeTag: '', - absolutePath: true - }, - src: ['js/jquery*', 'js/*.js'], - dest: 'application/views/partial/header_debug.php' - }, - minjs: { - options: { - scriptTemplate: '', - openTag: '', - closeTag: '', - absolutePath: true - }, - src: ['dist/*min.js'], - dest: 'application/views/partial/header.php' - } - }, - mochaWebdriver: { - options: { - timeout: 1000 * 60 * 3 - }, - test : { - options: { - usePhantom: true, - usePromises: true - }, - src: ['test/**/*.js'] - } - }, - watch: { - files: ['<%= jshint.files %>'], - tasks: ['jshint'] - }, - cachebreaker: { - dev: { - options: { - match: [ { - 'opensourcepos.min.js': 'dist/opensourcepos.min.js', - 'opensourcepos.min.css': 'dist/opensourcepos.min.css', - 'bootstrap.min.css': 'dist/bootstrap.min.css' - } ], - replacement: 'md5' - }, - files: { - src: ['**/header.php', '**/login.php'] - } - } - }, - license: { - all: { - // Target-specific file lists and/or options go here. - options: { - // Target-specific options go here. - directory: 'bower_components', - output: 'license/LICENSES' - } - } - } + }, + cssmin: { + target: { + files: { + 'dist/<%= pkg.name %>.min.css': ['tmp/opensourcepos_bower.css', 'css/*.css', '!css/login.css', '!css/invoice_email.css'] + } + } + }, + concat: { + js: { + options: { + separator: ';' + }, + files: { + 'dist/<%= pkg.name %>.js': ['tmp/opensourcepos_bower.js', 'js/jquery*', 'js/*.js'] + } + }, + sql: { + options: { + banner: '-- >> This file is autogenerated from tables.sql and constraints.sql. Do not modify directly << --' + }, + files: { + 'database/database.sql': ['database/tables.sql', 'database/constraints.sql'], + 'database/migrate_phppos_dist.sql': ['database/tables.sql', 'database/phppos_migrate.sql', 'database/constraints.sql'] + } + } + }, + uglify: { + options: { + banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n' + }, + dist: { + files: { + 'dist/<%= pkg.name %>.min.js': ['dist/<%= pkg.name %>.js'] + } + } + }, + jshint: { + files: ['Gruntfile.js', 'js/*.js'], + options: { + // options here to override JSHint defaults + globals: { + jQuery: true, + console: true, + module: true, + document: true + } + } + }, + tags: { + css_header: { + options: { + scriptTemplate: '', + openTag: '', + closeTag: '', + absolutePath: true + }, + src: ['css/*.css', '!css/login.css', '!css/invoice_email.css'], + dest: 'application/views/partial/header_debug.php', + }, + mincss_header: { + options: { + scriptTemplate: '', + openTag: '', + closeTag: '', + absolutePath: true + }, + src: ['dist/*.css'], + dest: 'application/views/partial/header.php', + }, + mincss_header_templates: { + options: { + scriptTemplate: '', + openTag: '', + closeTag: '', + absolutePath: true + }, + src: ['dist/*.css', '!dist/bootstrap.min.css'], + dest: 'templates/spacelab/views/partial/header.php' + }, + css_login: { + options: { + scriptTemplate: '', + openTag: '', + closeTag: '', + absolutePath: true + }, + src: ['dist/bootstrap.min.css', 'css/login.css'], + dest: 'application/views/login.php' + }, + js: { + options: { + scriptTemplate: '', + openTag: '', + closeTag: '', + absolutePath: true + }, + src: ['js/jquery*', 'js/*.js'], + dest: 'application/views/partial/header_debug.php' + }, + minjs: { + options: { + scriptTemplate: '', + openTag: '', + closeTag: '', + absolutePath: true + }, + src: ['dist/*min.js'], + dest: 'application/views/partial/header.php' + } + }, + mochaWebdriver: { + options: { + timeout: 1000 * 60 * 3 + }, + test : { + options: { + usePhantom: true, + usePromises: true + }, + src: ['test/**/*.js'] + } + }, + watch: { + files: ['<%= jshint.files %>'], + tasks: ['jshint'] + }, + cachebreaker: { + dev: { + options: { + match: [ { + 'opensourcepos.min.js': 'dist/opensourcepos.min.js', + 'opensourcepos.min.css': 'dist/opensourcepos.min.css', + 'bootstrap.min.css': 'dist/bootstrap.min.css' + } ], + replacement: 'md5' + }, + files: { + src: ['**/header.php', '**/login.php'] + } + } + }, + 'bower-licensechecker': { + options: { + /*directory: 'path/to/bower',*/ + acceptable: [ 'MIT', 'BSD', 'LICENSE.md' ], + printTotal: true, + warn: { + nonBower: true, + noLicense: true, + allGood: true, + noGood: true + }, + log: { + outFile: '.licenses', + nonBower: true, + noLicense: true, + allGood: true, + noGood: true, + } + } + }, + license: { + all: { + // Target-specific file lists and/or options go here. + options: { + // Target-specific options go here. + directory: 'bower_components', + output: 'license/LICENSES' + }, + }, + }, }); require('load-grunt-tasks')(grunt); grunt.loadNpmTasks('grunt-mocha-webdriver'); - grunt.loadNpmTasks('grunt-license-bower'); + grunt.loadNpmTasks('grunt-bower-licensechecker'); + grunt.loadNpmTasks('grunt-license-bower'); - grunt.registerTask('default', ['wiredep', 'bower_concat', 'bowercopy', 'concat', 'uglify', 'cssmin', 'tags', 'cachebreaker']); + grunt.registerTask('default', ['wiredep', 'bower_concat', 'bowercopy', 'concat', 'uglify', 'cssmin', 'tags', 'cachebreaker', 'bower-licensechecker', 'license']); }; diff --git a/license/LICENSES b/license/LICENSES new file mode 100644 index 000000000..a93f9453c --- /dev/null +++ b/license/LICENSES @@ -0,0 +1,138 @@ +{ + "chartist-plugin-pointlabels@0.0.4": { + "licenses": [ + "WTF*" + ] + }, + "jquery-form@3.45.0": { + "licenses": "UNKNOWN" + }, + "bootstrap3-dialog@1.35.2": { + "licenses": "UNKNOWN", + "homepage": "http://nakupanda.github.io/bootstrap3-dialog/" + }, + "jquery@undefined": { + "licenses": [ + "MIT" + ] + }, + "chartist@undefined": { + "licenses": "UNKNOWN" + }, + "bootstrap-select@undefined": { + "licenses": [ + "MIT" + ], + "homepage": "http://silviomoreto.github.io/bootstrap-select" + }, + "js-cookie@undefined": { + "licenses": [ + "MIT" + ] + }, + "moment@undefined": { + "licenses": [ + "MIT*" + ] + }, + "chartist-plugin-tooltip@undefined": { + "licenses": [ + "MIT*" + ] + }, + "tableExport.jquery.plugin@undefined": { + "licenses": [ + "MIT" + ] + }, + "chartist-plugin-axistitle@0.0.1": { + "licenses": [ + "WTF*" + ] + }, + "file-saver.js@1.20150507.2": { + "licenses": [ + "LICENSE.md" + ], + "homepage": "https://github.com/Teleborder/FileSaver.js" + }, + "jspdf@1.0.272": { + "licenses": [ + "MIT" + ], + "homepage": "https://github.com/mrrio/jspdf" + }, + "bootswatch-dist@3.3.6-flatly": { + "licenses": [ + "MIT" + ], + "homepage": "https://github.com/dbtek/bootswatch-dist" + }, + "remarkable-bootstrap-notify@3.1.3": { + "licenses": [ + "MIT" + ], + "homepage": "http://bootstrap-notify.remabledesigns.com/", + "repository": "https://github.com/mouse0270/bootstrap-notify" + }, + "bootstrap-table@undefined": { + "licenses": [ + "MIT" + ], + "homepage": "https://github.com/wenzhixin/bootstrap-table", + "repository": "git+https://github.com/wenzhixin/bootstrap-table" + }, + "bootstrap-daterangepicker@undefined": { + "licenses": [ + "MIT" + ], + "repository": "git+https://github.com/dangrossman/bootstrap-daterangepicker" + }, + "jspdf-autotable@undefined": { + "licenses": [ + "MIT" + ], + "homepage": "https://github.com/simonbengtsson/jspdf-autotable", + "repository": "git+https://github.com/simonbengtsson/jsPDF-AutoTable" + }, + "bootstrap@undefined": { + "licenses": [ + "MIT" + ], + "homepage": "http://getbootstrap.com", + "repository": "git+https://github.com/twbs/bootstrap" + }, + "html2canvas@0.4.1": { + "licenses": [ + "MIT" + ], + "repository": "git+ssh://git@github.com/niklasvh/html2canvas" + }, + "jquery-ui@1.11.4": { + "licenses": [ + "MIT" + ], + "repository": "https://github.com/jquery/jquery-ui" + }, + "jasny-bootstrap@3.1.3": { + "licenses": [ + "Apache-2.0", + "Apache*" + ], + "repository": "git+https://github.com/jasny/bootstrap" + }, + "smalot-bootstrap-datetimepicker@undefined": { + "licenses": [ + "Apache 2.0", + "Apache*" + ], + "repository": "https://github.com/smalot/bootstrap-datetimepicker" + }, + "jquery-validation@1.13.1": { + "licenses": [ + "MIT" + ], + "repository": "https://github.com/jzaefferer/jquery-validation", + "homepage": "http://jqueryvalidation.org/" + } +} \ No newline at end of file diff --git a/package.json b/package.json index 8c5a65fde..f788c83e8 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "grunt": "~0.4.5", "grunt-bower": "^0.21.0", "grunt-bower-concat": "^1.0.0", + "grunt-bower-licensechecker": "^0.1.2", "grunt-bowercopy": "^1.2.4", "grunt-cache-breaker": "^2.0.1", "grunt-contrib-concat": "~0.5.1", @@ -27,6 +28,7 @@ "grunt-contrib-jshint": "~0.6.3", "grunt-contrib-uglify": "~0.8.0", "grunt-contrib-watch": "~0.5.3", + "grunt-license-bower": "^1.0.1", "grunt-mocha-webdriver": "^1.2.2", "grunt-script-link-tags": "git://github.com/jekkos/grunt-script-link-tags.git#master", "grunt-wiredep": "^2.0.0",