knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = FALSE )
The easiest way to get started building your app is with the electrify()
function. This is a "metafunction" that calls the other functions of electricShine in the order that the package was intended to build apps.
If you want more control (e.g. icons haven't yet been implemented)...until a more thorough vignette is written, you can use source code of electrify()
as a guide to step through the build process.
Unless you are customizing the nodejs code, you should only ever have to interact with one function:
electricShine::electrify()
run_app()
Your package must have a function that starts your Shiny app.
functionName
argumnet of electrify()
:electricShine::electrify(functionName='run_app')
The function must have an options
argument to pass to to shiny::shinyApp()
(example below).
To modify the example: Replace the app_ui
with your package's app_ui
function name. Replace the app_server
with your package's app_server
function name.
run_app <- function(options = list()) { shinyApp(ui = app_ui, server = app_server, options = options) }
By running the electricShine::electrify()
function your R session will start doing the following things:
This will take some time depending on your internet speed, and computer. The build step is the longest and can take minutes (seems to be IO-limited so a fast hard drive will work best). An internet connection is required.
In the directory your specified in buildPath
, you will find a new folder named what you chose for appName
. Directly inside you will find the raw electron build. Your new electron .exe
can be found in buildPath/appName/dist
, where appName
is what you assigned electrify(appName = )
.
Advanced: If you want to test the electron app without installing. You can open cmd.exe and cd
to buildPath/appName
and if you have nodejs installed and in your PATH
, use the command npm start
to initiate the app.
Advanced: If you want to make changes before creating the exe- run the electricShine::electrify()
with build = FALSE
and make your changes within buildPath/appName
. When you're ready to build the installer run the following, using the same buildPath
and appName
as in electricShine::electrify()
.
electricShine::run_build_release(nodejs_path = file.path(system.file(package = "electricShine"), "nodejs"), app_path = file.path(buildPath, appName), nodejs_version = "12.13.0")
You can also run npm release
from the app's directory.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.