From 7db7d9fb3ca441f6ca1f96d48359b34e5c952ef7 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Tue, 17 Nov 2015 23:40:31 +0700 Subject: [PATCH] tweaks --- cli.js | 8 +------- package.json | 9 ++++----- readme.md | 9 +-------- test/test.js | 6 ++---- 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/cli.js b/cli.js index 56a67b2..1c6f0b5 100755 --- a/cli.js +++ b/cli.js @@ -13,7 +13,6 @@ var objectAssign = require('object-assign'); var Pageres = require('pageres'); var parseHeaders = require('parse-headers'); var meow = require('meow'); -var pkg = require('./package.json'); var options = { boolean: [ @@ -43,16 +42,13 @@ var cli = meow(multiline(function () { pageres pageres [ ] [ ] pageres [ ... ] < - cat | pageres [ ... ] 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 Options -v, --verbose Verbose output @@ -69,8 +65,6 @@ var cli = meow(multiline(function () { --format= Image format can also be a local file path. - - You can also pipe in a newline separated list of urls and screen resolutions which will get merged with the arguments. */}), options); function generate(args, options) { @@ -200,6 +194,6 @@ function init(args, options) { } sudoBlock(); -updateNotifier({pkg: pkg}).notify(); +updateNotifier({pkg: cli.pkg}).notify(); init(subarg(cli.input, options)._, cli.flags); diff --git a/package.json b/package.json index fed21ae..cbddc5c 100644 --- a/package.json +++ b/package.json @@ -4,15 +4,14 @@ "description": "Capture website screenshots", "license": "MIT", "repository": "sindresorhus/pageres-cli", - "preferGlobal": true, - "bin": { - "pageres": "cli.js" - }, "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, + "bin": { + "pageres": "cli.js" + }, "engines": { "node": ">=0.12.0" }, @@ -71,7 +70,7 @@ "devDependencies": { "ava": "*", "get-exec-file": "^1.0.0", - "path-exists": "^1.0.0", + "path-exists": "^2.1.0", "xo": "*" }, "xo": { diff --git a/readme.md b/readme.md index b6790de..f82c554 100644 --- a/readme.md +++ b/readme.md @@ -42,13 +42,6 @@ pageres todomvc.com yeoman.io 1024x768 # 2 screenshots pageres todomvc.com yeoman.io 1024x768 1366x768 # 4 screenshots ``` -Pipe in a newline separated list of urls and screen resolutions which will get merged with the arguments. - -```sh -# In this case a list of screen resolutions -pageres < screen-resolutions.txt -``` - Group arguments with square brackets. ```sh @@ -200,7 +193,7 @@ You can use the most popular resolutions for your site with `pageres` by followi - Click the `Screen Resolution` link in the middle of the screen - Click the `Export` button at the top, then `Google Spreadsheets`, and select yes for importing - Select all the resolutions and copy them into a new file and save it -- In your terminal run: `pageres website.com < file-from-above-step.txt` +- In your terminal run: `pageres website.com $(awk '{a = $1 " " a} END {print a}' file-from-above-step.txt)` ## License diff --git a/test/test.js b/test/test.js index 4408a83..7b8190b 100644 --- a/test/test.js +++ b/test/test.js @@ -5,9 +5,7 @@ import pathExists from 'path-exists'; import execFile from 'get-exec-file'; import {version as pkgVersion} from '../package.json'; -process.chdir(__dirname); - -test.serial('generate screenshot', async t => { +test('generate screenshot', async t => { await execFile('../cli.js', ['yeoman.io', '320x240']); t.true(pathExists.sync('yeoman.io-320x240.png')); @@ -54,5 +52,5 @@ test('show help screen', async t => { test('show version', async t => { const {stdout} = await execFile('../cli.js', ['--version']); - t.regexTest(new RegExp(pkgVersion), stdout) + t.is(stdout.trim(), pkgVersion); });