In previous tutorial,we have
successfully created desktop application
with electron but the problem is we need
to use the command prompt to execute the
app manually and that's not good for the
user right? So we need to package the app
into executable file. For Windows, it will be
.exe file. For this tutorial I'm going to
use electron-packager to package the app
You can start by pull the command prompt and
use npm install command to install the
electron-packager
Now make sure that you are in the
current project directory. You can try
start app
OK, so the next step is to
package the app using electron-packager
followed by dot. The dots represents the
current directory
The electron packager will automatically
detect the host system. This case it
will be Windows and they will package the app
accordingly. The app will be packaged
into the folder with executable file
So now your app was packaged into a
folder. We can distribute your app easily
by coping the folder or you can zip it. Whatever
it's up to you. But the problems is our
application source code will be
unprotected. You can still see the
package.json, html file and the main
javascript file. So we need to specify
another option to make the electron-packager
hide the source code when
packaging the app. We're going to close
the app and delete the package
To package the app and make the packager hide
the source code, you need to specify extra
option call "--asar"
You'll see that your application source
code will be bundled together in an asar file
Actually it's not 100% safe
Users can still browse the code but it's
definitely better than leave the file
like the way it is when we develop the app!
So that's all the basic about
packaging the application. One final
notes that you can also package the app
for other platforms by using "--all" option
This will make the packager
package the application for platform like Linux
OSX and Windows. You'll need to download
some additional files
And it will take a while so that's all for now
Thanks for watching and don't forget to
checkout other interesting video from our Channel
Bye!