{"id":638,"date":"2017-09-12T14:14:20","date_gmt":"2017-09-12T13:14:20","guid":{"rendered":"http:\/\/watchdiana.fail\/blog\/?p=638"},"modified":"2017-09-12T14:27:19","modified_gmt":"2017-09-12T13:27:19","slug":"packaging-electron-for-other-users","status":"publish","type":"post","link":"https:\/\/watchdiana.fail\/blog\/2017\/09\/12\/packaging-electron-for-other-users\/","title":{"rendered":"Packaging electron for other users"},"content":{"rendered":"<p>Notes from a small Laptop&#8230;<\/p>\n<p>Finding instructions for packaging election apps turned out to lead me, moment by moment, inexorably through the madness that is youtube.  So, here is my typed version of Things That I Did, picked up from youtube and https:\/\/ourcodeworld.com\/articles\/read\/365\/how-to-create-a-windows-installer-for-an-application-built-with-electron-framework .<\/p>\n<p>First of all, I moved all electron-based folders into an electron workspace.  Into that workspace I hit <code>npm install electron-winstaller<\/code>.<\/p>\n<p>Then<\/p>\n<p><code>cd whatever-your-app-folder-is<\/code><\/p>\n<p>and<\/p>\n<p><code>npm install electron-squirrel-startup<\/code><\/p>\n<p>and wait a bit.  Now is a good time for a cup of tea.  Frankly any time is a good time for a cup of tea, but during downloads and installation you should be stretching your legs anyhow.<\/p>\n<p>Now we alter the main.js file to handle events from squirrel.<\/p>\n<p>After the const app module to control application life, we add some code snippets from ourcodeworld.<\/p>\n<p>Then we find a link to electron-packager, and then we cry.<\/p>\n<p>So&#8230;<\/p>\n<p><code>npm install electron-packager -g<\/code>  \/\/ The -g switch gives us a global install<\/p>\n<p>We roll back npm 5.3.0 to 5.2.0 because otherwise the build breaks.<\/p>\n<p><code>npm i -g npm@5.2<\/code>  \/\/ On my ARCH installation I tried out 5.4 instead.  Results as yet unknown.<\/p>\n<p>We add a script to package.json and we run it, and it works, and we launch the app, and it dies.<\/p>\n<p>Well, crap.<\/p>\n<p>OK, so there are unexpected tokens, which means it&#8217;s borking on the not-JavaScript bits, which means it needs to be part of Webpack.  So we use webpack-electron-packager instead, and there are tutorials for that so here, gentle reader, I leave you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Notes from a small Laptop&#8230; Finding instructions for packaging election apps turned out to lead me, moment by moment, inexorably through the madness that is youtube. So, here is my typed version of Things That I Did, picked up from youtube and https:\/\/ourcodeworld.com\/articles\/read\/365\/how-to-create-a-windows-installer-for-an-application-built-with-electron-framework . First of all, I moved all electron-based folders into an electron [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,26,66],"tags":[9,2,101,25],"class_list":["post-638","post","type-post","status-publish","format-standard","hentry","category-coding","category-oses","category-software-and-firmware","tag-coding","tag-failing-is-fun","tag-fun-with-a-microbit","tag-fun-with-windows","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/posts\/638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/comments?post=638"}],"version-history":[{"count":2,"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/posts\/638\/revisions"}],"predecessor-version":[{"id":642,"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/posts\/638\/revisions\/642"}],"wp:attachment":[{"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/media?parent=638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/categories?post=638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/tags?post=638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}