Socket
Socket
Sign inDemoInstall

paparazzi-cli

Package Overview
Dependencies
67
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.1 to 0.4.0

LICENSE

41

index.js
#!/usr/bin/env node
const puppeteer = require('puppeteer');
const devices = require('puppeteer/DeviceDescriptors');
const fs = require('fs');
const URL = require('url').URL;
const yargs = require('yargs');
const lib = require("./lib");

@@ -44,2 +46,21 @@

async function run(args) {
if (args.listDevices) {
console.log('Available devices are:');
devices.forEach(a => console.log(a.name));
return;
}
if (args._.length === 0) {
yargs.showHelp();
throw 'You must specify at least one URL';
}
let realDevice;
if (args.device) {
realDevice = devices[args.device];
if (!realDevice) {
throw `Unrecognised device: ${args.device}`;
}
}
if (!fs.existsSync(args.output)) {

@@ -52,3 +73,7 @@ fs.mkdirSync(args.output);

let page = await browser.newPage();
//Apply more specific arguments last so they are not overwritten
await page.setViewport({ width: args.width, height: args.height, deviceScaleFactor: args.scale });
if (args.userAgent) await page.setUserAgent(args.userAgent);
if (realDevice) await page.emulate(realDevice);

@@ -78,2 +103,4 @@ let allowedHosts = [];

console.log(`Finished taking ${q.queue.length} snaps`);
await page.close();

@@ -83,5 +110,4 @@ await browser.close();

let argv = require('yargs')
let argv = yargs
.usage('Usage: $0 [options] <URL1> [<URL2> ...]')
.demandCommand(1, 'You need to specify at least 1 URL')
.strict()

@@ -112,4 +138,12 @@

.boolean(['full-page', 'allow-all-hosts'])
.nargs('user-agent', 1)
.describe('user-agent', 'Set the user agent to specify in each request')
.nargs('device', 1)
.describe('device', 'Emulate this device when taking the screenshots')
.boolean(['list-devices', 'full-page', 'allow-all-hosts'])
.describe('list-devices', 'List all devices which can be emulated (Note this is a long list)')
.describe('full-page', 'Ensure all content on page is included in screenshot ' +

@@ -129,2 +163,3 @@ '(will override width and height settings)')

browser && browser.close();
process.exitCode = 1;
});

2

package.json
{
"name": "paparazzi-cli",
"version": "0.3.1",
"version": "0.4.0",
"description": "CLI tool to snap all the angles of your website",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,2 +5,3 @@ <p align="center">

<a href="https://badge.fury.io/js/paparazzi-cli"><img src="https://badge.fury.io/js/paparazzi-cli.svg" alt="npm version" height="18"></a>
<a href="https://travis-ci.com/GodlikePenguin/Paparazzi"><img src="https://travis-ci.com/GodlikePenguin/Paparazzi.svg?branch=master"></a>
</p>

@@ -7,0 +8,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc