3.2 Starting and Compiling the App
The application is based on a method devised by the Columbus Collabatory. Essentially, you call the shiny application from the stand-alone R compiler and display the webpage on a chromium browser. For now I only have it working on macbook, but it is possible to get it working on linux and windows too; I just haven’t had the time to do this yet.
If you want to further develop/recompile the application you will need to install Node.js (a javascript runtime environment). This will allow you to use the javascript package manager, npm, from your terminal to install the “electron-packager” package globally (g argument). The electron-packager will be required to turn the code into an executable. Run the following when inside the electron-quick-start folder:
npm install electron-packager -g
The main.js and package.json files, along with the node_modules folder come standard when creating a new electron application. You will need to install the javascript dependencies too, listed in the node_modules folder:
npm install
To test if this worked you can run the app by typing the following:
npm start
The app will open up in a new chromium window after a brief loading screen. If you edit any of the R files, the changes can be seen immidiately if you hit npm start again. This is the way I recommend you debug any changes.
To compile the app you need to type the following if you are on mac:
npm run package-mac
This will produce an additional folder called ElectronShinyAppMac. Within that is another folder, electron-quick-start-darwin-x64, which contains the executable. If you want to recompile the app, because you have altered the R code or whatever, then you can delete these new folders and run the command again.