uglify-save-license
Advanced tools
Comparing version 0.2.2 to 0.3.0
{ | ||
"name": "uglify-save-license", | ||
"version": "0.2.2", | ||
"description": "Tiny license detector module for UglifyJS's 'comments' option", | ||
"version": "0.3.0", | ||
"description": "License detector for UglifyJS", | ||
"main": "uglify-save-license.js", | ||
"scripts": { | ||
"test": "node_modules/grunt-cli/bin/grunt build" | ||
"test": "grunt build" | ||
}, | ||
@@ -24,3 +24,6 @@ "repository": { | ||
"comment", | ||
"license" | ||
"license", | ||
"detection", | ||
"preservation", | ||
"banner" | ||
], | ||
@@ -32,14 +35,13 @@ "bugs": { | ||
"devDependencies": { | ||
"grunt-cli": "~0.1.11", | ||
"grunt": "~0.4.2", | ||
"load-grunt-tasks": "~0.2.1", | ||
"load-grunt-tasks": "^0.4.0", | ||
"grunt-contrib-jshint": "~0.8.0", | ||
"grunt-contrib-watch": "~0.5.3", | ||
"grunt-contrib-uglify": "~0.3.0", | ||
"grunt-contrib-nodeunit": "~0.2.2", | ||
"grunt-release": "~0.6.0", | ||
"grunt-replace": "~0.5.1", | ||
"semver": "~2.2.1", | ||
"grunt-contrib-clean": "~0.5.0" | ||
"grunt-contrib-uglify": "~0.3.2", | ||
"grunt-contrib-clean": "~0.5.0", | ||
"grunt-contrib-nodeunit": "~0.3.2", | ||
"grunt-release": "~0.7.0", | ||
"grunt-replace": "~0.6.2", | ||
"semver": "~2.2.1" | ||
} | ||
} |
@@ -6,5 +6,4 @@ # uglify-save-license | ||
[![devDependency Status](https://david-dm.org/shinnn/uglify-save-license/dev-status.png)](https://david-dm.org/shinnn/uglify-save-license#info=devDependencies) | ||
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/shinnn/uglify-save-license/trend.png)](https://bitdeli.com/free "Bitdeli Badge") | ||
Tiny license detector for UglifyJS | ||
License detector for UglifyJS | ||
@@ -17,7 +16,6 @@ ## Overview | ||
*uglify-save-license* is inspired by [grunt-license-saver](https://github.com/kyo-ago/grunt-license-saver) and I used it as reference. | ||
Thanks, [kyo-ago](https://github.com/kyo-ago). | ||
## Installation | ||
Install via [npm](https://npmjs.org/). | ||
``` | ||
@@ -31,3 +29,3 @@ npm install uglify-save-license | ||
First of all, load the `uglify-save-license` module. | ||
First of all, load `uglify-save-license` module. | ||
@@ -68,10 +66,10 @@ ```javascript | ||
## How does it works | ||
## How it works | ||
*uglify-save-license* checks each comment node of JavaScript file. | ||
*uglify-save-license* checks each [comment token](http://lisperator.net/uglifyjs/ast#tokens) of JavaScript file. | ||
The comment will be regarded as a license statement and preserved after compression, if it meets at least one of the following requirements: | ||
1. The comment is in the first line of a file. | ||
1. The comment is in the *first* line of a file. | ||
2. [The regexp for license statement](./uglify-save-license.js#L8) matches the string of the comment. The regexp matches, for example, `MIT` and `Copyright`. | ||
3. There is a comment at the previous line, and it matches 1. 2. or 3. | ||
3. There is a comment at the *previous* line, and it matches 1. 2. or 3. | ||
@@ -149,3 +147,3 @@ ## Examples | ||
cwd: 'path/to/src' | ||
src: ["**/*.js"] | ||
src: ['**/*.js'] | ||
dest: 'tmp/' | ||
@@ -165,2 +163,7 @@ ] | ||
## Acknowledgements | ||
*uglify-save-license* is inspired by [grunt-license-saver](https://github.com/kyo-ago/grunt-license-saver) and I used it as reference. | ||
Thanks, [kyo-ago](https://github.com/kyo-ago). | ||
## License | ||
@@ -170,2 +173,2 @@ | ||
Licensed under the [MIT license](http://opensource.org/licenses/mit-license.php). | ||
Licensed under [the MIT license](./LICENSE). |
@@ -1,2 +0,2 @@ | ||
// uglify-save-license.js v0.2.2 | ||
// uglify-save-license.js v0.3.0 | ||
// Copyright (c) 2013 - 2014 Shinnosuke Watanabe | ||
@@ -8,3 +8,3 @@ // Licensed uder the MIT license | ||
// regexp to determine whether the comment looks like license text. | ||
var licenseRegexp = /^\!|^@preserve|^@cc_on|\bMIT\b|\bMPL\b|\bGPL\b|\bBSD\b|\(c\)|License|Copyright/mi; | ||
var licenseRegexp = /^\!|^@preserve|^@cc_on|\bMIT\b|\bMPL\b|\bGPL\b|\bBSD\b|\bISCL\b|\(c\)|License|Copyright/mi; | ||
@@ -11,0 +11,0 @@ // number of line where license comment appeared last |
Sorry, the diff of this file is not supported yet
10
168
7549
5
29