obfuscator
Advanced tools
Comparing version 0.2.2 to 0.3.0
# Release History | ||
## 0.3.0 | ||
- removed grunt support; use [grunt-obfuscator](https://github.com/stephenmathieson/grunt-obfuscator) instead. | ||
## 0.2.2 | ||
@@ -17,3 +21,3 @@ | ||
- added support for custom compression options ([#2](https://github.com/stephenmathieson/node-obfuscator/issues/2)) | ||
- updated [UglifyJS] | ||
- updated UglifyJS | ||
@@ -20,0 +24,0 @@ ## 0.1.0 |
{ | ||
"name": "obfuscator", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "test": "make validate" |
@@ -40,31 +40,5 @@ | ||
### Grunt | ||
### JavaScript API | ||
Tested with both 0.3.x and 0.4.x. It should work until the [grunt] people change everything again. | ||
```javascript | ||
module.exports = function (grunt) { | ||
'use strict'; | ||
grunt.loadNpmTasks('obfuscator'); // load the task | ||
grunt.initConfig({ | ||
obfuscator: { | ||
files: [ | ||
'app.js', | ||
'lib/routes/*.js' | ||
], | ||
entry: 'app.js', | ||
out: 'obfuscated.js', | ||
strings: true | ||
} | ||
}); | ||
grunt.registerTask('default', 'obfuscator'); | ||
}; | ||
``` | ||
### Raw JavaScript API | ||
```javascript | ||
var Options = require('obfuscator').Options; | ||
@@ -155,3 +129,2 @@ var obfuscator = require('obfuscator').obfuscator; | ||
[acceptance tests]: https://github.com/stephenmathieson/node-obfuscator/tree/master/test/acceptance | ||
[grunt]: https://github.com/gruntjs/grunt | ||
[docs]: https://github.com/stephenmathieson/node-obfuscator/tree/master/docs.md |
@@ -1,55 +0,9 @@ | ||
'use strict'; | ||
var fs = require('fs'), | ||
obfuscator = require('../lib/obfuscator'); | ||
module.exports = function () { | ||
var err = | ||
'Grunt support has been removed from obfusactor.\n' | ||
+ 'Please use\n\n' | ||
+ ' https://github.com/stephenmathieson/grunt-obfuscator\n'; | ||
module.exports = function (grunt) { | ||
/** | ||
* Grabs a config option from the obfuscator namespace | ||
* | ||
* @api private | ||
* @param {String} option The option/configuration key | ||
* @return {Mixed|Any} The key's value | ||
*/ | ||
function config(option) { | ||
return grunt.config('obfuscator.' + option); | ||
} | ||
/** | ||
* The task; obfuscates a package with help from grunt | ||
* | ||
* @api private | ||
*/ | ||
grunt.registerTask('obfuscator', 'Mangle your node project', function () { | ||
var options, | ||
next = this.async(), | ||
files = config('files'), | ||
entry = config('entry'), | ||
root = config('root'), | ||
out = config('out'), | ||
strings = config('strings'); | ||
files = grunt.file.expand(files); | ||
options = new obfuscator.Options(files, root, entry, strings); | ||
obfuscator.obfuscator(options, function (err, obfuscated) { | ||
if (err) { | ||
grunt.log.error(err); | ||
return next(false); | ||
} | ||
fs.writeFile(out, obfuscated, function (err) { | ||
if (err) { | ||
grunt.log.error(err); | ||
return next(false); | ||
} | ||
grunt.log.write('Project obfuscated to '); | ||
grunt.log.write(out.cyan); | ||
grunt.log.write('.\n'); | ||
next(); | ||
}); | ||
}); | ||
}); | ||
console.error(err); | ||
}; |
13
9
19160
426
129