All Projects → loukaspd → puppeteer-electron-quickstart

loukaspd / puppeteer-electron-quickstart

Licence: Unlicense License
Quickstart project to run puppeteer library from an Electron application. Using ES-6 and babel.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to puppeteer-electron-quickstart

Mostly
They mostly come at night; mostly.
Stars: ✭ 78 (+50%)
Mutual labels:  babel, puppeteer
Marvelheroes
Marvel Heroes
Stars: ✭ 54 (+3.85%)
Mutual labels:  babel, puppeteer
lab-assistant
A tool to measure performance deltas between two versions of a site
Stars: ✭ 20 (-61.54%)
Mutual labels:  puppeteer
hotshot
Takes screenshots of DOM elements
Stars: ✭ 19 (-63.46%)
Mutual labels:  puppeteer
babel-runtime-example
An example of how to use @babel/plugin-transform-runtime
Stars: ✭ 16 (-69.23%)
Mutual labels:  babel
protonmail-api
✉ Node.js API for ProtonMail
Stars: ✭ 108 (+107.69%)
Mutual labels:  puppeteer
node-lambda-babel-template
A minimal template for an ES2015+ Node.js app running on AWS Lambda (w/ babel and webpack).
Stars: ✭ 40 (-23.08%)
Mutual labels:  babel
xstate-marionettist
Model based testing with Jest, XState and Puppeteer or Playwright made easy
Stars: ✭ 23 (-55.77%)
Mutual labels:  puppeteer
react-quiz-app
A Simple React Quiz App 💎
Stars: ✭ 37 (-28.85%)
Mutual labels:  babel
babel-plugin-proposal-pattern-matching
the minimal grammar, high performance JavaScript pattern matching implementation
Stars: ✭ 34 (-34.62%)
Mutual labels:  babel
medly-components
🧩 Medly components provides numerous themable react components, each with multiple varitaions of sizes, colors, position etc.
Stars: ✭ 66 (+26.92%)
Mutual labels:  babel
stan
🔨 Collection of front-end engineering tools
Stars: ✭ 19 (-63.46%)
Mutual labels:  babel
naos
📉 Uptime and error monitoring CLI
Stars: ✭ 30 (-42.31%)
Mutual labels:  puppeteer
babel-note
Some examples of babel
Stars: ✭ 12 (-76.92%)
Mutual labels:  babel
docker-google-lighthouse-puppeteer
Google Lighthouse + Puppeteer / Docker Image
Stars: ✭ 29 (-44.23%)
Mutual labels:  puppeteer
freeRouter
freeRouter - networking swiss army knife
Stars: ✭ 26 (-50%)
Mutual labels:  babel
energy-use-case-trading-client
Energy Use Case Web UI for Lition Trading Platform
Stars: ✭ 23 (-55.77%)
Mutual labels:  puppeteer
react-multi-context
Manage multiple React 16 contexts with a single component.
Stars: ✭ 19 (-63.46%)
Mutual labels:  babel
messages-web
📱 SMS gateway using your own phone!
Stars: ✭ 34 (-34.62%)
Mutual labels:  puppeteer
k6-template-es6
Template repository for bundling test projects into single test scripts runnable by k6
Stars: ✭ 39 (-25%)
Mutual labels:  babel

puppeteer-electron-quickstart

Quickstart project to run puppeteer library from an electron application. Using ES-6 and babel.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Package Manager

Yarn is the suggested package manager, since electron suggests it too.

Installing

  1. Clone the project
  2. run yarn to download needed packages

Project Info

Electron application

  1. electron_main.js: the main file that will run from our electron application
  2. index.html: the UI of our electron application.
    • Currently contains only the a div where all the logs will be shown
    • In this file we need to load all our custom js files. This is done from copy-babel-output npm script

Puppeteer

To run puppeteer inside electron we use puppeteer-core library, which uses chrome instance installed in the client machine. Puppeteer is initialized in puppeteer-wrapper.js.

  1. The script is checking default chrome patch. Depending on the OS where the app is running this path will be:
    • for Windows: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    • for mac: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
  2. If the executable exists in another directory this has to be set in Documents/application-folder/settings.json

Main Program

The main functionality is in src folder.
index.js is the starting point of our application.

Helper libraries

  1. logger.js
    simple logger that writes to our div in index.html file
  2. file-paths.js
    • Source of truth about where all file paths the application is using. Using this library to avoid hardcoding file paths in different places
    • When application starts creates a folder inside user's Documents folder where all files will be saved

package.json scripts

  1. babel_build: converts all .js files inside src folder to es2015 in babel-output folder, so they can be required in index.html file without errors (electron uses es2015)
  2. copy-babel-output: grabs all .js files from babel-output folder and adds a require for them in index.html
  3. start: the main script to start the electron app. Call the two previous scripts before starting the app with the app-to-date code
  4. start_dev: you can use this script in case you need to run the code from node and not inside an electron app
  5. dist: script used to product an electron app installer inside the dist folder. Like start, this script calls the two first scripts to make sure the code is up to date before building the installer

License

This project is licensed under The Unlicense - see the LICENSE file for details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].