Below are the steps to get started with the very first Electron Js Application –
- We need to create a new folder in our file system.
To create a directory use the following command:
- Next, we will require three files
Execute below command for creating package.json for managing and installing packages.
As soon as we execute the npm init command we can setup the details in the package.json file like – project name, version, description, main file location, author, license, etc.
This JSON file (in the above image) points to the app’s main file and lists all its details and dependencies.
- Now execute the below command to install the Electron.
- We need to update the code of index.html to define our application view. Add the below code in the index.html
- Create the file “index.js” which will be the root of our application and add the below-mentioned code to create a browser window of the desktop application.
This is the electron directory structure for our app:
- Use the below command to run the app.