Jika Anda ingin membuat aplikasi berbasis desktop menggunakan bahasa pemrograman javascript, Anda bisa menggunakan ElectronJS.
Aplikasi yang dibagun menggunakan Electron menggunakan engine dari chromium, sehingga tampilannya mirip seperti web, karena menggunakan HTML, CSS dan Javascript untuk membuatnya.
Setelah aplikasi jadi, Anda bisa membundle electron tersebut menggunakan electron-builder, sehingga bisa didistribusikan.
Berikut cara menggunakan electron builder :
Install electron-builder
npm install electron-builder
{ "name": "exrush-app", "version": "1.0.0", "description": "Point of Sale Made Easy (Standalone Desktop Application)", "private": true, "main": "main.js", "scripts": { "start": "electron .", "pack": "electron-builder --dir", "build": "electron-builder" }, "build": { "appId": "com.exrush.appmu", "asar": true, "asarUnpack": [ "project/**/*", "translations/**/*" ], "mac": { "target": "dmg", "icon": "app/icon.png" }, "linux": { "target": "deb", "icon": "app/icon.png" }, "win": { "target": [ { "target": "nsis", "arch": [ "ia32","x64" ] } ], "icon": "app/icon.ico" }, "nsis": { "oneClick": false, "perMachine": false, "allowToChangeInstallationDirectory": true }, }, "author": "exrush", "homepage": "https://exrush.com", "dependencies": { "atob": "^2.1.2", "axios": "^0.16.2", "btoa": "^1.2.1", "cors": "^2.8.5", "electron-store": "^7.0.2", "express": "^4.17.1", "gulp-connect-php": "^1.0.1", "license-key-generator": "^1.1.2", "merge-files": "^0.1.2", "node-machine-id": "^1.1.8", "nodejs-license-key": "^1.0.1" }, "devDependencies": { "electron": "^10.0.0", "electron-builder": "^22.9.1" } }
Untuk menjalankan ketikkan di terminal
npm run build
Hasilnya akan disimpan di directory dist
Pengaturan NSIS
oneClick = true perMachine = false allowElevation = true allowToChangeInstallationDirectory = false installerIcon uninstallerIcon installerHeader = build/installerHeader.bmp installerHeaderIcon = build/installerHeaderIcon.ico installerSidebar uninstallerSidebar uninstallDisplayName = ${productName} ${version} include = build/installer.nsh script = build/installer.nsi license = license.txt artifactName = ${productName} Setup ${version}.${ext} deleteAppDataOnUninstall = fals differentialPackage = true displayLanguageSelector = false installerLanguages = en_US language multiLanguageInstaller packElevateHelper = true preCompressedFileExtensions = [".avi", ".mov", ".m4v", ".mp4", ".m4p", ".qt", ".mkv", ".webm", ".vmdk"] unicode = true guid warningsAsErrors = true runAfterFinish = true createDesktopShortcut = true createStartMenuShortcut = true menuCategory = false shortcutName
Tags:
NodeJS