Building asar on Windows

Making Owari has been a joy thanks to atom-shell, allowing me to put all my front-end developer knowledge to use into make an actual game. However, I hit a snap thanks to the ease of use brought by this web tech: code access.

Unlike natively programmed applications which usually compile source code into the binaries the user runs, all of my source code is the very code running the game (i.e. javascript). Now, it is not a HUGE issue for people to see my code. Thing is, due to the nature of being a game, I'd simply prefer to hide the code as much as possible from users to avoid them editing files to their own benefit (cheats or what have you).

Fortunately, atom-shell's own documentation recommends to use asar, an archive format, to package your applications with. Unfortunately, there is no "WinAsar" program to quickly whip one of those up for me. Also, it turns out even installing the asar tools is a little trickier on Windows.

First off, you'll need nodeJS installed (which you probably already do, if you're messing around with atom-shell). Now, on linux/mac systems, it seems it'd be as simple as doing a npm install asar in the command line and you're done. However, on Windows 7 I ran into an issue with node-gyp, which I had found a few similar cases from users on StackOverflow.

node-gyp has to compile for your system, and apparently yo compile for a Windows system (at least, with node-gyp) you're going to need Visual Studio. I found a 2010 version I had previously installed, and I'm still not quite sure if it still would have worked, but I went ahead and downloaded the 2013 Community Edition which is what I had found to work.

At this point, installing asar should work BUT if you also happened to have 2 versions of VS and need node-gyp to compile with the latest one, I found the command line can accept an argument to change that for you:

npm install asar --msvs_version=2013

Done. After that fun preparation, asar finally compiled and installed for me and I can now archive my source code into these nice (probably easily extracted but better than nothing) packages.