Comparing version 0.1.5 to 0.1.6
39
cli.js
#!/usr/bin/env node | ||
var fs = require('fs'), | ||
concat = require('concat-stream'), | ||
postcss = require('postcss'); | ||
var fs = require('fs'); | ||
var formatBrowserName = require('./dist/lib/util').formatBrowserName, | ||
doiuse = require('./'); | ||
defaultBrowsers = require('./').default, | ||
doiuse = require('./stream'); | ||
@@ -18,3 +17,3 @@ var yargs = require('yargs') | ||
description: 'Autoprefixer-like browser criteria.', | ||
default: doiuse.default.join(', ') | ||
default: defaultBrowsers.join(', ') | ||
}) | ||
@@ -42,17 +41,2 @@ .string('b') | ||
// Callback to report each unsupported feature usage. | ||
function report(usageInfo) { | ||
console.log(argv.json ? JSON.stringify(usageInfo) : usageInfo.message); | ||
} | ||
// Set up the linter instance | ||
var linter = doiuse({ | ||
browserSelection: argv.b.split(',').map(function(s){return s.trim();}), | ||
onUnsupportedFeatureUse: report | ||
}); | ||
var processor = postcss(linter); | ||
// Informational output | ||
@@ -88,11 +72,14 @@ if(argv.l) { argv.v = ++argv.verbose; } | ||
var browsers = argv.b.split(',').map(function(s){return s.trim();}); | ||
var options = {json: argv.json}; | ||
if(argv._.length > 0) | ||
argv._.forEach(function(file){ | ||
processor.process(fs.readFileSync(file), { | ||
from: file | ||
}); | ||
fs.createReadStream() | ||
.pipe(doiuse(browsers, options)) | ||
.pipe(process.stdout); | ||
}); | ||
else | ||
process.stdin.pipe(concat(function(css) { | ||
processor.process(css); | ||
})); | ||
process.stdin | ||
.pipe(doiuse(browsers, options)) | ||
.pipe(process.stdout); |
{ | ||
"name": "doiuse", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Lint CSS for browser support against caniuse database.", | ||
@@ -30,2 +30,3 @@ "main": "dist/index.js", | ||
"concat-stream": "^1.4.6", | ||
"duplexer2": "0.0.2", | ||
"lodash": "^2.4.1", | ||
@@ -32,0 +33,0 @@ "postcss": "^3.0.2", |
@@ -16,3 +16,7 @@ [![Build Status](https://travis-ci.org/anandthakker/doiuse.svg?branch=master)](https://travis-ci.org/anandthakker/doiuse) | ||
doiuse --browsers "ie >= 9, > 1%, last 2 versions" main.css | ||
# or | ||
cat main.css | doiuse --browsers "ie >= 9, > 1%, last 2 versions" | ||
``` | ||
**Sample output:** | ||
@@ -70,2 +74,17 @@ ``` | ||
# API Details: | ||
## As a transform stream | ||
```javascript | ||
var doiuse = require('doiuse/stream'); | ||
process.stdin | ||
.pipe(doiuse(['ie >= 8', '> 1%'], {json: false})) | ||
.pipe(process.stdout); | ||
``` | ||
Setting `json: true` yields ld-json output. | ||
## As a postcss plugin | ||
`postcss(doiuse(opts)).process(css)`, where `opts` is: | ||
@@ -72,0 +91,0 @@ ```javascript |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58706
69
1104
123
7
+ Addedduplexer2@0.0.2
+ Addedduplexer2@0.0.2(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedreadable-stream@1.1.14(transitive)
+ Addedstring_decoder@0.10.31(transitive)