File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3- 'use strict'
3+ 'use strict' ;
44/**
55 * @fileoverview Script to launch a clean Chrome instance on-demand.
6+ *
67 * Assuming Lighthouse is installed globally or `npm link`ed, use via:
78 * chrome-debug
8- * Optionally pass additional flags and/or a URL
9+ * Optionally pass additional a port, chrome flags and/or a URL
10+ * chrome-debug --port=9222
911 * chrome-debug http://goat.com
1012 * chrome-debug --show-paint-rects
1113 */
@@ -16,15 +18,19 @@ const args = process.argv.slice(2);
1618
1719let chromeFlags ;
1820let startingUrl ;
21+ let port ;
1922
2023if ( args . length ) {
2124 chromeFlags = args . filter ( flag => flag . startsWith ( '--' ) ) ;
25+ port = chromeFlags . find ( flag => flag . startsWith ( '--port=' ) ) . replace ( '--port=' , '' ) ;
26+
2227 startingUrl = args . find ( flag => ! flag . startsWith ( '--' ) ) ;
2328}
2429
2530const { launch} = require ( './chrome-launcher' ) ;
2631
2732launch ( {
2833 startingUrl,
34+ port,
2935 chromeFlags,
30- } ) . then ( v => console . log ( `✨ Chrome debugging port: ${ v . port } ` ) )
36+ } ) . then ( v => console . log ( `✨ Chrome debugging port: ${ v . port } ` ) ) ;
You can’t perform that action at this time.
0 commit comments