Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

manual-chrome-launcher.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env node
  2. 'use strict';
  3. // Keep this file in sync with lighthouse
  4. // TODO: have LH depend on this one.
  5. /**
  6. * @fileoverview Script to launch a clean Chrome instance on-demand.
  7. *
  8. * Assuming Lighthouse is installed globally or `npm link`ed, use via:
  9. * chrome-debug
  10. * Optionally enable extensions or pass a port, additional chrome flags, and/or a URL
  11. * chrome-debug --port=9222
  12. * chrome-debug http://goat.com
  13. * chrome-debug --show-paint-rects
  14. * chrome-debug --enable-extensions
  15. */
  16. require('./compiled-check.js')('./dist/chrome-launcher.js');
  17. const {Launcher, launch} = require('./dist/chrome-launcher');
  18. const args = process.argv.slice(2);
  19. const chromeFlags = [];
  20. let startingUrl;
  21. let port;
  22. let ignoreDefaultFlags;
  23. if (args.length) {
  24. const providedFlags = args.filter(flag => flag.startsWith('--'));
  25. const portFlag = providedFlags.find(flag => flag.startsWith('--port='));
  26. if (portFlag) port = parseInt(portFlag.replace('--port=', ''), 10);
  27. const enableExtensions = !!providedFlags.find(flag => flag === '--enable-extensions');
  28. // The basic pattern for enabling Chrome extensions
  29. if (enableExtensions) {
  30. ignoreDefaultFlags = true;
  31. chromeFlags.push(...Launcher.defaultFlags().filter(flag => flag !== '--disable-extensions'));
  32. }
  33. chromeFlags.push(...providedFlags);
  34. startingUrl = args.find(flag => !flag.startsWith('--'));
  35. }
  36. launch({
  37. startingUrl,
  38. port,
  39. ignoreDefaultFlags,
  40. chromeFlags,
  41. })
  42. // eslint-disable-next-line no-console
  43. .then(v => console.log(`✨ Chrome debugging port: ${v.port}`));