Comparing version 1.0.0 to 1.0.1
13
cli.js
@@ -163,4 +163,13 @@ #!/usr/bin/env node | ||
if (args.some(function (arr) { return arr._ === undefined; })) { | ||
args = [{ _: args }]; | ||
var nonGroupedArgs = args.filter(function (arg) { | ||
return !arg._; | ||
}); | ||
// filter grouped args | ||
args = args.filter(function (arg) { | ||
return arg._; | ||
}); | ||
if (nonGroupedArgs.length) { | ||
args.push({_: nonGroupedArgs}); | ||
} | ||
@@ -167,0 +176,0 @@ |
@@ -16,3 +16,3 @@ 'use strict'; | ||
if (!(this instanceof Pageres)) { | ||
return new Pageres(); | ||
return new Pageres(options); | ||
} | ||
@@ -19,0 +19,0 @@ |
@@ -9,2 +9,3 @@ 'use strict'; | ||
var fileUrl = require('file-url'); | ||
var fsWriteStreamAtomic = require('fs-write-stream-atomic'); | ||
var getRes = require('get-res'); | ||
@@ -103,3 +104,3 @@ var logSymbols = require('log-symbols'); | ||
var dest = path.join(this.dest(), stream.filename); | ||
var pipe = stream.pipe(fs.createWriteStream(dest)); | ||
var pipe = stream.pipe(fsWriteStreamAtomic(dest)); | ||
@@ -106,0 +107,0 @@ stream.on('warn', this.emit.bind(this, 'warn')); |
{ | ||
"name": "pageres", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Responsive website screenshots", | ||
@@ -49,2 +49,3 @@ "license": "MIT", | ||
"file-url": "^1.0.0", | ||
"fs-write-stream-atomic": "^1.0.2", | ||
"get-res": "^0.2.1", | ||
@@ -51,0 +52,0 @@ "get-stdin": "^3.0.0", |
137
readme.md
@@ -25,40 +25,117 @@ # ![pageres](media/promo.png) | ||
Specify urls and screen resolutions as arguments. Order doesn't matter. | ||
```sh | ||
$ pageres <url> <resolution> | ||
$ pageres <resolution> <url> | ||
# <url> can also be a local file path. | ||
$ pageres <file> <resolution> | ||
``` | ||
$ pageres --help | ||
Specify urls and screen resolutions as arguments. Order doesn't matter. | ||
Group arguments with [ ]. Options defined inside a group will override the outer ones. | ||
Screenshots are saved in the current directory. | ||
List multiple urls and resolutions for pageres to capture all combinations. | ||
Usage | ||
pageres <url> <resolution> | ||
pageres [ <url> <resolution> ] [ <url> <resolution> ] | ||
pageres [ <url> <resolution> ... ] < <file> | ||
cat <file> | pageres [ <url> <resolution> ... ] | ||
```sh | ||
$ pageres <url> <resolution> ... | ||
Example | ||
pageres todomvc.com yeoman.io 1366x768 1600x900 | ||
pageres [ yeoman.io 1366x768 1600x900 --no-crop ] [ todomvc.com 1024x768 480x320 ] --crop | ||
pageres todomvc.com 1024x768 --filename '<%= date %> - <%= url %>' | ||
pageres yeoman.io 1366x768 --selector '.page-header' | ||
pageres --delay 3 1366x768 < urls.txt | ||
pageres unicorn.html 1366x768 | ||
cat screen-resolutions.txt | pageres todomvc.com yeoman.io | ||
$ pageres todomvc.com 1024x768 1366x768 # 2 screenshots | ||
$ pageres todomvc.com yeoman.io 1024x768 # 2 screenshots | ||
$ pageres todomvc.com yeoman.io 1024x768 1366x768 # 4 screenshots | ||
``` | ||
Options | ||
-v, --verbose Verbose output | ||
-c, --crop Crop to the set height | ||
-d, --delay <seconds> Delay screenshot capture | ||
--filename <template> Custom filename | ||
--selector <element> Capture DOM element | ||
--cookie <cookie> Browser cookie, can be set multiple times | ||
--username <username> Username for HTTP auth | ||
--password <password> Password for HTTP auth | ||
Pipe in a newline separated list of urls and screen resolutions which will get merged with the arguments. | ||
<url> can also be a local file path. | ||
```sh | ||
# In this case a list of screen resolutions | ||
$ pageres <url> < screen-resolutions.txt | ||
``` | ||
You can also pipe in a newline separated list of urls and screen resolutions which will get merged with the arguments. | ||
Group arguments with square brackets. | ||
```sh | ||
$ pageres [ <url> <resolution> ] [ <url> <resolution> ] | ||
$ pageres [ <url> <resolution> ... ] | ||
# Options defined inside a group will override the outer ones. | ||
$ pageres [ yeoman.io 1024x768 --no-crop ] [ todomvc.com 1366x768 ] --crop | ||
``` | ||
Screenshots are saved in the current directory. | ||
### Examples | ||
```sh | ||
# Basic multi-url, multi-resolution usage | ||
pageres todomvc.com yeoman.io 1366x768 1600x900 | ||
# Override outer option within group | ||
pageres [ yeoman.io 1366x768 1600x900 --no-crop ] [ todomvc.com 1024x768 480x320 ] --crop | ||
# Provide a custom filename template | ||
pageres todomvc.com 1024x768 --filename '<%= date %> - <%= url %>' | ||
# Capture a specific element | ||
pageres yeoman.io 1366x768 --selector '.page-header' | ||
# Delay and pipe in a list of urls | ||
pageres --delay 3 1366x768 < urls.txt | ||
# Capture a local file | ||
pageres unicorn.html 1366x768 | ||
# Pipe in resolutions | ||
cat screen-resolutions.txt | pageres todomvc.com yeoman.io | ||
``` | ||
### Options | ||
##### `-v`, `--verbose` | ||
Verbose output to see errors if you need to troubleshoot. | ||
##### `-c`, `--crop` | ||
Crop to the set height. | ||
```sh | ||
$ pageres todomvc.com 1024x768 --crop | ||
``` | ||
##### `-d`, `--delay` | ||
Delay screenshot capture. | ||
```sh | ||
$ pageres todomvc.com 1024x768 --delay 3 | ||
``` | ||
##### `--filename <template>` | ||
Custom filename. | ||
```sh | ||
$ pageres todomvc.com 1024x768 --filename '<%= date %> - <%= url %>' | ||
``` | ||
##### `--selector <element>` | ||
Capture DOM element. | ||
```sh | ||
$ pageres yeoman.io 1366x768 --selector '.page-header' | ||
``` | ||
##### `--cookie <cookie>` | ||
Browser cookie, can be set multiple times. | ||
##### `--username <username>` | ||
Username for HTTP auth. | ||
##### `--password <password>` | ||
Password for HTTP auth. | ||
## Config file | ||
@@ -77,3 +154,3 @@ | ||
Check out [grunt-pageres](https://github.com/sindresorhus/grunt-pageres) if you're using grunt. | ||
Check out [grunt-pageres](https://github.com/sindresorhus/grunt-pageres) if you're using grunt. | ||
@@ -194,3 +271,3 @@ For gulp and broccoli, just use the below API directly. No need for a wrapper plugin. | ||
A keyword is a version of a device from [this list](http://viewportsizes.com). | ||
You can also pass in the `w3counter` keyword to use the ten most popular | ||
You can also pass in the `w3counter` keyword to use the ten most popular | ||
resolutions from [w3counter](http://www.w3counter.com/globalstats.php). | ||
@@ -197,0 +274,0 @@ |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
19313
413
323
0
18
3
+ Addedfs-write-stream-atomic@1.0.10(transitive)
+ Addediferr@0.1.5(transitive)
+ Addedimurmurhash@0.1.4(transitive)