Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chromestat

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chromestat - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0-beta.2

src/logic/initPuppeteer.js

3

package.json
{
"name": "chromestat",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"description": "Puppeteer website performance test",

@@ -16,4 +16,5 @@ "main": "src/index.js",

"lodash": "^4.17.11",
"ora": "^3.1.0",
"puppeteer": "^1.12.2"
}
}
# chromestat
Like httpstat powered by puppeteer
Like httpstat but powered by puppeteer
## Installation
```
npm i chromestat -g
```
## Usage
```
chromstat http://www.example.com
chromstat http://www.example.com --skipSaveBody // will not save body into temp
```

@@ -1,29 +0,32 @@

#!/usr/bin/env node
const puppeteer = require('puppeteer');
const chalk = require('chalk');
const prepareTimes = require('./prepareTimes');
const render = require('./render');
const flow = require('lodash/flow');
const arg = require('arg');
const isUrl = require('./isUrl');
const ora = require('ora');
const chalk = require('chalk');
const prepareTimes = require('./logic/prepareTimes');
const renderHeader = require('./renderHeader');
const renderTimeline = require('./renderTimeline');
const renderBody = require('./renderBody');
const isUrl = require('./utils/isUrl');
const initPuppeteer = require('./logic/initPuppeteer');
module.exports = async () => {
const args = arg({
'--url': String,
});
if (!isUrl(args['--url'])) {
const args = arg({ '--skipSaveBody': Boolean });
const url = args['_'];
const skipSaveBody = args['--skipSaveBody'];
if (!isUrl(url)) {
console.log('💔 Not a valid url.');
process.exit();
}
console.log(`⏳ ${chalk.blue('Connect to:')} ${args['--url']}`);
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://www.athena.com.au');
const performanceTiming = JSON.parse(await page.evaluate(() => JSON.stringify(window.performance.timing)));
const spinner = ora(`⏳ ${chalk.blue('Connect to:')} ${url}`).start();
const { response, performanceTiming, browser, body } = await initPuppeteer();
spinner.stop();
renderHeader(response);
if (!skipSaveBody) renderBody(body);
flow(
prepareTimes,
render,
renderTimeline,
)(

@@ -30,0 +33,0 @@ performanceTiming,

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc