Comparing version 1.0.0-beta.1 to 1.0.0-beta.2
{ | ||
"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
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
23610
14
134
15
5
3
+ Addedora@^3.1.0
+ Addedansi-regex@4.1.1(transitive)
+ Addedcli-cursor@2.1.0(transitive)
+ Addedcli-spinners@2.9.2(transitive)
+ Addedclone@1.0.4(transitive)
+ Addeddefaults@1.0.4(transitive)
+ Addedlog-symbols@2.2.0(transitive)
+ Addedmimic-fn@1.2.0(transitive)
+ Addedonetime@2.0.1(transitive)
+ Addedora@3.4.0(transitive)
+ Addedrestore-cursor@2.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedstrip-ansi@5.2.0(transitive)
+ Addedwcwidth@1.0.1(transitive)