Generate A Debuggable Dmg Of Electron App
- Generate A Debuggable Dmg Of Electron App For Iphone
- Generate A Debuggable Dmg Of Electron App Free
- Generate A Debuggable Dmg Of Electron Application
Oct 29, 2016 In the last blog post on Setting Up Electron Framework for Desktop Apps, we talked about Electron framework and its installation, we also tried a 'Hello World' example in Electron. This post will a short one and will help you to configure Electron in an IDE - IntelliJ IDEA 2016. Let's get started with our configuration, first thing. Sep 10, 2016 Learn how to debug both main and renderer process with Visual Studio Code. More Electron stuff on http://electron.rocks.
constpackagejson=require('./package.json'); |
constbuilder=require('electron-builder'); |
constmimes=newMap(); |
mimes.set('exe','exe'); |
mimes.set('dmg','dmg'); |
mimes.set('zip','zip'); |
mimes.set('AppImage','x-executable'); |
//Development package.json, see https://goo.gl/5jVxoO |
constdevMetadata=packagejson.electronBuilder; |
//Application package.json |
constappMetadata={ |
name: packagejson.name, |
version: packagejson.version, |
description: packagejson.description, |
author: packagejson.author |
}; |
functionbuildPromise(){ |
returnnewPromise((resolve,reject)=>{ |
builder |
.build({projectDir: './', devMetadata, appMetadata }) |
.then(args=>{ |
constfilePath=args[0]; |
constfileName=filePath.substr(filePath.replace(//g,'/').lastIndexOf('/')+1); |
constext=fileName.substr(fileName.lastIndexOf('.')+1); |
letmimeType; |
if(mimes.has(ext)) |
mimeType=`application/${mimes.get(ext)}, application/octet-stream`; |
else |
console.warn(`Unsupported file type '${ext}' in file '${filePath}'; mime type will be null`); |
resolve({fileName, filePath, mimeType}); |
}).catch((error)=>{ |
console.error(error); |
}); |
}); |
} |
module.exports=buildPromise; |
Generate A Debuggable Dmg Of Electron App For Iphone
'electronBuilder': { |
'build': { |
'productName': 'Node Performance Measure', |
'appId': 'EikosPartners.NodePerformanceMeasure', |
'asar': false, |
'win': { |
'iconUrl': 'http://localhost:5000/images/eikos-logo-multi.ico', |
'target': 'nsis' |
}, |
'nsis': { |
'oneClick': false, |
'allowElevation': false |
}, |
'linux': { |
'target': 'AppImage', |
'category': 'Development' |
}, |
'mac': { |
'target': 'dmg' |
} |
}, |
'directories': { |
'output': 'electron/output', |
'app': 'electron/app', |
'buildResources': 'electron/buildResources' |
} |
} |
Generate A Debuggable Dmg Of Electron App Free
<div> |
<inputtype='button' value='Electron' onclick='downloadElectron();' /> |
<spanid='spanElectron'>Build Electron Version Installer for detected OS:</span> |
</div> |
<scripttype='text/javascript'> |
varosdetect='UNKNOWN!'; |
varplatform=navigator.platform.toLowerCase(); |
if(platform.indexOf('win') >= 0) |
osdetect='Windows'; |
elseif(platform.indexOf('mac') >= 0) |
osdetect='MacOS'; |
elseif(platform.indexOf('linux') >= 0) |
osdetect='Linux'; |
document.getElementById('spanElectron').innerHTML+=' <i><strong>'+osdetect+'</strong></i>'; |
functiondownloadElectron(){ |
varhostname=location.hostname; |
varport=location.port.length>0 ? ':'+location.port : '; |
varurl='http://'+hostname+port+'/electron' |
window.open(url); |
} |
</script> |
//Install page for Electron Application |
router.get('/electron',function(req,res,next){ |
electronBuilder() |
.then(e=>fs.readFile(e.filePath,(err,data)=>{ |
res.setHeader('Content-Disposition',`attachment; filename='${e.fileName}'`); |
res.setHeader('Content-type',e.mimeType); |
res.send(data); |
})).catch((error)=>{ |
console.error(error); |
}); |
}); |
If you want to create instead of a Squirrel based installer, a MSI (Microsoft Installer) setup, please follow this tutorial instead.
As a developer, you may know that Linux has package managers so the developers don't 'need' to make the installers. Developers just need to provide a package for a distribution, each distribution then has a way to install this package and this way can be in a terminal (apt-get
) or via a graphical interface, e.g. Ubuntu Software Center. However, Windows is not Linux.
Almost all installers are created by a tool (e.g. WiX, Nsis, Inno Setup and many others). In this article, you will learn how to create an installer for windows using the electron-winstaller module which uses Squirrel, the installation and update framework for Windows desktop apps.
1. Prepare your work area
And with this, we don't mean that you should clean your computer. To make this tutorial easy to understand, we are going to create a folder in the desktop with the name electron-workspace
, this folder will contain inside a folder that contains the source code of your Electron Project:
In this case, the folder will be located at C:UserssdkcaDesktopelectron-workspace
and the source code of the electron project will be inside of it (myapp-source
).
2. Install the Electron winstaller module
Now, we need to install the module that will help us to create the installer, in this case we are going to use electron-winstaller. This NPM module builds Windows installers for Electron apps using Squirrel. Start the NodeJS command prompt and Navigate to the workspace using (note that the module needs to be installed in the workspace, not in your project):
And then install the module with:
After the installation of the module, our workspace will have now 2 folders:
3. Manage desktop shortcuts (install, update and uninstall events)
An application that can be installed, but the executable can't be found to start it once it's closed doesn't work for nothing. Therefore, we are going to use the electron-squirrel-startup module that will help you to achieve our goal. It handles the most common commands, such as managing desktop shortcuts (installation event, update event and uninstall event).
This module needs to be installed inside your project, not in the workspace, therefore navigate to the folder of the source code of your Electron project with the NodeJS command prompt, in this case we are going to use:
And then install the module using:
After the installation of the module, we need to instruct with some code what we are going to do. We are going to add some code, specifically in the main.js
file of your Electron Project. At the start of your file (after the declaration of the app variable) add the following lines:
The handleSquirrelEvent
function expects as first argument the app variable, this function can be added at the end of your main.js
file:
Jan 11, 2018 In every technical forum, queries like how to open and view DMG files in Windows keep coming up. We also come across questions about extracting DMG files in Windows. Taking these queries into consideration, we will discuss how to open, view and extract DMG files in. Extract DMG files data from Mac OS X on Windows 10, 8.1, 8, 7, XP, Vista, etc. DMG Extractor software to view items of Read-Only & Compressed DMG files. Open DMG Files in Windows By Using 7-Zip or DMG Extractor. There are a lot of different tools you can use to extract DMG files in Windows. Our two favorites are 7-Zip and DMG Extractor. In our testing, we found a few DMG files that would open with one of those apps but not the other. Recover lost or deleted iOS data and passcodes Explore + extract data from iOS backups & devices Download iCloud photos & data Manage & backup your iPhone and iPad Work with DMG files on Windows Get data from BlackBerry backups. For Windows 10, this is the best archive utility available. It allows you a great deal of versatility when handling DMG disk image files. Part 3: How to Extract a DMG File with DMG Viewer ($29) Another utility to open DMG files in Windows 10 is DMG Viewer. This utility can be used to view two types of DMG files: Read only and Compressed. How to extract dmg files in windows 10.
Note
The following code will be only executed if the application is within an installer, so this code will be not executed while you work on your project.
The previous code should handle the basic things that happens when a new app is installed in your system e.g the shortcut will be added to the Start Menu and Desktop and it will remove the shortcut when the uninstaller is executed, besides it should work without any modification. Feel free to add more code if you need to.
4. Build your app
The required modifications to accomplish the basic tasks of an installed applications were made, now proceed to build your application. We assume that you know how to build your application using tools like electron-packager. If you don't, please read the following article about how to create a distribution from your app using electron packager in Windows.
After know how to build your application, proceed to do it. Navigate to the workspace (in order to build the project inside of it):
And build the project, for example, we are going to build our project using the following command:
That will create the myapp-source-built-win32-x64
folder inside the electron-workspace
folder that has the following structure:
5. Create an installer from your application
Once your project has been built, you can create an installer from it. Create a folder where the installers will be created, specifically in our workspace (C:UserssdkcaDesktopelectron-workspace
) with the name you want, in this case it will be myapp-source-built-installers
. You won't touch this folder as the installers will be created in the next step automatically. At this step, you should have 4 folders (myapp-source-built-installers
is empty):
Now create a script that will create our installers, create the build.js
file in our electron workspace (C:UserssdkcaDesktopelectron-workspace
) with the following code inside:
Note
If you don't feel comfortable working with relative paths, you can use absolute paths in your first try to know what's happening.
Note
You can change the icon and other properties in the settings of the previous script. Check all the supported options here.
To build an installer from your app, you just need to execute this script. However, in case that you find this error:
The Component/@Id attribute's value, 'your-app-exe-name.exe', is not a legal identifier. Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.). Every identifier must begin with either a letter or an underscore.
Is necessary to edit the name property of your project in the /your-built-project/resources/app/package.json
file and remove or replace all the hyphen (-
symbol) e.g if your package.json
looks like:
Change it to:
If you already verified this, proceed to execute the build.js
script navigating to the workspace with the NodeJS command prompt:
And execute the script:
The installer files will be created and it will took a while. Once the installers are created you will see the following message in the console:
Finally, open the installers folder (in this case located in C:UserssdkcaDesktopelectron-workspacemyapp-source-built-installers
) and you will find there 3 installers (msi installer, executable installer and a nuGET package):
You can try to install your app locally executing as administrator the Setup.exe
file. Then a mini setup will install the application on your system and you will be able to see it in the start menu of Windows and as a shortcut in the Desktop:
Note
The setup loading animation can be changed if you provide the path of a gif file to show during the installation in the loadingGif
option in your build.js
script.
Note that the name of the executable, description and other properties can be changed in the package.json
of your app and in the options of the winstaller module, for more information please visit the repository to see the documentation.
Important notes
For development or internal use, creating installers without a signature is okay, but for a production app you need to sign your application. Internet Explorer's SmartScreen filter will block your app from being downloaded, and many anti-virus vendors will consider your app as malware unless you obtain a valid cert.
Any certificate valid for 'Authenticode Code Signing' will work here, but if you get the right kind of code certificate, you can also opt-in to Windows Error Reporting. This MSDN page has the latest links on where to get a WER-compatible certificate. The 'Standard Code Signing' certificate is sufficient for this purpose.
Generate A Debuggable Dmg Of Electron Application
Happy coding !