Skip to content

A simple PWA bundler to work with Shiny

License

Notifications You must be signed in to change notification settings

Estatcamp/shinyPWA

 
 

Repository files navigation

shinyPWA

A simple PWA bundler to work with Shiny




Say Thanks!

English README Portuguese README

made-with-r made-with-docker made-with-vscode GPL license GitHub release

Intro

After writing this blogpost about a R + Shiny + Mongo + Docker (RSMD) stack, I've pointed out about shinyMobile pacakge, but to my suprise it's built on to of the Framework7.

So to complement the example shown in my post, to provide a proper Progressive Web App (PWA) experience I've decided to built yet another PWA package to allow my example -- which is based in shinyDashboard -- to work.

Docker

As almost any of my projects by now, I've developed by using Docker, so you can find an image already built to use to test this package in the following architectures:

  • 386
  • amd64
  • arm/v6
  • arm/v7
  • arm64/v8
  • s390x
  • ppc64le

Installing

devtools::install_github('Fazendaaa/shinyPWA')

Using

There is only one function that this package exports, the shinyPWA function. Here's an example in the R + Shiny + Mongo + Docker project:

...
  dashboardBody(
        shinyPWA(list(
            hasIcons = TRUE,
            version = 'v1',
            shortname = 'RSMD',
            name = 'R + Shiy + Mongo + Docker',
            display = 'standalone',
            backgroundcolor = '#fdfdfd',
            themecolor = '#db4938',
            orientation = 'portrait-primary'
        )),
        tabItems(
...

Even the example using shinydashboard, you can use shinyPWA without the dashboard package itself.

If you set hasIcons to TRUE you will need to follow the icons steps.

Icons

If you make icons for your application, just create a folder called icons under your www directory and place it there:

...
 |
 |- www/
 |   |- icons/
 |   |    |- myFirstIcon.png
 |   |    |- mySecondIcon.png
 |   |    |- myThirdIcon.png
 |  ...  ...
...

You do not need to set the aspect ratio of images as is common in PWAs. So you won't need to save something like my-icon-52x52.png, just my-icon.png will be needed.

Contributing

Tests

To run the current tests just:

docker run -it fazenda/shinypwa R -e "devtools::test()"

And if you want to contribute with some code, before opening a new Pull Request (PR) just run:

docker run -it --volume $(pwd):/test --workdir /test fazenda/shinypwa R -e "devtools::test()"

note: of course this will break and not run if you add a new dependency to the package, so a Dockerfile is also provided to aid you in the development

TODO

  • Tests
  • Better docs
  • Write a CONTRIBUTING.md
  • Examples folder
  • Deploy it to CRAN

Author

License

This project is licensed under the GNU v2

References

About

A simple PWA bundler to work with Shiny

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • R 88.5%
  • JavaScript 7.3%
  • Shell 2.1%
  • Dockerfile 2.1%