Permalink
Browse files

init

  • Loading branch information...
0 parents commit ab25056ffa99a252319d2f5e16ac190bc62914aa @sindresorhus sindresorhus committed Nov 21, 2012
@@ -0,0 +1,9 @@
+# editorconfig.org
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
@@ -0,0 +1 @@
+* text=auto
@@ -0,0 +1,21 @@
+{
+ "node": true,
+ "es5": true,
+ "esnext": true,
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "indent": 4,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "quotmark": "single",
+ "regexp": true,
+ "undef": true,
+ "unused": true,
+ "strict": true,
+ "trailing": true,
+ "smarttabs": true
+}
@@ -0,0 +1,6 @@
+.npmignore
+.editorconfig
+.jshintrc
+.gitattributes
+.travis.yml
+test
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - 0.8
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+
+var spawn = require('child_process').spawn;
+var binPath = require('../lib/optipng').path;
+
+spawn(binPath, process.argv.slice(2), { stdio: 'inherit' })
+ .on('exit', process.exit);
@@ -0,0 +1,11 @@
+var path = require('path');
+
+if (process.platform === 'darwin') {
+ exports.path = path.join(__dirname, '../vendor/osx', 'optipng');
+} else if (process.platform === 'linux') {
+ exports.path = path.join(__dirname, '../vendor/linux', 'optipng');
+} else if (process.platform === 'win32') {
+ exports.path = path.join(__dirname, '../vendor/win32', 'optipng.exe');
+} else {
+ console.log('Unsupported platform:', process.platform, process.arch);
+}
@@ -0,0 +1,31 @@
+{
+ "name": "optipng",
+ "version": "0.1.0",
+ "description": "OptiPNG wrapper that makes it seamlessly available as a local dependency on OS X, Linux and Windows",
+ "keywords": ["png", "compress", "minify", "optimize", "img", "image"],
+ "homepage": "https://github.com/yeoman/node-optipng",
+ "bugs": "https://github.com/yeoman/node-optipng/issues",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "http://sindresorhus.com"
+ },
+ "main": "lib/optipng.js",
+ "bin": "bin/optipng",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/yeoman/node-optipng.git"
+ },
+ "scripts": {
+ "test": "node node_modules/.bin/mocha test/test-*.js"
+ },
+ "engines": {
+ "node": ">=0.8.0"
+ },
+ "licenses": [{
+ "type": "BSD"
+ }],
+ "devDependencies": {
+ "mocha": "~1.6.0"
+ }
+}
@@ -0,0 +1,24 @@
+# node-optipng [![Build Status](https://secure.travis-ci.org/yeoman/node-optipng.png?branch=master)](http://travis-ci.org/yeoman/node-optipng)
+
+[OptiPNG](http://optipng.sourceforge.net) 0.7.4 Node.js wrapper that makes it seamlessly available as a local dependency on OS X, Linux and Windows.
+
+
+## Example usage
+
+```js
+var execFile = require('child_process').execFile;
+var optipngPath = require('optipng').path;
+
+execFile(optipngPath, ['-v'], function(err, stdout, stderr) {
+ console.log('OptiPNG version:', stdout.match(/\d\.\d.\d/)[0]);
+});
+```
+
+You can also run it directly from `./node_modules/.bin/optipng`
+
+
+## License
+
+Everything excluding the binaries licensed under the [BSD license](http://opensource.org/licenses/bsd-license.php)
+
+OptiPNG licensed under the [zlib license](http://optipng.sourceforge.net/license.txt)
@@ -0,0 +1,26 @@
+/*global describe, it */
+'use strict';
+
+var assert = require('assert');
+var path = require('path');
+var execFile = require('child_process').execFile;
+
+describe('OptiPNG', function() {
+ it('should return path to OptiPNG binary', function(cb) {
+ var binPath = require('../lib/optipng.js').path;
+
+ execFile(binPath, ['-v'], function(err, stdout) {
+ assert(stdout.indexOf('OptiPNG') !== -1);
+ cb();
+ });
+ });
+
+ it('should successfully proxy OptiPNG', function(cb) {
+ var binPath = path.join(__dirname, '../bin/optipng');
+
+ execFile(binPath, ['-v'], function(err, stdout) {
+ assert(stdout.indexOf('OptiPNG') !== -1);
+ cb();
+ });
+ });
+});
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit ab25056

Please sign in to comment.