<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dhankuwar Sisodiya on Medium]]></title>
        <description><![CDATA[Stories by Dhankuwar Sisodiya on Medium]]></description>
        <link>https://medium.com/@dhankuwarsisodiya?source=rss-a02fe9815da6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*25x4jvuluNHi7ZPOS2GeYw.jpeg</url>
            <title>Stories by Dhankuwar Sisodiya on Medium</title>
            <link>https://medium.com/@dhankuwarsisodiya?source=rss-a02fe9815da6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 03:52:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dhankuwarsisodiya/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Electron-winstaller : The windows installer for Electron]]></title>
            <link>https://medium.com/@dhankuwarsisodiya/electron-winstaller-the-windows-installer-for-electron-1b101c3255bd?source=rss-a02fe9815da6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b101c3255bd</guid>
            <category><![CDATA[packaging]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[electron-installer]]></category>
            <category><![CDATA[electron]]></category>
            <dc:creator><![CDATA[Dhankuwar Sisodiya]]></dc:creator>
            <pubDate>Sun, 11 Nov 2018 12:37:26 GMT</pubDate>
            <atom:updated>2018-11-11T12:37:26.286Z</atom:updated>
            <content:encoded><![CDATA[<h3>Electron-winstaller : The windows installer for Electron</h3><p>Electron-winstaller is a NPM module that builds windows installer for windows application using Squirrel. Squirrel is a set of tools and a library, to completely manage installation and updating of Desktop Windows application.</p><p>Using electron-winstaller includes working with the <strong>application folder</strong>( the folder where all your code sub folders resides) and the <strong>root folder</strong> of the application folder (this folder consists of your application folder). Now, because we are going to go back and forth these two folders for installing various packages, the structure of the application folder needs to be clear. Following is the structure of a application folder.</p><pre><em>root folder /</em></pre><pre><em>   ├──applcation folder /<br><br>      ├── package.json<br><br>      ├── main.js<br><br>      └── index.html</em></pre><p>Let’s start with the installation process.</p><ol><li>Route to the root folder of application and install electron-winstaller through command line.</li></ol><pre><strong>npm install electron-winstaller</strong></pre><p>2. Route to the application folder and install squirrel.</p><pre>npm install electron-squirrel-startup</pre><p>3. In main.js file of electron application add the following lines of code at the start of the file.</p><pre><strong>// this should be placed at top of main.js to handle setup events quickly</strong></pre><pre><strong>if (handleSquirrelEvent(app)) {</strong></pre><pre><strong>// squirrel event handled and app will exit in 1000ms, so don&#39;t do anything else</strong></pre><pre><strong>return;</strong></pre><pre><strong>}</strong></pre><p>4. Add the next set of lines at the end of main.js file</p><pre><strong>function handleSquirrelEvent(application) {</strong></pre><pre><strong>if (process.argv.length === 1) {</strong></pre><pre><strong>return false;</strong></pre><pre><strong>}</strong></pre><pre><strong>const ChildProcess = require(&#39;child_process&#39;);</strong></pre><pre><strong>const path = require(&#39;path&#39;);</strong></pre><pre><strong>const appFolder = path.resolve(process.execPath, &#39;..&#39;);</strong></pre><pre><strong>const rootAtomFolder = path.resolve(appFolder, &#39;..&#39;);</strong></pre><pre><strong>const updateDotExe = path.resolve(path.join(rootAtomFolder, &#39;Update.exe&#39;));</strong></pre><pre><strong>const exeName = path.basename(process.execPath);</strong></pre><pre><strong>const spawn = function(command, args) {</strong></pre><pre><strong>let spawnedProcess, error;</strong></pre><pre><strong>try {</strong></pre><pre><strong>spawnedProcess = ChildProcess.spawn(command, args, {</strong></pre><pre><strong>detached: true</strong></pre><pre><strong>});</strong></pre><pre><strong>} catch (error) {}</strong></pre><pre><strong>return spawnedProcess;</strong></pre><pre><strong>};</strong></pre><pre><strong>const spawnUpdate = function(args) {</strong></pre><pre><strong>return spawn(updateDotExe, args);</strong></pre><pre><strong>};</strong></pre><pre><strong>const squirrelEvent = process.argv[1];</strong></pre><pre><strong>switch (squirrelEvent) {</strong></pre><pre><strong>case &#39;--squirrel-install&#39;:</strong></pre><pre><strong>case &#39;--squirrel-updated&#39;:</strong></pre><pre><strong>// Optionally do things such as:</strong></pre><pre><strong>// - Add your .exe to the PATH</strong></pre><pre><strong>// - Write to the registry for things like file associations and</strong></pre><pre><strong>//   explorer context menus</strong></pre><pre><strong>// Install desktop and start menu shortcuts</strong></pre><pre><strong>spawnUpdate([&#39;--createShortcut&#39;, exeName]);</strong></pre><pre><strong>setTimeout(application.quit, 1000);</strong></pre><pre><strong>return true;</strong></pre><pre><strong>case &#39;--squirrel-uninstall&#39;:</strong></pre><pre><strong>// Undo anything you did in the --squirrel-install and</strong></pre><pre><strong>// --squirrel-updated handlers</strong></pre><pre><strong>// Remove desktop and start menu shortcuts</strong></pre><pre><strong>spawnUpdate([&#39;--removeShortcut&#39;, exeName]);</strong></pre><pre><strong>setTimeout(application.quit, 1000);</strong></pre><pre><strong>return true;</strong></pre><pre><strong>case &#39;--squirrel-obsolete&#39;:</strong></pre><pre><strong>// This is called on the outgoing version of your app before</strong></pre><pre><strong>// we update to the new version - it&#39;s the opposite of</strong></pre><pre><strong>// --squirrel-updated</strong></pre><pre><strong>application.quit();</strong></pre><pre><strong>return true;</strong></pre><pre><strong>}</strong></pre><pre><strong>};</strong></pre><p>5. Route back to the root folder of the application and run the following command which will create an exe file of your application. Do not forget to mention the electron-version to avoid error in electron-packaging.</p><pre><strong>electron-packager &quot;PATH/TO/APPLICATION/FOLDER&quot; --platform=win32 --arch=x64 myApplicationBuilt --electron-version 2.0.5</strong></pre><p>6. Create an installer folder in the root folder of the application. Ex — myApplication-installers( this name will be used in the next step)</p><p>7. Create a text file named “build.js” in the root folder of the application and add the following line to the build.js file.</p><pre><strong>// C:\Users\sdkca\Desktop\electron-workspace\build.js</strong></pre><pre><strong>var electronInstaller = require(&#39;electron-winstaller&#39;);</strong></pre><pre><strong>// In this case, we can use relative paths</strong></pre><pre><strong>var settings = {</strong></pre><pre><strong>// Specify the folder where the built app is located</strong></pre><pre><strong>appDirectory: <em>&#39;./myApplicationBuilt-win32-x64&#39;</em>,</strong></pre><pre><strong>// Specify the existing folder where</strong></pre><pre><strong>outputDirectory: <em>&#39;./myApplication-installers&#39;,</em></strong></pre><pre><strong>// The name of the Author of the app (the name of your company)</strong></pre><pre><strong>authors: &#39;Dhankuwar Sisodiya&#39;,</strong></pre><pre><strong>// The name of the executable of your built</strong></pre><pre><strong>exe: &#39;./myApplication.exe&#39;,</strong></pre><pre><strong>description: &#39;My first electron application&#39;</strong></pre><pre><strong>};</strong></pre><pre><strong>resultPromise = electronInstaller.createWindowsInstaller(settings);</strong></pre><pre><strong>resultPromise.then(() =&gt; {</strong></pre><pre><strong>console.log(&quot;The installers of your application were succesfully created !&quot;);</strong></pre><pre><strong>}, (e) =&gt; {</strong></pre><pre><strong>console.log(`Well, sometimes you are not so lucky: ${e.message}`)</strong></pre><pre><strong>});</strong></pre><p><strong>NOTE</strong>- In the file above the values of appDirectory, outputDirectory, exe need to be changed according to your application folder names. The appDirectory will be the the name of the folder that was created after running the electron-packager command (will usually end in …-win32-x64). The outputDirectory will be the name of folder you created in step 6. And the exe name will be the name of the exe generated in the appDirectory folder.</p><p>8. And for the final step you will have to route back to the root folder of the application and run the following command.</p><pre><strong>node build.js</strong></pre><p>And finally, you have your windows installer, a SETUP file for your electron application in folder created in step 6 ready to be distributed.</p><p>For more configuration settings supported by the electron-winstaller visit : <a href="https://github.com/electron/windows-installer">https://github.com/electron/windows-installer</a></p><p>I hope this was helpful! Cya soon! :)</p><p>References:</p><p>[1] <a href="https://github.com/electron/windows-installer">https://github.com/electron/windows-installer</a></p><p>[2] <a href="https://www.christianengvall.se/electron-windows-installer/">https://www.christianengvall.se/electron-windows-installer/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b101c3255bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Packaging an Electron application]]></title>
            <link>https://medium.com/@dhankuwarsisodiya/packaging-an-electron-application-d26d07feed3?source=rss-a02fe9815da6------2</link>
            <guid isPermaLink="false">https://medium.com/p/d26d07feed3</guid>
            <category><![CDATA[packaging]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[electron]]></category>
            <dc:creator><![CDATA[Dhankuwar Sisodiya]]></dc:creator>
            <pubDate>Thu, 18 Oct 2018 11:47:29 GMT</pubDate>
            <atom:updated>2018-10-18T11:47:29.008Z</atom:updated>
            <content:encoded><![CDATA[<p>Packaging an electron application means generating executable bundles for various platforms of your developed electron application. It generates bundles for following target platforms-</p><ul><li>Windows (also known as win32, for both 32/64 bit)</li><li>OS X (also known as darwin) / Mac App Store (also known as mas)</li><li>Linux (for x86, x86_64, and armv7l architectures)</li></ul><p>The electron community provides us with different modules to choose from for packaging our application.</p><ol><li><em>electron-builder</em></li><li><em>electron-packager</em></li></ol><p>We will be looking at the electron-packager module. Electron Packager is a command line tool and Node.js library that bundles Electron-based application source code with a renamed Electron executable and supporting files into folders ready for distribution.</p><h4><strong><em>Step 1: Installation</em></strong></h4><p>Route to your project folder from the command line and install electron-packager using the following commands.</p><pre>npm install electron-packager --save-dev</pre><h4>Step 2: Packaging</h4><pre>electron-packager &lt;sourcedir&gt; &lt;appname&gt; --platform=&lt;platform&gt; --arch=&lt;arch&gt; [optional flags...]</pre><p>This command will</p><ul><li>Find or download the correct release of Electron</li><li>Use that version of Electron to create a app in &lt;out&gt;/&lt;appname&gt;-&lt;platform&gt;-&lt;arch&gt; <em>(this can be customized via an optional flag)</em></li></ul><p><strong>— platform</strong> and <strong>— arch</strong> can be omitted, in two cases. If you specify <strong>— all </strong>instead, bundles for all valid combinations of target platforms/architectures will be created. Otherwise, a single bundle for the host platform/architecture will be created.</p><p>If appname is omitted, this will use the name specified by &quot;productName&quot; or &quot;name&quot; in the nearest package.json.</p><p><strong>Note: </strong>Characters in the Electron app name which are not allowed in all target platforms’ filenames (e.g., /), will be replaced by hyphens (-).</p><p>And that’s it! Your electron application is successfully packaged and ready to be distributed. For more information on electron-packager visit <a href="https://github.com/electron-userland/electron-packager">https://github.com/electron-userland/electron-packager</a>.</p><p>References:</p><p>[1] <a href="https://github.com/electron-userland/electron-packager">https://github.com/electron-userland/electron-packager</a></p><p>[2] <a href="https://www.tutorialspoint.com/electron/electron_packaging_apps.htm">https://www.tutorialspoint.com/electron/electron_packaging_apps.htm</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d26d07feed3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to building a Native Desktop Application Using Electron]]></title>
            <link>https://medium.com/@dhankuwarsisodiya/introduction-to-building-a-native-desktop-application-using-electron-12a576c295e7?source=rss-a02fe9815da6------2</link>
            <guid isPermaLink="false">https://medium.com/p/12a576c295e7</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[electron]]></category>
            <dc:creator><![CDATA[Dhankuwar Sisodiya]]></dc:creator>
            <pubDate>Mon, 10 Sep 2018 13:27:02 GMT</pubDate>
            <atom:updated>2018-10-19T04:18:10.564Z</atom:updated>
            <content:encoded><![CDATA[<p>Building a desktop application from scratch using a completely new language can be tedious. So, how to build a desktop application without the need to learn a new language?</p><p>Electron.js lets you build desktop applications using web technologies you already know. It is an open source framework that uses technologies like JavaScript, HTML and CSS. Relived? Guess what? It is also a cross-platform application development. Your desktop application will run on all major operating systems like MacOS, Windows and linux. Few applications developed using electron.js are Skype, Atom, Slack, and Visual Studio Code.</p><p>Now let’s start making our very first electron.js application.</p><p><strong>Step 1: Install Electron</strong></p><p>Assuming you have Node.js installed on your computer, all you need is to run the following commands to install electron from the application folder.</p><p>Install the `electron` command globally</p><pre><em>npm install electron-prebuilt -g</em></pre><p>Install as a development dependency</p><pre><em>npm install electron-prebuilt --save-dev</em></pre><p><strong>Step 2: Create your app</strong></p><p>Creating an application starts with developing the html file along with its css and js.</p><p><strong>Step 3: Including main.js file</strong></p><p>Contents of main.js file will be</p><pre><em>const electron = require(&#39;electron&#39;);</em></pre><pre><em>// Module to control application life.<br><br>const {app} = electron;</em></pre><pre><em>// Module to create native browser window.<br><br>const {BrowserWindow} = electron;</em></pre><pre><em>// Keep a global reference of the window object, if you don&#39;t, the window will</em></pre><pre><em>// be closed automatically when the JavaScript object is garbage collected.<br><br>let win;</em></pre><pre><em>function createWindow() {</em></pre><pre><em>// Create the browser window.<br><br>  win = new BrowserWindow({width: 800, height: 600});</em></pre><pre><em>// Open the DevTools.<br>  win.webContents.openDevTools();</em></pre><pre><em>// and load the index.html of the app.<br><br>  win.loadURL(`file://${__dirname}/index.html`);</em></pre><pre><em>// Emitted when the window is closed.<br><br>  win.on(&#39;closed&#39;, () =&gt; {<br><br>    // Dereference the window object, usually you would store windows<br><br>    // in an array if your app supports multi windows, this is the time<br><br>    // when you should delete the corresponding element.<br><br>    win = null;<br><br>  });<br><br>}</em></pre><pre><em>// This method will be called when Electron has finished<br><br>// initialization and is ready to create browser windows.<br><br>// Some APIs can only be used after this event occurs.<br><br>app.on(&#39;ready&#39;, createWindow);</em></pre><pre><em>// Quit when all windows are closed.<br><br>app.on(&#39;window-all-closed&#39;, () =&gt; {</em></pre><pre><em>// On macOS it is common for applications and their menu bar<br><br>  // to stay active until the user quits explicitly with Cmd + Q<br><br>  if (process.platform !== &#39;darwin&#39;) {<br><br>    app.quit();<br><br>  }<br><br>});</em></pre><pre><em>app.on(&#39;activate&#39;, () =&gt; {<br><br>  // On macOS it&#39;s common to re-create a window in the app when the<br><br>  // dock icon is clicked and there are no other windows open.<br><br>  if (win === null) {<br><br>    createWindow();<br><br>  }<br><br>});</em></pre><pre><em>// In this file you can include the rest of your app&#39;s specific main process<br><br>// code. You can also put them in separate files and require them here.</em></pre><p><strong>Step 4: Adding package.json file</strong></p><p>Package.json file will include basic description of the application in json format</p><p>Contents of package.json file:</p><pre><em>{<br> “name” : “Hello World”,<br> “version” : “0.1.0”,<br> “author” : “Dhankuwar Sisodiya”<br> “main” : “main.js”<br> }</em></pre><p>If you change the name of the main.js file, it should also be changed in the value of key ‘main’ in package.json file. Otherwise the application won’t run.</p><p>The file directory structure of your app will look similar to this</p><pre><em>yourApp /<br><br>├── package.json<br><br>├── main.js<br><br>└── index.html</em></pre><p><strong>Step 5: Running the app</strong></p><pre>Run <em>`electron .`</em> command in your $PATH from the command line.</pre><p>And there you have your first electron application up and running!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*XIY_yvFbwe6c6oBb-waE0Q.png" /><figcaption>Output of ‘electron .’ command, your running application</figcaption></figure><p>Below is the link to the source code of the above electron application:</p><p>link- <a href="https://github.com/DhankuwarSisodiya/Electron">https://github.com/DhankuwarSisodiya/Electron</a></p><p>You can review my blog in the comments below. And follow me for more electron posts!</p><p>Cya! :)</p><p>References:</p><p>[1] <a href="https://electronjs.org/docs/tutorial/first-app">https://electronjs.org/docs/tutorial/first-app</a></p><p><a href="http://· https://medium.com/talk-like/getting-started-with-electron-js-f8ead9ababd">[2] https://medium.com/talk-like/getting-started-with-electron-js-f8ead9ababd</a></p><p>[3] <a href="https://opensourceforu.com/2017/12/electron-building-cross-platform-desktop-apps-with-web-technologies/">https://opensourceforu.com/2017/12/electron-building-cross-platform-desktop-apps-with-web-technologies/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12a576c295e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>