- node JS - install
npm init
just hit enter unless you end up .
{
"name": "tutorial",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"author": "",
"license": "ISC"
}
"scripts": {
"start": "electron ."
},
tutorial
|package.json
npm install --save-dev electron
{
"name": "tutorial",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"author": "",
"license": "ISC",
"devDependencies": {
"electron": "^16.0.1"
}
}
tutorial
|node modules
|(All Node Modules)
|package.json
|package-lock.json
Now create a file named main.js and paste this code in it
const { app, BrowserWindow, nativeTheme } = require("electron");
const path = require("path");
function createWindow() {
const win = new BrowserWindow({
title: "Tutorial",
center: true,
// You Can Set Custom Height and Width
// width:800,
// height:600,
show: false,
title: "Tutorial",
titleBarOverlay: {
color: "#0000",
opacity: 0.5,
},
// Only If you Want to add Icons
// _______________________________
// icon: path.join(__dirname, Icon Path / Icon),
//_______________________________
webPreferences: {
preload: path.join(__dirname, "preload.js"),
},
});
// Here You Have To Put Your Website Link inside the quotes
// _______________________________________________
win.loadURL("https://musicapp-kohl.vercel.app/");
// _______________________________________________
win.setMenu(null);
// To keep it in small window comment next line
win.maximize();
win.show();
}
app.whenReady().then(() => {
createWindow();
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});
// From -
win.loadURL("https://musicapp-kohl.vercel.app/");
// To -
win.loadURL("Your Link Here");
tutorial
|node modules
|(All Node Modules)
|package.json
|package-lock.json
|main.js
Now run this
npm run
on ideal condition it will open new window in full screen mode with close button and all other buttons
Now We Need to bundle this package into some exe and platform based Thats why we need to install electron-packager
npm install electron-packager
it will install electron globally into your system
Now we will be shifting to cmd and not in powershell strictly
- For All Platforms Generation
electron-packager . <APP Name You Want To Give> --all --asar
- For Linux Generation
electron-packager . <APP Name You Want To Give> --platform=linux
- For Windows Generation
electron-packager . <APP Name You Want To Give> --platform=win32 --asar
- For Mac-Os Generation
electron-packager . <APP Name You Want To Give> --platform=darwin
getting started official Guide
Video Reference for generation
Contact Me At kartikshikhare26@gmail.com For Any Query